Understanding Uncertainty · Interactive · Week 9: Markov chains

Markov Chain Walk

Type in a transition matrix or a joint table, then watch one random walk move through it

Each row of the table is today's state; each column is tomorrow's. You can enter a transition matrix, a joint table, or raw counts: the page divides every row by its row sum, so each row becomes the conditional PMF pr[tomorrow | today]. That row is all the chain uses to pick its next step.

The chain
Arrows go from today's state to tomorrow's, labeled with pr[tomorrow | today]; thicker arrows are more likely. The colored arrows leave the current state: they are the row the next step is drawn from. With more than three states, only those arrows are labeled.
Where the walk has been
0 steps
newest on the right
Time spent in each state
Bars: the share of steps the walk has spent in each state so far. Black tick: the long-run share the transition matrix predicts from this start. Run +1,000 steps a few times and the bars settle onto the ticks.