# [R] Confidence intervals for non-lm curve

From: Irene Mantzouni <ima_at_aqua.dtu.dk>
Date: Thu, 26 Jun 2008 15:47:46 +0200

Hi all!

I would like to estimate confidence intervals for a non lm model. For example, I use a mixed model of the form:

md=lme(y~x1+I(x1^2)+x2 ...)

Parameters x1+I(x1^2) are fixed effects and I would like to plot the predicted (partial) curve corresponding to these ones, along with 90% CI bands.

Thus, I simulate (partial) predictions:

```Lx=c()
Ux=c()
Mx=c()
```

z=c()
for (j in 1:length(x1)){
x=x1[j]
for(i in 1:2000){
s1 <- rnorm(1,.026,.027) # mean and sd estimated by lme for x1 s2 <- rnorm(1,-.01,.005) # mean and sd estimated by lme for I(x1^2) z[i] <- s1*x+s2*(x^2)
}
```Lx[j]=quantile(z,.05)
Ux[j]=quantile(z,.95)
Mx[j]=mean(z)
```

}

And then plot vectors Lx, Mx and Ux for lower, mean and upper curves, respectively.

Is this approach correct?

Any alternatives?

Thank you!!

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 Thu 26 Jun 2008 - 13:51:20 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 Thu 26 Jun 2008 - 14:31:04 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.