Hi Thomas,
"random=~1" works if your data frame is in "groupedData" format, check this:
# Orthodont is in groupedData format fm1 <- lme(distance~age+Sex, data=Orthodont, random=~1) ##### dat <- as.data.frame(Orthodont) fm2.1 <- lme(distance~age+Sex, data=dat, random=~1)
`dat' is an ordinary data.frame and thus random=~1 doesn't work. But this works:
fm2.2 <- lme(distance~age+Sex, data=dat, random=~1|Subject) # you declare the grouping factor
I hope it helps.
Best, Dimitris
Thank you very much, now I see, why the Orthodont example works. There is however an important difference. In the example the random effects structure is not only ~1 but in reality ~1|Subject, which is inherited from the groupedData object. So
ranef(fm1)
yields 27 intercepts, but what I want is only one single intercept.
Thomas
______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html