I have a time series (let's say $X_1$ to $X_n$), and I need to predict the next sample (let say $X_{n+1}, X_{n+2},\dots, X_{n+k}$) using model such as neural network, or multiple linear regression. At time n, I have all the sample from $X_1$ to $X_n$, and need to predict $X_{n+1}$; at time $n+1$, I have all the sample from $X_1$ to $X_{n+1}$, and need to predict $X_{n+2}$; and so on.

Let say I have predicted values $Y_{n+1}, Y_{n+2},\dots, Y_{n+k}$ by using a model. How can I calculate a confidence interval for those predicted values?

I would appreciate if anyone can help me in this issue. (So far I read the formula for computing confidence interval for mean of a sample, but I didn't see anything about how to calculate the confidence interval for the predicted value of a time series).

  • 3
    You mean "prediction interval" not "confidence interval". The latter is for a parameter. – Rob Hyndman Mar 22 '12 at 22:32
  • Thanks Rob. Actually I want to find the the confidence interval not the prediction interval, to have an idea about the uncertainty in my prediction. I want to have a range around the predicted value where there is a given probability or confidence degree (let's say 95%) of finding the real value. – Mashud Mar 30 '12 at 3:44
  • 1
    What you have described is precisely a prediction interval. A confidence interval is a statement about a parameter. You want a range around a future observation. – Rob Hyndman Mar 30 '12 at 5:43
  • Thanks Rob. Yes, I was wrong in my understanding. This is actually prediction interval. I am sorry for that. I would appreciate if you please let me know few reference of how to calculate the prediction interval of the future observations produced by Neural Network/Multiple Regression Method. – Mashud Apr 2 '12 at 8:11

In R (http://www.r-project.org/) there's a package called "forecast" where you can run for example ETS or ARIMA models to do forecast on time series. This package will automatically also create you different prediction intervals for the forecasted values.

  • 2
    Thanks for your answer. However, I would highly appreciate if you please let me know any reference how to calculate the confidence interval (the concepts/formula) for time series prediction. – Mashud Mar 30 '12 at 3:48
  • @Mashud Please use comments. – mbq Mar 30 '12 at 9:54

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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