[R-sig-ME] crossed random effects example

Jeroen Ooms j.c.l.ooms at uu.nl
Sun Mar 1 00:00:41 CET 2009


I am trying to learn about crossed random effects modeling in lme4. I
found this presentation that provides a small crossed dataset.
http://www.biostat.jhsph.edu/~fdominic/teaching/bio656/lectures/5addsin.crosslevels.ppt
I would like to reproduce the variance components as reported on slide
9 of the powerpoint. Here is my code:

y <- c(0.38,0,0.38,0,.33,1,.12,1,.25,0,.5,.12,.5,1,.12,.86,.5,.67,.33,0,.14,1,0,1,.14,0,.71,0,.29,1,.14,1,.43,0,.29,.86,.86,.86,.14,.75)
x2 <- rep(paste("airport",1:8,sep=""),5)
x1 <- rep(paste("treatment",1:5,sep=""),rep(8,5))
mydata <- data.frame(y=y,airport=x2,treatment=x1)
lmer(y~1+(1|airport)+(1|treatment),data=mydata)

However, the variance components as reported by lmer are different
from the ones in the slides. What formula should I use? thank you!




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