Excuse me for the question,

I'm reading "Forecasting: principles and practice" by Rob J Hyndman.

I'm stuck on this chapter: https://www.otexts.org/fpp/8/4 which briefly explains how a moving average works.

the reason is that I haven't understood how the $e_{t-k}$ with $k \in [1,\ldots,q]$ (look at the formula at the link above) are computed.

I would like to apply a simple linear regression using least min squares on the errors between the forecasts and the real values, but I wasn't able to understand which is the value to assign to these errors. How can I act to obtain them?

Thanks in advance!

  • 1
    $\begingroup$ What tool do you use ? if you are comfortable with R I can demonstrate moving average process in ARIMA with a reproducible example by hand. $\endgroup$
    – forecaster
    Nov 7 '14 at 0:43
  • $\begingroup$ Yes, I'm using R, so I think it could help me... Is it possible to have an example of simply an AR(2) model? The main thing I want to understand is how to practically estimate the parameters of the AR(2) (or more generally any AR(q) ). Thank you very much! $\endgroup$
    – madx
    Nov 7 '14 at 10:33

The error terms for the MA part of an ARIMA model are usually produced as part of the estimation routine - and are equal to the difference between the observed value and the fitted value. That means

a) you can't use simple linear regression to estimate your model - the values of the error terms depend on the coefficients of your model - so you can't include the error terms in a regression to generate those coefficients.

b) if you are using a model generated on one set of data to get forecasts for another set of data - using a method comparable to the one-step forecasts that Professor Hyndman describes on his blog here is probably the easiest way to get those.

c) if you want to generate the values to understand the math of what is going on - it is usually pretty easy to set up things in a spreadsheet. Calculate your forecast for period one. Subtract the forecast from the real value for that period to generate the error for period one. Use that error for period one (along with other relevant data) to calculate the forecast for period two - and so on. If you set up your spreadsheet right - this can simply involve creating the appropriate formulas once, then copying them down a column to get your values.

In any case - it is probably better to think of comparing your forecasts to your predictions via something like the Mean Absolute Scaled Error, or some other technique that evaulates how close your model projections are to the actual values seen in the data. Doing a simple linear regression of the real values on the projections is not a great way of doing this - it gives you a comparison value, but not between your projection and the value, but a linear transformation of your function and the value. Certainly, if you do the linear regression, and you get an intercept coefficient that is not equal (or at least close) to zero - or a slope coefficient that is not equal (or at least close) to one, it is a sign of a substantial problem with your model, no matter how good the goodness of fit statistics are from the regression


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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