Skip to content
Prev 59776 / 398502 Next

confidence interval of a average...

It depends on whether you want to do 95% ocnfidence intervals on the
predicition or the mean vital capacity.  Try the following and see if it
gets you started:
#Simulate data
height=48:72
vc=height*10+20*rnorm(72-48+1)
# Do regression
lm.vc=lm(vc~height)

# Confidence interval on mean vc
predict.lm(lm.vc,interval="confidence")
#confidence interval on prediced vc
predict.lm(lm.vc,interval="prediction")

#plot everything
plot(vc~height)

matlines(height,predict.lm(lm.vc,interval="c"), lty=c(1,2,2),col='blue')
matlines(height,predict.lm(lm.vc,interval="p"),lty=c(1,3,3),col=c('black','r
ed','red'))> Rob
the