135
$\begingroup$

For a prediction interval in linear regression you still use $\hat{E}[Y|x] = \hat{\beta_0}+\hat{\beta}_{1}x$ to generate the interval. You also use this to generate a confidence interval of $E[Y|x_0]$. What's the difference between the two?

$\endgroup$
3
  • 17
    $\begingroup$ $\hat{E}[Y|x] = \hat{\beta_0}+\hat{\beta}_{1}x$ doesn't "generate the interval". $\endgroup$
    – Glen_b
    Commented Nov 21, 2015 at 7:47
  • $\begingroup$ I do not see a reason for the divergence between the two methods in any of the answers above. Regression results are typically estimated based upon parametric Student's t distribution parameters and typically regression, especially from poorly matched to the data regression models, lead to residuals that are not studentized, e.g., skewed but especially with heavy tails typically (if not always) making the parametric measures of data dispersion larger than their corresponding anticipated measured quantiles. A rule of thumb I have found useful: If I see residuals with outliers, long tails, and u $\endgroup$
    – Carl
    Commented Jan 22, 2017 at 23:56
  • $\begingroup$ Related : Obtaining a formula for prediction limits in a linear model. $\endgroup$
    – Scortchi
    Commented Jan 23, 2017 at 11:34

6 Answers 6

142
$\begingroup$

Your question isn't quite correct. A confidence interval gives a range for $\text{E}[y \mid x]$, as you say. A prediction interval gives a range for $y$ itself. Naturally, our best guess for $y$ is $\text{E}[y \mid x]$, so the intervals will both be centered around the same value, $x\hat{\beta}$.

As @Greg says, the standard errors are going to be different---we guess the expected value of $\text{E}[y \mid x]$ more precisely than we estimate $y$ itself. Estimating $y$ requires including the variance that comes from the true error term.

To illustrate the difference, imagine that we could get perfect estimates of our $\beta$ coefficients. Then, our estimate of $\text{E}[y \mid x]$ would be perfect. But we still wouldn't be sure what $y$ itself was because there is a true error term that we need to consider. Our confidence "interval" would just be a point because we estimate $\text{E}[y \mid x]$ exactly right, but our prediction interval would be wider because we take the true error term into account.

Hence, a prediction interval will be wider than a confidence interval.

$\endgroup$
1
  • 1
    $\begingroup$ I feel like this should make sense but when I read it.. it still doesn't. $\endgroup$ Commented Oct 14, 2023 at 2:44
106
$\begingroup$

One is a prediction of a future observation, and the other is a predicted mean response. I will give a more detailed answer to hopefully explain the difference and where it comes from, as well as how this difference manifests itself in wider intervals for prediction than for confidence.

This example might illustrate the difference between confidence and prediction intervals: suppose we have a regression model that predicts the price of houses based on number of bedrooms, size, etc. There are two kinds of predictions we can make for a given $x_0$:

  1. We can predict the price for a specific new house that comes on the market with characteristics $x_0$ ("what is the predicted price for this house $x_0$?"). Its true price will be $$y = x_0^T\beta+\epsilon$$. Since $E(\epsilon)=0$, the predicted price will be $$\hat{y} = x_0^T\hat{\beta}$$ In assessing the variance of this prediction, we need to include our uncertainty about $\hat{\beta}$, as well as our uncertainty about our prediction (the error of our prediction) and so must include the variance of $\epsilon$ (the error of our prediction). This is typically called a prediction of a future value.

  2. We can also predict the average price of a house with characteristics $x_0$ ("what would be the average price for a house with characteristics $x_0$?"). The point estimate is still $$\hat{y} = x_0^T\hat{\beta}$$, but now only the variance in $\hat{\beta}$ needs to be accounted for. This is typically called prediction of the mean response.

Most times, what we really want is the first case. We know that $$var(x_0^T\hat{\beta}) = x_0^T(X^TX)^{-1}x_0\sigma^2$$

This is the variance for our mean response (case 2). But, for a prediction of a future observation (case 1), recall that we need the variance of $x_0^T\hat{\beta} + \epsilon$; $\epsilon$ has variance $\sigma^2$ and is assumed to be independent of $\hat{\beta}$. Using some simple algebra, this results in the following confidence intervals:

  1. CI for a single future response for $x_0$: $$\hat{y}_0\pm t_{n-p}^{(\alpha/2)}\hat{\sigma}\sqrt{x_0^T(X^TX)^{-1}x_0 + 1}$$

  2. CI for the mean response given $x_0$: $$\hat{y}_0\pm t_{n-p}^{(\alpha/2)}\hat{\sigma}\sqrt{x_0^T(X^TX)^{-1}x_0}$$

Where $t_{n-p}^{\alpha/2}$ is a t-statistic with $n-p$ degrees of freedom at the $\alpha/2$ quantile.

Hopefully this makes it a bit clearer why the prediction interval is always wider, and what the underlying difference between the two intervals is. This example was adapted from Faraway, Linear Models with R, Sec. 4.1.

