Alessandro Palliccia

Stochastic Dynamical Models

Invariant densities of Markov chains

812 words,

Which distributions of the initial state of a Markov chain are passed on unchanged to the state at every later time?

Invariant densities

Let (Xn)n≥0(X_n)_{n \ge 0} be a Markov chain on the probability space (Ω,F,P)(\Omega, \mathcal{F}, \mathbb{P}) with set of states II and transition matrix P=(pij)i,j∈I.{P = (p_{ij})_{i, j \in I}.} As in the previous posts, Pi\mathbb{P}_i is the conditional probability given X0=i,{X_0 = i,} and pij(n)=Pi{Xn=j}{p^{(n)}_{ij} = \mathbb{P}_i\{X_n = j\}} is the entry (i,j)(i, j) of the power Pn.{P^n.}

Definition 5.1 (Invariant probability measure). A probability measure μ\mu on II is called invariant for the Markov chain (Xn)n≥0(X_n)_{n \ge 0} if, when X0X_0 has distribution μ,{\mu,} the random variable XnX_n has distribution μ\mu for all n≥0.{n \ge 0.}

In Definition 5.1 and below, we identify a probability measure on II with its density with respect to the counting measure on the σ\sigma-algebra of all subsets of I.{I.} This density is the collection of numbers (μi)i∈I(\mu_i)_{i \in I} in the interval [0,1][0, 1] such that ∑i∈Iμi=1.{\sum_{i \in I} \mu_i = 1.}

Proposition 5.2. A probability measure μ\mu on II is invariant for the Markov chain (Xn)n≥0(X_n)_{n \ge 0} if and only if, for every state i,{i,} we have

μi=∑j∈Iμjpji,(9)\mu_i = \sum_{j \in I} \mu_j p_{ji}, \tag{9}

that is, the density of μ\mu is a left eigenvector of the transition matrix with eigenvalue 1.

Proof (complete). Let μ\mu be the probability distribution of X0.{X_0.} The probability distribution ν\nu of X1X_1 has density

νi=P{X1=i}=∑j∈IP{X0=j}pji=∑j∈Iμjpji.\nu_i = \mathbb{P}\{X_1 = i\} = \sum_{j \in I} \mathbb{P}\{X_0 = j\} p_{ji} = \sum_{j \in I} \mu_j p_{ji}.

Therefore, if μ\mu is an invariant probability measure for the Markov chain (Xn)n≥0,{(X_n)_{n \ge 0},} then ν=μ{\nu = \mu} and (9) holds.

Conversely, if μ\mu is a probability measure on II satisfying (9),{(9),} then XnX_n has probability distribution μ\mu for all n.{n.} ■\blacksquare

Summing up, a probability measure μ\mu on I,{I,} with its density identified with the row vector (μi)i∈I,{(\mu_i)_{i \in I},} is invariant if and only if

μ=μP.\mu = \mu P.

Theorem 5.3. If the set of states II is finite, then there exists at least one invariant probability measure.

Proof (complete). The set of probability densities on II

K={(μi)i∈I:0≤μi≤1 for every i, ∑i∈Iμi=1}\mathcal{K} = \left\{ (\mu_i)_{i \in I} : 0 \le \mu_i \le 1 \text{ for every } i, \ \sum_{i \in I} \mu_i = 1 \right\}

is compact, as a closed bounded subset of Rcard⁡(I).{\mathbb{R}^{\operatorname{card}(I)}.} Let μ(0)∈K.{\mu^{(0)} \in \mathcal{K}.} For all n≥1,{n \ge 1,} the family of real numbers (μj(n))j∈I(\mu^{(n)}_j)_{j \in I} defined by

μj(n)=1n∑k=1n(∑i∈Iμi(0)pij(k))\mu^{(n)}_j = \frac1n \sum_{k=1}^{n} \left( \sum_{i \in I} \mu^{(0)}_i p^{(k)}_{ij} \right)

is a probability density on I.{I.} Since the set K\mathcal{K} is compact, by considering a subsequence, if necessary, we can assume that the sequence (μj(n))n≥1(\mu^{(n)}_j)_{n \ge 1} is convergent for all j∈I.{j \in I.} Defining πj=lim⁡n→∞μj(n),{\pi_j = \lim_{n \to \infty} \mu^{(n)}_j,} the collection of real numbers (πj)j∈I(\pi_j)_{j \in I} is a probability density on II and, moreover,

∑i∈Iπipij=lim⁡n→∞1n∑k=1n(∑i∈Iμi(0)pij(k+1))=lim⁡n→∞1n+1∑k=1n+1(∑i∈Iμi(0)pij(k))−lim⁡n→∞1n+1∑i∈Iμi(0)pij=πj\begin{aligned} \sum_{i \in I} \pi_i p_{ij} &= \lim_{n \to \infty} \frac1n \sum_{k=1}^{n} \left( \sum_{i \in I} \mu^{(0)}_i p^{(k+1)}_{ij} \right) \\ &= \lim_{n \to \infty} \frac{1}{n+1} \sum_{k=1}^{n+1} \left( \sum_{i \in I} \mu^{(0)}_i p^{(k)}_{ij} \right) - \lim_{n \to \infty} \frac{1}{n+1} \sum_{i \in I} \mu^{(0)}_i p_{ij} \\ &= \pi_j \end{aligned}

