2
$\begingroup$

I have done linear regression and plotted the data, the regression line and also the confidence interval (for 95% confidence). However it seems that most of the data points fall outside the confidence interval. So how am I supposed to interpret the confidence interval. It cannot be I am 95% confident that the data point will be this close to the regression line since a lot more than 5% of the data points do not fall in that area. So what does it mean then?

$\endgroup$
8
  • $\begingroup$ What do you mean exactly with confidence interval? A ci is usually calculated for estimates. In your case these are the beta coefficients which describe the effect of your expl. variables on your dependent variable. $\endgroup$ – user26594 Sep 18 '13 at 18:44
  • $\begingroup$ I am using the code here students.ncl.ac.uk/tom.holderness/software/pythonlinearfit I guess I'm just asking how I interpret the confidence intervals in the plot $\endgroup$ – user1893354 Sep 18 '13 at 18:50
  • 2
    $\begingroup$ Can you clarify what you mean by confidence interval. It sounds to me like you have a confidence interval for the fitted model (the regression line), which would not include on average 95% of the observations or anything close to that value. There is a prediction interval for the OLS model which may be what you were expecting? $\endgroup$ – Gavin Simpson Sep 18 '13 at 19:07
  • $\begingroup$ The calculation used to get the confidence interval is in the link from my previous comment. I'm just looking for an intuitive interpretation. $\endgroup$ – user1893354 Sep 18 '13 at 19:15
  • 1
    $\begingroup$ possible duplicate of Clarification on interpreting confidence intervals? $\endgroup$ – Momo Sep 18 '13 at 19:28
13
$\begingroup$

There are two 95% CI you can derive from your data. One is the 95% CI of the regression line, which is the red one in the attached illustration. The code you provided is intended for plotting this 95% CI. Now, because it's for the line, not for the data points, as you get more data, the precision improves, and the band will narrow down. Your cited code is a somewhat special case because the sample size is only 7, so the 95% CI of the line happened to include about 90% of the data points; it's just a coincidence.

enter image description here

The interval that approximately includes 95% of the data points is shown below in green. I am not sure what it is called, but generally from what I have collected on this site, it should not be called confidence interval. I think you're looking to get these kind of lines, but have been using the incorrect code.

The one that matters more often is the red one. And for proper interpretation, other users have provided links to some useful posts.

enter image description here

$\endgroup$
10
  • $\begingroup$ OK so the interpretation is that you can be 95% confident that the regression line is within that interval for those data points. Thanks $\endgroup$ – user1893354 Sep 18 '13 at 19:35
  • 2
    $\begingroup$ OP no, you cannot. The interpretation of a CI is subtle, follow the links above. @Penguin_Knight the second part of your answer is usually called the prediction interval and should not be called a CI. See robjhyndman.com/hyndsight/intervals $\endgroup$ – Momo Sep 18 '13 at 19:40
  • 2
    $\begingroup$ What are the green lines exactly? If they are intended to include 95% (or whatever) of the distribution, then they are not a confidence interval: they would be a tolerance interval. If they are intended to include a specified number of future (independent) points, they would be a form of prediction interval; and if they must include a given number of the data points, they must be related to empirical quantiles of the residuals. It is, however, unusual for any of these (except the last, perhaps) to consist of lines that are parallel either to the fit or to each other. $\endgroup$ – whuber Sep 18 '13 at 19:41
  • 1
    $\begingroup$ @whuber It's one of the default functions in SPSS graphical editor, called "Confidence Interval for individuals." My guess is that it's the 2.5th and 97.5th percentile of the residual. $\endgroup$ – Penguin_Knight Sep 18 '13 at 19:47
  • 1
    $\begingroup$ I would have thought "confidence interval for individuals" would be a prediction interval ... but I am pretty sure it isn't that, because a PI 'spreads out in the tails' like a CI does (but relatively less so), while in that picture the green lines seem perfectly straight (I copied the picture and laid a straight line over them and couldn't see any deviation from linearity at all, but I guess it's possible there's just such small a deviation that it's not discernable). $\endgroup$ – Glen_b Sep 19 '13 at 1:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.