$\endgroup$
13
  • 12
    $\begingroup$ It is nice to see an old thread considerably improved by a clear and thoughtful response. Welcome to our site! $\endgroup$
    – whuber
    Commented Apr 1, 2017 at 16:17
  • $\begingroup$ Shouldn't this be ...x0 + 1/n +1 (for the prediction interval (1)), and ...x0 + 1/n (for the confidence interval (2)_ www2.stat.duke.edu/~tjl13/s101/slides/unit6lec3H.pdf real-statistics.com/regression/… $\endgroup$
    – user48956
    Commented Nov 17, 2017 at 22:17
  • $\begingroup$ @jpgard Is the formal difference hence just the result of E(eps) = 0? $\endgroup$
    – Pugl
    Commented Apr 25, 2020 at 1:09
  • 2
    $\begingroup$ If I am understanding your question @Pugl, the formal difference here is that epsilon is only associated with a prediction for an individual observation, not with prediction of the mean response. $\endgroup$
    – jpgard
    Commented Apr 27, 2020 at 4:44
  • 1
    $\begingroup$ 𝜖 is the residual. $\endgroup$
    – jpgard
    Commented Jul 12, 2020 at 22:49
64
$\begingroup$

The difference between a prediction interval and a confidence interval is the standard error.

The standard error for a confidence interval on the mean takes into account the uncertainty due to sampling. The line you computed from your sample will be different from the line that would have been computed if you had the entire population, the standard error takes this uncertainty into account.

The standard error for a prediction interval on an individual observation takes into account the uncertainty due to sampling like above, but also takes into account the variability of the individuals around the predicted mean. The standard error for the prediction interval will be wider than for the confidence interval and hence the prediction interval will be wider than the confidence interval.

$\endgroup$
60
$\begingroup$

I found the following explanation helpful:

Confidence intervals tell you about how well you have determined the mean. Assume that the data really are randomly sampled from a Gaussian distribution. If you do this many times, and calculate a confidence interval of the mean from each sample, you'd expect about 95 % of those intervals to include the true value of the population mean. The key point is that the confidence interval tells you about the likely location of the true population parameter.

Prediction intervals tell you where you can expect to see the next data point sampled. Assume that the data really are randomly sampled from a Gaussian distribution. Collect a sample of data and calculate a prediction interval. Then sample one more value from the population. If you do this many times, you'd expect that next value to lie within that prediction interval in 95% of the samples.The key point is that the prediction interval tells you about the distribution of values, not the uncertainty in determining the population mean.

Prediction intervals must account for both the uncertainty in knowing the value of the population mean, plus data scatter. So a prediction interval is always wider than a confidence interval.

Source: http://www.graphpad.com/support/faqid/1506/

$\endgroup$
3
  • $\begingroup$ What the heck is meant by "data scatter" here? $\endgroup$
    – tel
    Commented Jun 5, 2017 at 21:56
  • 8
    $\begingroup$ @tel: Obviously the variance $\endgroup$
    – vonjd
    Commented Jun 6, 2017 at 6:50
  • $\begingroup$ So, when does the prediction interval converge to the narrower confidence interval? When there is no noise in the data (perfect correlation)? $\endgroup$ Commented Oct 22, 2020 at 23:19
16
$\begingroup$

Short answer:

A prediction interval is an interval associated with a random variable yet to be observed (forecasting).

A confidence interval is an interval associated with a parameter and is a frequentist concept.

Check full answer here from Rob Hyndman, the creator of forecast package in R.

$\endgroup$
1
  • $\begingroup$ Thanks for the link from Hyndman's page! $\endgroup$
    – ahron
    Commented Aug 21 at 11:58
16
$\begingroup$

This answer is for those readers who could not fully understand the previous answers. Let's discuss a specific example. Suppose you try to predict the people's weight from their height, sex (male, female) and diet (standard, low carb, vegetarian). Currently, there are more than 8 billion people on Earth. Of course, you can find many thousands of people having the same height and other two parameters but different weight. Their weights differ wildly because some of them have obesity and others may suffer from starvation. Most of those people will be somewhere in the middle.

One task is to predict the average weight of all the people having the same values of all three explanatory variables. Here we use the confidence interval. Another problem is to forecast the weight of some specific person. And we don't know the living circumstances of that individual. Here the prediction interval must be used. It is centered around the same point, but it must be much wider than the confidence interval.

$\endgroup$
4
  • $\begingroup$ Thanks for the good example. So in your example for the first case, we have an uncertainty because we still only have a sample out of the entire population, so is the uncertainty we have here between the estimated mean and the true mean of the population? While in the second case, we have sampling variance as well as the residual error? $\endgroup$
    – Pugl
    Commented Apr 25, 2020 at 1:08
  • $\begingroup$ I'm not sure about your second case. Which interval to use, depends on the goal. $\endgroup$ Commented Apr 25, 2020 at 18:34
  • 3
    $\begingroup$ In short. Confidence Interval - A range for the expected AVERAGE Prediction Interval - A range for a SINGLE DATA POINT $\endgroup$ Commented Feb 6, 2021 at 21:18
  • 1
    $\begingroup$ Don't you think you can explain both with just the first example: confidence interval is the interval for true mean to lie within; whilst prediction interval is for all possible outcomes? Which is obviously wider. $\endgroup$ Commented Aug 30, 2021 at 18:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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