Stationary Distributions and Ergodicity
The long-run 'settled' behavior of a random process that keeps moving forever — why a single long simulation can stand in for averaging over many independent ones.
Prerequisites: Markov Chains, Continuous-Time Markov Chains
Backtest a mean-reverting strategy over one long historical stretch, or run it on many independent short samples and average — do you get the same answer? For most well-behaved random processes the answer is yes, and the two ideas that guarantee it are a stationary distribution (the process's long-run "resting" probabilities over its states) and ergodicity (the guarantee that time-averaging one long run gives the same answer as averaging across many independent runs).
An analogy: a well-shuffled deck's resting habits
Imagine repeatedly shuffling a deck of cards. After enough shuffles, the probability that the top card is any particular card settles down to a fixed number (1/52 for a fair deck) and stops changing no matter how many more times you shuffle — that fixed long-run probability profile is the stationary distribution. Ergodicity is a separate, stronger claim: if you shuffled once and then tracked what fraction of a single extremely long sequence of top cards was the ace of spades, that fraction would also converge to 1/52 — a single long history reveals the same probabilities as many independent snapshots would.
The mathematics, one symbol at a time
For a Markov chain with transition structure (discrete) or generator (continuous, see Continuous-Time Markov Chains), a distribution (a vector of probabilities over the states, summing to 1) is stationary if applying one more step leaves it unchanged:
In words: if the chain's state probabilities are already , one more transition step produces exactly again — the distribution is a fixed point of the dynamics. A chain is ergodic if it is irreducible (every state reachable from every other) and, for discrete chains, aperiodic (it doesn't cycle in a rigid fixed pattern); under these conditions, regardless of the starting state, the chain's distribution converges to a unique , and time averages along one path converge to expectations under :
This says: the average of some quantity measured along one long trajectory converges to what you'd get averaging over the stationary distribution — exactly the guarantee that lets a single backtest substitute for an ensemble of independent ones.
Worked example 1: solving for a stationary distribution by hand
A two-state chain toggles between "trending" (T) and "range-bound" (R) with transition probabilities , per day (so , ). Solve with , : . Combined with : , . In the long run, the market spends 40% of days trending and 60% range-bound — regardless of which state it started in.
Worked example 2: ergodicity in a backtest
Suppose the strategy earns $100 on trending days and −$20 on range-bound days. Using the stationary distribution from example 1, the expected daily P&L under is 0.4(100) + 0.6(-20) = 40 - 12 = \28. Ergodicity guarantees that a single sufficiently long backtest's *average* daily P&L will converge to this same \28 figure — you don't need to run the market forward many separate times to check the number; one long enough historical run does the job, provided the underlying dynamics genuinely stay stable over that window.
What this means in practice
Ergodicity is the quiet assumption behind treating one historical backtest as representative of "the market's typical behavior" — it only holds if the underlying regime dynamics are genuinely stable (irreducible, non-explosive) over the sample window. Stationary distributions themselves show up directly in regime-switching models, PageRank-style ranking algorithms, and any Markov-based simulation used to generate plausible future paths.
A stationary distribution is a fixed point of the chain's dynamics (); ergodicity is the further guarantee that, for an irreducible chain, a single long trajectory's time-average converges to the expectation under — letting one long run substitute for many independent ones.
The classic mistake is assuming ergodicity holds for financial time series without checking it — real markets go through structural regime changes (a 2008-style break, a change in market microstructure) that violate the "stable, unchanging dynamics" requirement. When that happens, a long backtest isn't sampling one stationary distribution; it's sampling a mixture of several, and its time-average doesn't correspond to any single regime's true expectation, which quietly invalidates naive "just use a longer backtest" reasoning.
Related concepts
Practice in interviews
Further reading
- Norris, Markov Chains, ch. 1
- Grimmett & Stirzaker, Probability and Random Processes, ch. 6