# How does a moving average model for forecast work?

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?

• 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. Nov 7 '14 at 0:43
• 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!