[R] confidence interval in "predict.lm"

Thomas Lumley tlumley at u.washington.edu
Fri Nov 15 19:17:33 CET 2002

On Fri, 15 Nov 2002, Fred Mellender wrote:

> I am studying statistics using R and a book "Understandable Statistics", by
> Brase and Brase.  The book has two
> worked examples for calculating a confidence interval around a predicted
> value from a linear model.


> The book gives the confidence interval as 26.5 <= y <= 39.5.  The book
> defines the confidence interval calculation thus:
>   yp - E <= y <= yp + E
>   Where
>    E = tc*sC *sqrt(1 + 1/n + (x-xBar)^2/SSx)

You asked R for a confidence interval for the predicted mean at x.  If you
want a prediction interval at x you need  interval="prediction" not


r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list