for all j∈I.{j \in I.} This proves that the probability measure with density (πi)i∈I(\pi_i)_{i \in I} is invariant for the Markov chain. ■\blacksquare

In the proof above, the invariant probability density is obtained as a limit of subsequences of (μ(n))n≥1,{(\mu^{(n)})_{n \ge 1},} where μ(0)\mu^{(0)} is a density on II and

μj(n)=1n∑k=1n(μ(0)Pk)j\mu^{(n)}_j = \frac1n \sum_{k=1}^{n} (\mu^{(0)} P^k)_j

for all n≥1{n \ge 1} and all j∈I,{j \in I,} where (μ(0)Pk)j=∑i∈Iμi(0)pij(k).{(\mu^{(0)} P^k)_j = \sum_{i \in I} \mu^{(0)}_i p^{(k)}_{ij}.} In particular, if μ(0)=δi,{\mu^{(0)} = \delta_i,} the Dirac density in i,{i,} we have

μj(n)=1n∑k=1npij(k).\mu^{(n)}_j = \frac1n \sum_{k=1}^{n} p^{(k)}_{ij}.

The analysis of this formula allows us to interpret the meaning of an invariant distribution. Recall that the random variable

∑k=1n1{Xk=j}\sum_{k=1}^{n} \mathbf{1}_{\{X_k = j\}}

represents the number of visits to jj up to time n.{n.} Hence the random variable

1n∑k=1n1{Xk=j}\frac1n \sum_{k=1}^{n} \mathbf{1}_{\{X_k = j\}}

represents the random frequency of visits to the state jj at time n.{n.} Thus its expectation with respect to the probability Pi,{\mathbb{P}_i,}

Ei[1n∑k=1n1{Xk=j}]=1n∑k=1nPi{Xk=j}=1n∑k=1npij(k),\mathbb{E}_i\left[ \frac1n \sum_{k=1}^{n} \mathbf{1}_{\{X_k = j\}} \right] = \frac1n \sum_{k=1}^{n} \mathbb{P}_i\{X_k = j\} = \frac1n \sum_{k=1}^{n} p^{(k)}_{ij},

represents the average frequency of visits to the state jj at time n.{n.} Therefore we can interpret the values πj\pi_j as asymptotic average frequencies of visits to the state j.{j.}

A Markov chain, even when II is finite, may have more than one invariant density, as the chain of the gambler’s ruin problem with states {0,1,…,N}{\{0, 1, \dots, N\}} shows. In this case the densities (1,0,…,0)(1, 0, \dots, 0) and (0,…,0,1),{(0, \dots, 0, 1),} and all their convex combinations

λ(1,0,…,0)+(1−λ)(0,…,0,1)=(λ,0,…,0,1−λ),λ∈[0,1],\lambda (1, 0, \dots, 0) + (1 - \lambda)(0, \dots, 0, 1) = (\lambda, 0, \dots, 0, 1 - \lambda), \qquad \lambda \in [0, 1],

are invariant.

The random walk on Z\mathbb{Z}

In the case where the set II is infinite, however, a Markov chain may not admit any invariant density, as Example 5.1 shows. The random walk on Z\mathbb{Z} of the previous post, with p,q∈(0,1){p, q \in (0, 1)} and p+q=1,{p + q = 1,} jumps from each state ii to i+1{i + 1} with probability pp and to i−1{i - 1} with probability q.{q.}

Example 5.1. The random walk on Z\mathbb{Z} has no invariant density.

In Example 5.1, an invariant density (πi)i∈Z(\pi_i)_{i \in \mathbb{Z}} would satisfy πi=qπi+1+pπi−1{\pi_i = q \pi_{i+1} + p \pi_{i-1}} for all i∈Z,{i \in \mathbb{Z},} namely

q(πi+1−πi)=p(πi−πi−1).(10)q (\pi_{i+1} - \pi_i) = p (\pi_i - \pi_{i-1}). \tag{10}

We begin by observing that πi+1≠πi{\pi_{i+1} \neq \pi_i} for all i∈Z.{i \in \mathbb{Z}.} Otherwise the identity (10) implies πi+1=πi{\pi_{i+1} = \pi_i} for all i,{i,} and (πi)i∈Z(\pi_i)_{i \in \mathbb{Z}} cannot be a probability density.

We distinguish three cases: p>q,{p > q,} p=q=1/2{p = q = 1/2} and p<q.{p < q.} In the first case, from (10) we find

