This is a difficult problem. After several false starts with
RSiteSearch, I finally got 15 hits from 'RSiteSearch("predict lme with
confidence")', including the following 3 which looked to me like they
might help with your question:
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/27860.html
This outlines the mathematics required to do this conditional on the
variance components estimates, and includes a comment from Doug Bates
saying, "The new version of the lme4 package has a method for the
"vcov"
generic. This method returns" the "Sig" matrix required to do
this
computation.
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/42666.html
Suggests using estimable() from the gmodels part of the gregmisc package.
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/44675.html
This includes a comment by Doug Bates saying, 'That's not currently
implemented in lme. It's on the "To Do" list but it is not very
close to
the top.'
It also might be interesting and useful to check the accuracy of the
conditioning using Monte Carlo.
Spencer Graves
Cunningham Kerry wrote:
> Suppose I have the following data:
>
> y x id
> 44 0 104
> 48 58 104
> 48 55 204
> 47 105 204
> 41 275 206
> 18 67 209
> .......
>
> I fit the model
>
>
>>fit=lme(y~x+I(x^2),random=~1|id)
>
>
> Now I want to make a prediction plot:
>
>
>>time=seq(0,300,len=100)
>>plot(predict(fit,data.frame(x=time),level=0))
>
>
> Very fine. It gives me the prediction curve based on
> the model. My further request is to make a confidence
> bands around the curve. I guess I can derive its
> mathematical form analytically and implement it
> myself. But I just hope some experts can point out one
> simple way in R to avoid my redundant work.
>
> Thanks!
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
--
Spencer Graves, PhD
Senior Development Engineer
PDF Solutions, Inc.
333 West San Carlos Street Suite 700
San Jose, CA 95110, USA
spencer.graves at pdf.com
www.pdf.com <http://www.pdf.com>
Tel: 408-938-4420
Fax: 408-280-7915