Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The upper and lower prediction intervals for the forecast periods are provided by the forecast() function. However, neither prediction or confidence intervals seem to be available for the fitted values within the range of the actual data. Why is this?

share|improve this question

The fitted values are one-step forecasts, so prediction intervals can be obtained by adding/subtracting a suitable multiple of the standard deviation of the residuals. E.g., assuming normal errors, an approximate 95% prediction interval is given by $\hat{y}_t\pm 1.96\hat{\sigma}$ where $\hat\sigma^2$ is the variance of the residuals.

Presumably you mean a confidence interval for the mean of the one-step forecast distributions. I'm not sure why you would want such a thing but you could obtain it by reformulating the model in state space form and using a Kalman filter.

You ask why the forecast() function does not provide these. Simply, because they are hardly ever useful.

share|improve this answer
Yes, it makes sense that you really only care about the precision of your forecast. I am accustomed to the intervals returned by predict.lm. Thanks for taking time to explain. – Scott Jan 3 '12 at 19:42

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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