[R] predictive interval in nlme

Cunningham Kerry kerryrekky at yahoo.com
Tue Oct 18 19:45:50 CEST 2005


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!




More information about the R-help mailing list