I have to calculate different confidence intervals, and I found out that in R I can do this with the prediction command. But I have problems understanding what I should actually do. I have to calculate 3 different confidence intervals: 1) for a point on the regression line 2) for the predicted (future) value of y 3) for the entire regression line. Good thing I have done so far:
fm <- lm(alcohol~beers)
So, to get the confidence interval for the entire regression line, I would try: predict(fm,data.frame(beers = newbeers), level = 0.9, interval = "confidence") But I really don't know what data.frame does. Well, I know that the confidence interval keeps the actual value in 90% of cases (here, because 0.9). Does this now mean that it has the best regression line of 90%? I cannot understand the meaning for anything but a point and a predicted value. Also, I only know this way to calculate it, so how can I calculate it in two other ways? Also, the output I get gives a few upper and lower values ββfor the interval. What does it mean?
lisa source share