Fränzi Korner
2007-Jun-04 08:40 UTC
[R] Standard errors of the predicted values from a lme (or lmer)
Dear Dieter, sorry for not being more specific. I would like to use R to get a prediction (with standard error) of the response in a mixed model at selected values of the fixed-effects factors. Hence, in a mixed model, say, for response body size with, say, fixed factors sex and age, I would like to get a prediction of size for each sex and at selected ages such as 5, 10, 15; and I want a SE for that prediction as well. This can be produced in the GenStat package using the VPREDICT directive or for lme-objects by predict(lmeresult, newdata, se=TRUE), but I have not found out so far how predictions for the response under a mixed model in R can be obtained. Thanks for all, kind regards --
Dieter Menne
2007-Jun-04 12:34 UTC
[R] Standard errors of the predicted values from a lme (or lmer)
Fr?nzi Korner <fraenzi.korner <at> oikostat.ch> writes:> sorry for not being more specific. I would like to use R to get a prediction > (with standard error) of the response in a mixed model at selected values of > the fixed-effects factors. Hence, in a mixed model, say, for response body > size with, say, fixed factors sex and age, I would like to get a prediction > of size for each sex and at selected ages such as 5, 10, 15; and I want a SE > for that prediction as well..... In that case, estimable in gmodels (by Greg Warnes, as also suggested by Michael Kubovy) and glht in Thorsten Hothorn's multcomp are best. The first works for lme out of the box, the very powerful glht can handle lmer(lme4), with strong support for multiple testing. Too bad the latter does not immediately work with lme, but it can be tweaked. In both cases, you have to construct the contrast matrix, which can be error-prone for complex models. To my knowledge (??), there is no simple-to-handle package that generates this matrix with an intuitive interface. Dieter