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 is denoted as MA(q) and is defined as:
Where:
- is the actual value at time
- is the mean of the series
- is the white noise/error term at time
- 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 .
Example: MA(1)
For a simple Moving Average model of order 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()