[R] Question about lme (mixed effects regression)

Dimitri Liakhovitski dimitri.liakhovitski at gmail.com
Mon Oct 18 23:15:52 CEST 2010


Hello!

If I run this example:

library(nlme)
fm1 <- lme(distance ~ age+Sex, Orthodont, random = ~ age + Sex| Subject)
If I run:
summary(fm1)
then I can see the fixed effects for age and sex (17.7 for intercept,
0.66 for age, and -1.66 for SexFemale)

If I run:
ranef(fm1)
Then it looks like it's producing the random effects for each subgroup
(in this example - each subject). For example, for MO1 it's:
1.25 for intercept, 0.106 for age, and -1.52 for SexFemale.

So, in order to get the the total effects, i.e., the regression
equation, for each subgroup (Subject) I need to do this:
For example, for Subject MO1:
y(M01) = (17.71+1.25)+(0.66+0.106)*Age+(-1.66-1.52)*SexFemale = 18.96
+ 0.766*Age -3.18*SexFemale

Question: Is there an easier way to get such an equation for each
level of Subject?

Thank you very much!

-- 
Dimitri Liakhovitski
Ninah Consulting
www.ninah.com



More information about the R-help mailing list