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

From: Gregory Warnes <gregory.warnes_at_mac.com>
Date: Sun, 13 Apr 2008 20:29:41 -0400

On Apr 13, 2008, at 1:41PM , Dieter Menne wrote:
> 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.

gmodels::ci() will give confidence intervals for the fixed effects via

        ci(fm3)

ci() won't generate prediction intervals for individual parameters, and according to

        ?predict.lme

it won't either.

-Greg

>
> Dieter
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 14 Apr 2008 - 01:31:04 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 16 Apr 2008 - 03:30:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive