AR / MA / ARMA / ARIMA — The Box-Jenkins family
This is the classic family of univariate time-series models that describe and forecast a series from its own past:
- AR(p) — Autoregressive: depends on its own lagged values.
- MA(q) — Moving Average: depends on lagged errors (shocks).
- ARMA(p,q) — combines AR and MA for stationary series.
- ARIMA(p,d,q) — adds differencing of order to handle non-stationary series.
When to use
Model specification
ARMA(p,q):
ARIMA(p,d,q): apply ARMA(p,q) to the -times differenced series .
Box-Jenkins workflow
Running in EcoLab
- Modeling module → Univariate time series family → ARIMA.
- Choose the series ; declare or use auto-ARIMA (AIC/BIC).
- Run; view residual diagnostics + forecasts with confidence intervals; export the replication code.
Replication code
- Stata
- R
- Python
* --- ARIMA(1,1,1) ---
* Declare time variable
tsset time
* Estimate ARIMA(1,1,1) by MLE
arima gdp_growth, arima(1,1,1)
* Post-estimation diagnostics
predict resid, residuals
corrgram resid, lags(20)
* Forecast
tsappend, add(12)
predict yhat, dynamic(.)
# --- ARIMA ---
library(forecast)
# Convert to time series object
ts_data <- ts(df$gdp_growth, start = c(1990, 1), frequency = 4)
# Auto-select (p,d,q) by AIC
fit <- auto.arima(ts_data)
summary(fit)
# Residual diagnostics
checkresiduals(fit)
# Forecast 12 periods ahead
fc <- forecast(fit, h = 12)
plot(fc)
from statsmodels.tsa.arima.model import ARIMA
import matplotlib.pyplot as plt
# Estimate ARIMA(1,1,1)
model = ARIMA(df['gdp_growth'], order=(1, 1, 1))
result = model.fit()
print(result.summary())
# Residual diagnostics
result.plot_diagnostics(figsize=(10, 6))
plt.tight_layout(); plt.show()
# Forecast 12 periods
forecast = result.get_forecast(steps=12)
print(forecast.summary_frame())
Limitations
- Assumes a linear relationship and stable structure; weak under structural breaks.
- Does not model time-varying variance ⇒ use ARCH/GARCH.