In the previous segment you studied about the simple regressive model. In this segment, we will look at another Auto Regressive model called the Moving Average.

The Moving Average Model models the future forecasts using past forecast errors in a regression-like model. This model has a **parameter ‘q’** called **window size** over which linear combination of errors are calculated.

**Example:**

Forecast daily ice cream sales for the next 5 days when on an average daily ice cream sale is 30.

**Explanation:**

On the first day you predicted the sale to be the average sale that is 30 but actual demand came to be around 27. There is an error of -3. For the next day, you predicted the sale of ice cream to be mean along with a percentage of error of previous day prediction. i.e., 30+0.5(-3) = 28.5. Similarly, you calculate the forecast for the rest of the days. The prediction of sales of ice cream is moving around the overall mean 30. For this reason, the model is called the moving average (MA) model. We can look at the following plot to confirm this.

Now, in order to build the moving average model, you need to determine the value of parameter ‘q’. Let’s follow the steps below to do that.

- Plot the Autocorrelation function (ACF)
- Select q as the highest lag beyond which autocorrelation dies down:

Here, for lag 1 and lag 2 the autocorrelation is above significance level. Select q=2 as it is the highest lag beyond which autocorrelation dies down.

- Build Moving Average model equations as:

Here, lag 1 and lag 2 have autocorrelation above the significance level. Therefore, in the moving average model, the errors with lag 1 and lag 2 are taken to predict the dependent variable ^yt

Now let us get back again to the airline passenger dataset to build the moving average model.

In this session, you have studied about two AR models, i.e. the simple Auto Regressive and the moving average model. In the sessions to come, you will learn about more nuanced and complex Auto Regressive models.