Solved – How to calculate the confidence interval for time-series prediction

prediction intervaltime series

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).

Best Answer

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.