AR(1) process
Tomorrow is a fraction φ of today plus a new shock. With |φ| below 1 the series is pulled back to its mean; at φ = 1 it becomes a random walk.
01The formula
- the value at step t, measured from its long-run mean
- persistence: the share of today's value that carries over to tomorrow
- a fresh random shock at each step
- the size of the shocks
- the long-run spread of the series around its mean
02See it move
03Where it is used
- Quant researcherModels spreads, basis and signal values that tend to come back to a mean, and estimates φ to see how fast.
- Market makerTreats inventory or order-flow imbalance as persistent but fading, which sets how hard to skew quotes.
- Portfolio managerUses AR(1) forecasts for slow variables like rates or volatility in scenario planning.
04Why traders use it
It is the simplest model with memory. Its single parameter φ answers the trading question directly: how much of today's deviation should I expect to survive into tomorrow?
05Worked example
With φ = 0.80 and shocks of 0.50, the series settles to a spread of 0.833 around zero. Starting at 3.0, the expected value after 10 steps is 0.322; the simulated paths averaged 0.514. A shock loses half its effect in 3.11 steps.
06How it is built
- Substitute repeatedly: .
- Take expectations: , which decays to 0 when .
- The shocks are independent, so .
- As grows this tends to , the long-run variance.
07The common mistake
Estimating φ on short samples and trusting it. Least-squares estimates of φ are biased downwards in small samples, so a series can look mean-reverting when it is close to a random walk.
08In Python and LaTeX
import numpy as np phi, sigma, x0 = 0.8, 0.5, 3.0 print(round(sigma / np.sqrt(1 - phi**2), 4), round(phi**10 * x0, 4)) # 0.8333 0.3221
x_t = \phi\,x_{t-1} + \varepsilon_t, \quad \varepsilon_t \sim N(0, \sigma^2), \qquad \operatorname{sd}(x) = \frac{\sigma}{\sqrt{1 - \phi^2}}09Where it fits
Rather not code the maths yourself? Describe your trading idea and let AI build the bot.
Build a bot with AgenKitThe worked example and the model run the same code, so every number matches. Models simplify markets on purpose. This is education, not financial advice.