Skip to content
BIASED

Markov chains

Block 1 of 7~3 min

A one-step memory

The topic Hypothesis tests and A/B testing closed the statistics part of the course, and every result in it rested on one assumption: the observations are independent. Users in an A/B test, examples in a test set, tosses of a coin — each new draw knew nothing about the previous ones. That is what made the law of large numbers and the CLT work. Many random processes are not like that. Tomorrow's weather depends on today's, the next word of a sentence on the words before it, the next page a reader opens on the page they are reading. This topic studies the simplest model of such dependence through time.

A sequence X0,X1,X2,…X_0, X_1, X_2, \dots with values in a finite set of states {1,…,K}\{1, \dots, K\} is a Markov chain if the future depends on the past only through the present:

P(Xt+1=j∣Xt=i,Xt−1,…,X0)=P(Xt+1=j∣Xt=i)=Pij.P(X_{t+1} = j \mid X_t = i, X_{t-1}, \dots, X_0) = P(X_{t+1} = j \mid X_t = i) = P_{ij}.

The first equality is the Markov property: the current state holds everything about the past that matters for the next step. The second is a separate assumption, time homogeneity: the rule PijP_{ij} is the same at every tt. All chains in this topic are homogeneous.

The numbers PijP_{ij} form the K×KK \times K transition matrix PP. Row ii is the distribution of the next state given the current state ii, so every entry is nonnegative and every row sums to 11. (Here PP is a matrix; P(⋅)P(\cdot) is still a probability, and the brackets tell them apart.)

A three-state weather model, with rows and columns ordered sunny, cloudy, rainy:

P=(0.70.20.10.30.40.30.20.30.5).P = \begin{pmatrix} 0.7 & 0.2 & 0.1 \\ 0.3 & 0.4 & 0.3 \\ 0.2 & 0.3 & 0.5 \end{pmatrix}.

After a sunny day comes another sunny day with probability 0.70.7. The multiplication rule from the topic Conditional probability and Bayes' formula, together with the Markov property, gives the probability of a whole path as a product of one-step factors:

P(X0=i0,X1=i1,…,Xt=it)=P(X0=i0) Pi0i1Pi1i2⋯Pit−1it.P(X_0 = i_0, X_1 = i_1, \dots, X_t = i_t) = P(X_0 = i_0)\, P_{i_0 i_1} P_{i_1 i_2} \cdots P_{i_{t-1} i_t}.

For example, from a sunny day the path sunny, sunny, cloudy has probability 0.7⋅0.2=0.140.7 \cdot 0.2 = 0.14.

Answers are saved on the server and tied to this browser until you sign in.