core practice · implementation task
Simulate a two-state Markov chain
Transition matrix P=[[0.9,0.1],[0.2,0.8]] on states {0,1}. Simulate 1000 steps from state 0. Estimate stationary proportion of time in state 1.
The mechanism
Markov: future depends only on present state. Random walk sums independent steps. If returns are unpredictable, momentum must demonstrate structure, not narrative.
Expected evidence
≈1/3 time in state 1 (solve πP=π → π=(2/3,1/3)). Simulation should be close.
Try this drill in the practice workspace →
Hints when you need them
- Each step: sample next state from P[current].
- Stationary π solves πP=π.
Watch for these mistakes
- Markov when volatility clusters
- Trending levels called random walk
- Confusing level walk with return predictability