[R] problems with specifying an offset term in lmer and lmer2

Matthias Schmidt Matthias.Schmidt at nw-fva.de
Wed Aug 15 15:21:30 CEST 2007


Dear all,

I just want to integrate an offset in a linear mixed model applying 
functions lmer and lmer2 from library(lme4). It seems that lmer just 
ignores the offset term and lmer2 does the fit but replies an error if 
calling the fitted object:

#lmer with offset
lmeTNr_offset<-lmer(res_id~1+offset(fit.gam)+(1|TNr),Bu_WP)
lmeTNr_offset
Linear mixed-effects model fit by REML
Formula: res_id ~ 1 + offset(fit.gam) + (1 | TNr)
    Data: Bu_WP
    AIC   BIC logLik MLdeviance REMLdeviance
  -8869 -8852   4436      -8883        -8873
Random effects:
  Groups   Name Variance Std.Dev.
  TNr           0.016274 0.12757
  Residual      0.033355 0.18263
number of obs: 25208, groups: TNr, 4812

Fixed effects:
              Estimate Std. Error t value
(Intercept) -0.008815   0.002342  -3.764

#results in the same output as the specification without an offset:

#lmer without offset
lmeTNr<-lmer(res_id~1+(1|TNr),Bu_WP)
lmeTNr
Linear mixed-effects model fit by REML
Formula: res_id ~ 1 + (1 | TNr)
    Data: Bu_WP
    AIC   BIC logLik MLdeviance REMLdeviance
  -8869 -8852   4436      -8883        -8873
Random effects:
  Groups   Name Variance Std.Dev.
  TNr           0.016274 0.12757
  Residual      0.033355 0.18263
number of obs: 25208, groups: TNr, 4812

Fixed effects:
              Estimate Std. Error t value
(Intercept) -0.008815   0.002342  -3.764

#lmer2 with offset
lme2TNr_offset<-offset<-lmer2(res_id~1+offset(fit.gam)+(1|TNr),Bu_WP)

#calling lme2TNr_offset results in an error:

error in checkSlotAssignment(object, name, value) :
         assignment of an object of class "array" is not valid for slot 
"offset" in an object of class "summary.lmer2"; is(value, "numeric") is 
not TRUE


thanks for any help

best regards

Matthias




-------------------------------------------
Dr. Matthias Schmidt

Nordwestdeutsche Forstliche Versuchsanstalt
Abteilung Waldwachstum
Grätzelstr. 2
37079 Göttingen
TEL.: 0551/69401-110
Fax:  0551/69401-160

The Northwest German Forest Research Institute
Department of Forest Growth
Grätzelstr. 2
37079 Göttingen
TEL.: 0551/69401-110
Fax:  0551/69401-160



More information about the R-help mailing list