I am working on a time series model with exogenous regressors. I am using the ARIMA function in R which resulted in a ARIMA(1,0,2) model. I also need to forecast for the next 10 months using this model. I am using the R forecast package predict function for the same:

Forecast<- predict(model, newxreg = newxreg)

Since the model has a MA term and I am trying to forecast 10 months ahead of time, I do not have the information for the MA terms in future since I don't know the actuals. So how is the package providing the forecast results?

Can someone please help me understand how forecast package (predict function) in R is estimating the future residual terms and providing the forecasts??

  • 1
    $\begingroup$ This has been flagged as OT, likely for its mention of R, but I gather that your interest is in how an ARIMA model (in R or any other tech) forecasts without actuals. Am I correct? (Voting leave open.) $\endgroup$ Jan 11, 2017 at 15:32
  • $\begingroup$ That is right. My model has both AR and MA terms. for the AR term, its straight forward since we can take the Y-estimated of the earlier period during forecasts. But as for the MA terms, how to I calculate each period's error when Y-actual is not known for the future. The R-package already provides a forecast series, but I am not sure how it is deriving it. $\endgroup$ Jan 11, 2017 at 15:50

2 Answers 2


In MA(q) the errors are treated like any other time series. Once you have fit your AR(1) model you have a time series of errors $\epsilon_{t}$, $\epsilon_{t-1}$, $\epsilon_{t-2}$...$\epsilon_{t-i}$. Parameters are selected for $\theta$ that best fit this time series of errors.

Your MA(q) equation is: $\epsilon_{t+j}$ = β$_{0}$ +$\theta_{1}$ε$_{t+j-1}$+ ...+ $\theta_{q}$ε$_{t+j-q}$

Once $\theta$ is know then you can use the above equation to estimate future values of $\epsilon$. Each predicted value of $\epsilon$ for example the predicted value $\epsilon_{t+1}$ becomes the input for the next estimate $\epsilon_{t+2}$. It's similar to estimating future values of $Y$ using AR, the estimated value of $Y_{t+i}$ then becomes the input for estimating $Y_{t+i+1}$.

  • $\begingroup$ Thank you for your response. I tried estimating the error coefficients by fitting another ARIMA model on the residual series this time. Unfortunately, the ARIMA function is giving AR(0,0,0) with no means. I also looked at the ACF and PACF of the series and that gives the same result. I tried force fitting an AR(1,0,0) model on the residuals and then forecast using the equation. But it doesnt match the results from the package. ANy inputs will be highly appreciated. $\endgroup$ Jan 11, 2017 at 15:43
  • $\begingroup$ The R documentation specifies that the future MA terms are estimated using Kalman Filter. Can some one help me understand how that works? $\endgroup$ Jan 11, 2017 at 16:42
  • $\begingroup$ Unfortunately? You assumed that the error terms are white noise and you found that the residuals were as well. You would have a problem if you found anything else! $\endgroup$
    – Chris Haug
    Jan 11, 2017 at 20:28

Here is a simpler example that I hope should clear things up.

Consider an MA(1) model:

$y_{t+1} = \theta \varepsilon_{t} + \varepsilon_{t+1}$

The forecast, one period ahead from $t$, is the conditional expectation:

$\hat{y}_{t+1} = E\left(y_{t+1}\mid y_1,...,y_t\right) = E\left(\theta \varepsilon_t + \varepsilon_{t+1}\mid y_1,...,y_t\right) = \theta \varepsilon_t + 0 = \theta \varepsilon_t$

Now, the forecast two periods ahead is computed similarly:

$\hat{y}_{t+2} = E\left(y_{t+2}\mid y_1,...,y_t\right) = E\left(\theta \varepsilon_{t+1} + \varepsilon_{t+2}\mid y_1,...,y_t\right) = 0 + 0 = 0$

The forecast more than two periods ahead is also identically zero. Whatever package you are using is essentially just doing this conditional expectation computation, given whatever parameter estimates you have, and an estimate of $\varepsilon_t$, which is derived routinely while estimating the model.


Your Answer

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

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