Lesson 8 of 15

ARIMA Forecast

ARIMA(p,d,q) Forecast

ARIMA (AutoRegressive Integrated Moving Average) extends ARMA to handle non-stationary series by differencing d times before applying ARMA.

The workflow:

  1. Difference the series d times → get a stationary differenced series
  2. Forecast the differenced series using AR(p) (for simplicity, assuming zero noise and no MA term in future steps)
  3. Undifference the forecasts back to the original scale

Forecasting Steps

Given series xs, parameters p, d, q, AR coefficients phi, and steps ahead n_ahead:

  1. Compute dxs = difference(xs, d)
  2. For each future step, forecast next differenced value: ŷ_diff = Σ φⱼ · dxs[-(j+1)]
  3. Append forecast to dxs (iterating forward)
  4. Undifference: last = xs[-1], then last += fd for each forecasted difference

Task

Implement arima_forecast(xs, p, d, q, phi, theta, n_ahead) that returns a list of n_ahead forecasted values.

Python runtime loading...
Loading...
Click "Run" to execute your code.