Lesson 5 of 15

MA(q) Model

Moving Average MA(q) Model

A Moving Average model of order q expresses each value as a linear combination of current and past error terms:

y[t] = ε[t] + θ₁·ε[t-1] + θ₂·ε[t-2] + ... + θq·ε[t-q]

where ε[t] is white noise (the error at time t) and θ are the MA coefficients.

MA models are always stationary. The ACF of an MA(q) process cuts off after lag q — a key diagnostic.

One-step Forecast

The one-step ahead forecast for MA(q) uses past errors only (the future error is zero by expectation):

ŷ[t+1] = θ₁·ε[t] + θ₂·ε[t-1] + ... + θq·ε[t-q+1]

Task

Implement:

  • ma_simulate(errors, theta) — produce the MA(q) series given errors and coefficients
  • ma_forecast(errors, theta) — one-step forecast using past errors
Python runtime loading...
Loading...
Click "Run" to execute your code.