[R-sig-ME] specification of conditional random effects in lme

albrechj at staff.uni-marburg.de albrechj at staff.uni-marburg.de
Thu Oct 11 17:09:41 CEST 2012


Hello,

I have a question regarding the correct specification of the  
conditional random effects in the function lme in package nlme.

Consider the following dataset:

str(data1)
'data.frame':   18 obs. of  6 variables:
$ site      : Factor w/ 10 levels "a","b","c",...
$ year      : Factor w/ 2 levels "2011","2012"
$ covariate : num
$ FactorA   : Factor w/ 2 levels "0","1"
$ FactorB   : Factor w/ 2 levels "0","1"
$ Y         : num

I want to analyse the effect of the covariate and the main factors A  
and B and their interaction A x B on the response Y. The data has been  
collected in 10 study sites in 2011 and in 8 of these sites in 2012.
In the specification of the linear mixed effects model I would like to  
fit year as a conditional random effect on site.

So my question is, whether I have to include year in the specification  
of the "fixed effect" as well:

fit1 <- lme(fixed = Y ~ covariate + (A + B)^2 + year, random = ~  
year|site, data = data1)

or whether I can omit year from the fixed effects, when I am not  
interested in the effect of year, but just want to account for a  
potential effect of year:

fit2 <- lme(fixed = Y ~ covariate + (A + B)^2, random = ~ year|site,  
data = data1)

Is there anything fundamentally wrong in the second way of model  
specification?

Sincerely,

Jörg



More information about the R-sig-mixed-models mailing list