Free lesson · Trading algorithms
ARIMA for conditional means and GARCH for conditional variance
Open interactive lessonPractice calculationsExplore labs
Start with the idea
Mean and volatility are different forecasting targets. ARIMA-family models describe linear dependence after a chosen differencing operation; GARCH-family models describe how uncertainty evolves after shocks.
Symbols, units & horizon
- r_t: observed return
- c,φ: AR(1) intercept and persistence, a simple ARIMA special case
- ε_t: return innovation after subtracting conditional mean
- h_t: conditional return variance
- ω: nonnegative variance intercept
- α,β: nonnegative shock and persistence coefficients
- h̄: stationary unconditional variance when α+β<1
When and why to use this
Use autoregressive models for interpretable mean benchmarks and GARCH for conditional risk forecasting, with separate evaluation criteria.
ARIMA(p,d,q) combines autoregressive lags, differencing and moving-average innovation terms. The moving-average term here refers to past forecast errors, not a simple price moving average. Select differencing carefully: over-differencing can add noise, while a unit root can invalidate a stationary-level model.
GARCH(1,1) uses the previous squared innovation and previous variance to forecast current variance. It is useful for risk scaling and option/risk-model inputs even when the conditional mean is close to zero. Asymmetric variants can model different responses to positive and negative shocks.
Check residual autocorrelation, conditional heteroskedasticity, distributional tails and parameter stability. A normal innovation assumption does not guarantee normal market returns. Compare against constant variance and EWMA; evaluate the risk forecast’s calibration and allocation effect rather than a direction-hit rate.
ARIMA for conditional means and GARCH for conditional variance
- An AR(1) next-mean forecast substitutes the latest available return into its fitted linear rule.
- For GARCH, take expectations in stationarity: E[h]=ω+αE[ε²]+βE[h]. Since E[ε²]=E[h], collect h̄(1−α−β)=ω.
- Divide by positive 1−α−β. This derivation requires a stationary second moment; it does not apply when the coefficient sum is at least one.
ω=.000001, α=.1, β=.8, squared innovation=.0004 and current variance=.0001 give next variance=.000121 and volatility .011. Long-run variance=.00001 under the stationary model.
Apply it in a strategy
- Specify the target and use training-only diagnostics to choose mean and variance structure.
- Compare forecasts with persistence, constant variance and EWMA on future windows.
- Test whether the risk estimate improves calibrated exposure and realised portfolio risk after costs.
Research deliverable
Produce separate mean-error and variance-calibration reports, documenting stationarity and tail assumptions.
Python implementation
Self-contained teaching example. Python 3.10+; dependencies and input conventions are shown in the code and notation. Run in your own Python environment.
def ar_garch(return_now,c,phi,omega,alpha,beta,innovation,variance):
if min(omega,alpha,beta,variance)<0 or alpha+beta>=1: raise ValueError("Stationary nonnegative GARCH inputs required")
return c+phi*return_now,omega+alpha*innovation**2+beta*variance,omega/(1-alpha-beta)
print(ar_garch(.01,0,.1,.000001,.1,.8,.02,.0001))Continue learning
Trading Algorithms: A Practical Selection Guide — all lessons- Moving averages, EWMA and momentum/reversion rules
- Kalman filtering: combine a prediction with a noisy observation
- ARIMA for conditional means and GARCH for conditional variance
- Linear models, random forests and gradient boosting
- PCA, clustering, risk parity and quadratic programming
- TWAP, VWAP and percentage-of-volume execution
- Optimal execution: impact versus waiting risk
Quantitative finance and development glossary · Python resources and libraries · Research sources and limitations