[R-sig-ME] Standard errors for fixed effects predicted scores
zlistserv at gmail.com
zlistserv at gmail.com
Wed Sep 21 23:09:52 CEST 2011
I would appreciate any advice you might provide about computing standard errors for predicted scores based on the fixed effects in a mixed model.
It's relatively easy to compute predicted fixed effects for a growth model, e.g.,
mod = lmer(CVLtca ~ (Age+AgeSq)*Sex + (Age|ID), data=cvl, na.action=na.omit)
b = fixef(mod)
pAge = seq(50, 90)
xAge = pAge - 65
xAgeSq = xAge**2
#***Evaluate equation for men (Sex=1) and women (Sex=0)
pW = b[1] + b[2]*xAge + b[3]*xAgeSq
pM = b[1] + b[2]*xAge + b[3]*xAgeSq + b[4] + b[5]*xAge + b[6]*xAgeSq
#***Plot the predicted scores...
par(las=1)
plot(pAge, pM, type="l", col="blue", ylim=c(25,65), ylab="Predicted CVLtca", xlab="Age")
lines(pAge, pW, lty=1, col="red")
legend(50, 40, c("Men","Women"), lty=c(1,1), col=c("blue","red"))
I would like to create the plot with a confidence interval surrounding each predicted line. How do I compute the standard errors so I can calculate the confidence interval?
More information about the R-sig-mixed-models
mailing list