[R] prediction intervals from a mixed-effects models?

Dieter Menne dieter.menne at menne-biomed.de
Sun Apr 13 19:41:24 CEST 2008


Spencer Graves <spencer.graves <at> pdf.com> writes:

> 
>       How can I get prediction intervals from a mixed-effects model?  
> Consider the following example: 
> 
> library(nlme)
> fm3 <- lme(distance ~ age*Sex, data = Orthodont, random = ~ 1)
> df3.1 <- with(Orthodont, data.frame(age=seq(5, 20, 5),
>                     Subject=rep(Subject[1], 4),
>                     Sex=rep(Sex[1], 4)))
> predict(fm3, df3.1, interval='prediction')
> #      M01      M01      M01      M01
> # 22.69012 26.61199 30.53387 34.45574
> 
> # NOTE:  The 'interval' argument to the 'predict' function was ignored. 
> # It works works for an 'lm' object, but not an 'lme' object. 
> 

In theory, ci from gmodels should work

library(gmodels)
ci(df3.1)


However, I get an error message. I will forward this to Greg to let him check if
I did something stupid.

Dieter



More information about the R-help mailing list