[R-sig-ME] generalized linear mixed-effects model and lmer, lme
qwu5 at yahoo.com
Sat Aug 30 04:50:15 CEST 2008
I am the new R user and just start last Friday. I am fitting the generalized linear mixed-effects model and going to use "glmer" function. I don’t understand the following two examples in the glmer function documentation:
Example 1: lmer(Reaction ~ Days + (Days | Subject), sleepstudy))
Example 2: lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy))
In example 1, i can write the model as:
reaction = a_0 + a_1*days + b_0 + b1*days.
The fixed effecta are a_0 + a_1*days, the random effects are b_0 + b1*days.
How can you explain example 2? Can I write the model as:
reaction = a_0 + a_1*days + b_0 + c1*days.
these two have the same fixed effect. What is the random effects in example 2? Is it b_0 + c1*days? Or one random effect is b_0 and another one is c1*days? If I use "lme" function, how can I write it in the “random” argument.
Their results are totally different.
Another question, I tried the function “lme”. I think it should have the same result with the function "lmer". But it didn’t.
I tried the following models:
lme(distance ~ age + Sex, data = Orthodont, random = ~ age+Sex)
They have the almost same results except “Corr” in the random effects.
I don’t know how the two functions work in the R. I checked the functions in the package. We can not look them. Does anybody know there are some other places so that I can look the source code and then I know how they work.
Any help would be appreciated.
More information about the R-sig-mixed-models