0

I have a problem with understanding how to plot 95% confidence bands for x and y values. The values are below. Can anyone help me?

x<-c(7,9,9,12,14,16,16,14,16,16,17,19,21,24,15,16,17,25,27,15,15,15,16,19,18,17,18,20,22,25,24)
y<-c(25,25,25,27,27,27,24,30,30,31,30,31,30,28,32,32,32,32,34,34,34,35,35,34,35,36,37,38,40,39,43)

I've also done the following:

lm(x~y)
summary(lm(x~y))
plot(x~y)
abline(lm(x~y))
lm.velo <-lm(x~y)
fitted(lm.velo)
predict(lm.velo,int="c")
predict(lm.velo,int="p")

I am new to R and I don't quite understand everything yet. I was ask to find the 95% confidence bands for predicting mean y per value of x and 95% prediction bands for predicting individual y values. Please help me. Thank you.

thelatemail
  • 91,185
  • 12
  • 128
  • 188
  • EDi's answer [here](http://stackoverflow.com/a/14069837/496803) gives an example. Scroll down to "Here is a base solution". – thelatemail Nov 27 '13 at 02:40
  • 1
    One thing to note: if you need to predict mean(y) | x then you `fit <- lm(y~x)`, not the other way around as in your code above. – jlhoward Nov 27 '13 at 05:10

0 Answers0