Mixing Times and Convergence to Stationarity
How long a Markov chain takes to 'forget' where it started and start behaving like a random draw from its long-run distribution — the number that tells you whether a simulation's early steps should be thrown away, and how many.
Prerequisites: Markov Chains
You build a Markov chain model of a stock's regime (bull, bear, choppy) and want to simulate 10,000 draws from its long-run regime distribution to feed a Monte Carlo backtest. You start the simulation in the "bull" state (today's actual regime) and run it forward. But the first several hundred simulated steps aren't really draws from the long-run distribution — they're still colored by the fact that you deliberately started in "bull." Using those early steps as if representative subtly biases the simulation toward the starting state. Mixing time is the number of steps a chain needs before its distribution over states gets close enough to its true stationary distribution that starting-point memory has effectively faded — the number telling you how much of a simulation to discard before trusting it.
An analogy: a shuffled deck forgetting its starting order
A brand-new deck is perfectly ordered by suit and rank. After one riffle shuffle, it's still noticeably closer to the original order than to a truly random arrangement — an expert could still exploit leftover structure. After about seven riffle shuffles, mathematically, the deck is close enough to uniformly random that no practical test can tell it apart from a truly random deck. "Seven shuffles" is the deck's mixing time: not the point it becomes exactly random (that takes infinitely many shuffles), but the point it's random enough that starting order no longer detectably influences anything you'd care about.
The formulas, one piece at a time
Let be a Markov chain's stationary distribution — the long-run probability of being in each state, unchanging once reached. Let be the distribution over states after steps, starting from state . The total variation distance between two distributions measures how far apart they are:
In plain English: this sums up, across every state , how much more (or less) likely the chain is to be in state after steps compared to its true long-run frequency, and halves the total to keep the distance between 0 (identical) and 1 (completely different). The mixing time is the smallest such that this distance drops below a small threshold (commonly or ) for the worst-case starting state . In plain English: it's how many steps you need to run the chain before its current-state distribution is within a small, agreed-upon tolerance of the true long-run distribution, no matter where you started.
Worked example 1: a two-state regime chain
Consider a simple two-state regime chain: bull today stays bull with probability 0.9, switches to bear with probability 0.1; bear stays bear with probability 0.8, switches to bull with probability 0.2. Solving gives the stationary distribution , . Starting deterministically in "bull" (), after one step the distribution is — total variation distance from is . After a few more steps this distance keeps shrinking geometrically (roughly by a factor related to the chain's second-largest eigenvalue, here about 0.7 per step), reaching below by around step 8–9 — meaning after about 9 simulated steps, the "started in bull" bias has become negligible for practical purposes.
Worked example 2: why burn-in length matters for the backtest
Suppose you run 10,000 simulated regime paths, each starting from today's actual "bull" state, and want the long-run regime frequencies in your Monte Carlo sample to match the true . If you use all 10,000 steps of every path including the first 9, you're injecting extra "bull" weight from the biased early steps — a small effect per path, but if paths are short (say, only 20 steps total), those first 9 biased steps are nearly half the sample, materially skewing the regime frequencies toward bull relative to the true stationary mix. The standard fix, called "burn-in," discards the first steps of each simulated path (here, roughly the first 9) before recording any statistics, ensuring what's kept is a fair sample of rather than a sample still colored by the deliberately chosen bull starting point.
What this means in practice
Mixing time governs the burn-in period in any Markov-chain Monte Carlo (MCMC) simulation, regime-switching model simulation, or Markov chain-based scenario generator: too little burn-in leaves starting-point bias in your results, while excessive burn-in just wastes computation. Chains that mix slowly (near-absorbing states, or states that rarely communicate) need much longer burn-in and are also a red flag that the chain's long-run behavior may be poorly identified from short historical data in the first place.
Mixing time is how many steps a Markov chain needs before its distribution over states gets close (in total variation distance) to its stationary distribution, regardless of starting state; it's the number that tells you how many simulated steps to discard as "burn-in" before trusting the sample as representative of long-run behavior.
The classic mistake is running a Markov-chain simulation from a fixed, meaningful starting state (like "today's actual regime") and using the early simulated steps as if they already represented the unconditional long-run distribution. Especially with short simulated paths or slowly mixing chains, this silently biases results toward the starting state; always estimate the mixing time (or use a generous, checked burn-in) before treating simulated output as a fair sample of the stationary distribution.
Related concepts
Practice in interviews
Further reading
- Levin & Peres, Markov Chains and Mixing Times, ch. 4
- Ross, Introduction to Probability Models, ch. 4