The Claude Quant PlaybookDownload ebookDownload ebook

AR(1) process

intermediateTime series4 of 8

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.

Build a trading system with Claude.Download ebook

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

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

  1. Substitute repeatedly: .
  2. Take expectations: , which decays to 0 when .
  3. The shocks are independent, so .
  4. 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 AgenKit

The worked example and the model run the same code, so every number matches. Models simplify markets on purpose. This is education, not financial advice.