Confidence and prediction intervals for forecasted values

The 95% confidence interval for the forecasted values ŷ of x is

Confidence interval regression


This means that there is a 95% probability that the true linear regression line of the population will lie within the confidence interval of the regression line calculated from the sample data.

 Confidence prediction interval

Figure 1 – Confidence vs. prediction intervals

In the graph on the left of Figure 1, a linear regression line is calculated to fit the sample data points. The confidence interval consists of the space between the two curves (dotted lines). Thus there is a 95% probability that the true best-fit line for the population lies within the confidence interval (e.g. any of the lines in the figure on the right above).

There is also a concept called prediction interval. Here we look at any specific value of x, x0, and find an interval around the predicted value ŷ0 for x0 such that there is a 95% probability that the real value of y (in the population) corresponding to x0 is within this interval (see the graph on the right side of Figure 1).

The 95% prediction interval of the forecasted value ŷ0 for x0 is

Prediction interval regression

where the standard error of the prediction is

Standard error prediction

For any specific value x0 the prediction interval is more meaningful than the confidence interval.

Example 1: Find the 95% confidence and prediction intervals for the forecasted life expectancy for men who smoke 20 cigarettes in Example 1 of Method of Least Squares.

Confidence prediction intervals Excel

Figure 2 – Confidence and prediction intervals for data in Example 1

Figure 2 – Confidence and prediction intervals for data in Example 1

Referring to Figure 2, we see that the forecasted value for 20 cigarettes is given by FORECAST(20,B4:B18,A4:A18) = 73.16. The confidence interval, calculated using the standard error 2.06 (found in cell E12), is (68.70, 77.61).

The prediction interval is calculated in a similar way using the prediction standard error of 8.24 (found in cell J12). Thus life expectancy of men who smoke 20 cigarettes is in the interval (55.36, 90.95) with 95% probability.

Example 2: Test whether the y-intercept is 0.

We use the same approach as that used in Example 1 to find the confidence interval of ŷ when x = 0 (this is the y-intercept). The result is given in column M of Figure 2. Here the standard error is


And so the confidence interval is


Since 0 is not in this interval, the null hypothesis that the y-intercept is zero is rejected.

9 Responses to Confidence and prediction intervals for forecasted values

  1. Joaquin says:

    Dr. Zaiontz,
    Very neat and concise example. I’m particularly interested in a one sided C.I. (lower bound)
    Would you agree to use
    \hat{y} – t_{crit} s.e.

    where t_{crit} should be calculated in Excel using =TINV(2*\alpha,df),
    where \alpha = 1-p?



  2. Kristian Pedersen says:


    Whats the formula in J12? Cannot get the same results…



    • Charles says:

      Hi Kristian,
      J12 contains the same value as cell E9. The formula in E9 is =FORECAST(E8,B4:B18,A4:A18).

      • Kristian Pedersen says:

        Hi Charles,

        I’m refering to J12, not J11 :-) J12 contains the formula for se (prediction standard error) and formula result i 8.236857, which I cannot get by using the exact same numbers you do.

        What formula is in cell J12??

        I think it is in the (x – x_)^2 that something is wrong!


  3. Kristian Pedersen says:

    Hi Charles,

    Great. Thank u.


  4. Anu says:

    Please help how u got value of SSx which I suppose to be:-271.6

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>