Logo OR.org

Topics

← Back to Econometrics

Moving Average

The Moving Average (MA) model is a time series forecasting method that models the output variable as a linear combination of past forecast errors.

Definition


The Moving Average model of order qq is denoted as MA(q) and is defined as:

Xt=μ+ϵt+θ1ϵt1+θ2ϵt2++θqϵtqX_t = \mu + \epsilon_t + \theta_1 \epsilon_{t-1} + \theta_2 \epsilon_{t-2} + \cdots + \theta_q \epsilon_{t-q}

Where:

  • XtX_t is the actual value at time tt
  • μ\mu is the mean of the series
  • ϵt\epsilon_t is the white noise/error term at time tt
  • θ1,θ2,...,θq\theta_1, \theta_2, ..., \theta_q are the model parameters

Key Characteristics

  • The MA model depends only on past error terms, not past actual values.
  • It is most useful when a time series shows short-term shocks or randomness.
  • The autocorrelation function (ACF) of an MA(q) model will cut off after lag qq.

Example: MA(1)

For a simple Moving Average model of order 1:

Xt=μ+ϵt+θ1ϵt1X_t = \mu + \epsilon_t + \theta_1 \epsilon_{t-1}

This implies the current value depends on the current error and the previous error term.

When to Use

  • When residuals (errors) from an AR model still show autocorrelation.
  • When the ACF plot shows a sharp cutoff but PACF tails off.

Visualization

You can visualize MA processes by plotting synthetic time series data or fitting a model using tools like statsmodels in Python.

from statsmodels.tsa.arima_process import ArmaProcess
import matplotlib.pyplot as plt

# Define an MA(1) process
ma = ArmaProcess(ma=[1, 0.7])  # MA(1) with theta1=0.7
simulated_data = ma.generate_sample(nsample=100)

plt.plot(simulated_data)
plt.title("Simulated MA(1) Process")
plt.xlabel("Time")
plt.ylabel("Value")
plt.grid()
plt.show()