πi+1−πi=(p/q)i(π1−π0),\pi_{i+1} - \pi_i = (p/q)^i (\pi_1 - \pi_0),

from which lim⁡i→+∞∣πi+1−πi∣=+∞,{\lim_{i \to +\infty} |\pi_{i+1} - \pi_i| = +\infty,} contradicting the boundedness of (πi)i∈Z.{(\pi_i)_{i \in \mathbb{Z}}.} In the second case, from (10) we get the formula

πi+1−πi=π1−π0,\pi_{i+1} - \pi_i = \pi_1 - \pi_0,

from which πi=i(π1−π0)+c,{\pi_i = i (\pi_1 - \pi_0) + c,} with cc constant, which again contradicts the boundedness of (πi)i∈Z.{(\pi_i)_{i \in \mathbb{Z}}.} The third case is similar to the first one. Summing up, the random walk on Z\mathbb{Z} has no invariant density.

A chain on N\mathbb{N} with an explicit invariant density

The explicit computation of an invariant density, or just the proof of its existence, might not be simple. The Markov chain of Example 5.2 arises in several models. Among them are the gambler’s ruin problem when the gambler’s opponent, for example a bank, has an infinite fortune, a random walk on N,{\mathbb{N},} and the number of customers in a queue at a counter. It is a case in which one can compute explicitly the unique invariant density.

Example 5.2. Consider the Markov chain with set of states N={0,1,2,… }{\mathbb{N} = \{0, 1, 2, \dots\}} and transition matrix

P=(r0p0000⋯q1r1p100⋯0q2r2p20⋯00q3r3p3⋯000q4r4⋯⋯⋯⋯⋯⋯⋯),P = \begin{pmatrix} r_0 & p_0 & 0 & 0 & 0 & \cdots \\ q_1 & r_1 & p_1 & 0 & 0 & \cdots \\ 0 & q_2 & r_2 & p_2 & 0 & \cdots \\ 0 & 0 & q_3 & r_3 & p_3 & \cdots \\ 0 & 0 & 0 & q_4 & r_4 & \cdots \\ \cdots & \cdots & \cdots & \cdots & \cdots & \cdots \end{pmatrix},

where (pm)m≥0,{(p_m)_{m \ge 0},} (rm)m≥0(r_m)_{m \ge 0} and (qm)m>0(q_m)_{m > 0} are 3 sequences of real numbers. They satisfy pm,qm∈(0,1){p_m, q_m \in (0, 1)} and rm∈[0,1],{r_m \in [0, 1],} and

r0+p0=1,qm+rm+pm=1for all m≥1.r_0 + p_0 = 1, \qquad q_m + r_m + p_m = 1 \quad \text{for all } m \ge 1.

In Example 5.2, every invariant density (πn)n≥0(\pi_n)_{n \ge 0} satisfies

π0=r0π0+q1π1,πn=pn−1πn−1+rnπn+qn+1πn+1\begin{aligned} \pi_0 &= r_0 \pi_0 + q_1 \pi_1, \\ \pi_n &= p_{n-1} \pi_{n-1} + r_n \pi_n + q_{n+1} \pi_{n+1} \end{aligned}

for all n≥1,{n \ge 1,} besides positivity πn≥0{\pi_n \ge 0} and normalization ∑n≥0πn=1.{\sum_{n \ge 0} \pi_n = 1.} From the first equation we find

π1=1−r0q1π0=p0q1π0\pi_1 = \frac{1 - r_0}{q_1} \pi_0 = \frac{p_0}{q_1} \pi_0

and, inductively,

πn=p0⋯pn−1q1⋯qnπ0\pi_n = \frac{p_0 \cdots p_{n-1}}{q_1 \cdots q_n} \pi_0

for all n≥1.{n \ge 1.} To see this, note that 1−rn=pn+qn{1 - r_n = p_n + q_n} for n≥1,{n \ge 1,} so that the equation for πn\pi_n becomes

qn+1πn+1−pnπn=qnπn−pn−1πn−1.q_{n+1} \pi_{n+1} - p_n \pi_n = q_n \pi_n - p_{n-1} \pi_{n-1}.

The first equation says q1π1−p0π0=0,{q_1 \pi_1 - p_0 \pi_0 = 0,} so by induction qn+1πn+1=pnπn{q_{n+1} \pi_{n+1} = p_n \pi_n} for every n≥0,{n \ge 0,} and these relations give the formula. The normalization condition is fulfilled if we set

π0=(1+∑n≥1p0⋯pn−1q1⋯qn)−1\pi_0 = \left( 1 + \sum_{n \ge 1} \frac{p_0 \cdots p_{n-1}}{q_1 \cdots q_n} \right)^{-1}

if and only if the series

∑n≥1p0⋯pn−1q1⋯qn\sum_{n \ge 1} \frac{p_0 \cdots p_{n-1}}{q_1 \cdots q_n}

is convergent. Therefore this condition is necessary and sufficient for the existence of an invariant density, which is necessarily unique.