马尔可夫链

马尔可夫依赖的概念,在第5节中针对伯努利试验进行了定义,可以推广到具有多个可能结果的试验。考虑一个具有 r 个可能结果 s 1 , s 2 , , s r 的实验的 n 次试验,其中 r > 2 。对于 k = 1 , 2 , , n j = 1 , 2 , , r ,令 A k ( j ) 表示在第 k 次试验中结果 s j 发生的事件。如果对于从1到 n 的任何整数 k 以及从1到 r 的整数 j 1 , j 2 , , j k ,事件 A 1 ( j 1 ) , A 2 ( j 2 ) , , A k ( j k ) 满足条件 ,则这些试验被定义为马尔可夫依赖的。

在讨论具有 r 个可能结果的马尔可夫依赖试验时,通常采用一种直观易懂的语言。我们不说一个具有 r 个可能结果的实验的 n 次试验,而是说在 n 个时刻观察一个具有 r 个可能状态的系统的状态。我们将状态编号为 1 , 2 , , r (有时也编号为 0 , 1 , , r 1 ),并令 A k ( j ) 表示系统在时刻 k 处于状态 j 的事件。如果(6.1)成立,我们就说该系统是一个具有 r 个可能状态的马尔可夫链。用文字来说,(6.1)表明,在任何时刻,从当前状态转移到任何其他状态的条件概率,不依赖于如何到达当前状态。有时人们说,马尔可夫链是一个没有过去记忆的系统。

现在假设对于任何状态 i j ,条件概率在时刻处于状态的条件概率,给定在时刻它处于状态 t 无关。此时称该马尔可夫链是齐次的(或时间齐次的)。一个具有 r 个状态的齐次马尔可夫链对应于具有 r 个可能结果的马尔可夫依赖重复试验的概念。在本节中,我们所说的马尔可夫链均指齐次马尔可夫链。

由下式定义的 m 步转移概率在时刻处于状态的条件概率,给定在时刻它处于状态 可以通过关于 P ( i , j ) 的方程组递归地给出,对于 m = 2 , 3 , 为了证明(6.4),将其写成如下形式 P [ A m + 1 ( j ) A 1 ( i ) ] = k = 1 r P [ A m ( k ) A 1 ( i ) ] P [ A m + 1 ( j ) A m ( k ) ] 回顾一下, A m b ( j ) 是系统在时刻 m 处于状态 j 的事件。

类似地,可以证明 

无条件概率,(6.6) p n ( j ) = 在时刻 n 马尔可夫链处于状态 j 的概率,对于 n 2 ,可以通过初始无条件概率 p 1 ( j ) 由下式给出 

证明(6.7)的方法与证明(6.4)(6.5)的方法完全相同。类似地,可以证明 

具有 r 个状态的马尔可夫链的转移概率 P ( i , j ) 最好以矩阵形式表示。矩阵 P 被称为 r × r 矩阵,因为它有 r 行和 r 列。

给定一个 m × r 矩阵 A 和一个 r × n 矩阵 B A = [ a 11 a 12 a 1 r a 21 a 22 a 2 r a m 1 a m 2 a m r ] B = [ b 11 b 12 b 1 n b 21 b 22 b 2 n b r 1 b r 2 b r n ] 我们定义这两个矩阵的乘积 C = A B 为一个 m × n 矩阵,其位于第 i 行和第 j 列交叉处的元素 c i j 由下式给出应当注意,矩阵乘法满足结合律;对于任何矩阵 A , B C ,有 A ( B C ) = ( A B ) C

如果我们通过下式定义马尔可夫链的 m 步转移概率矩阵 P m 我们看到(6.4)(6.5)可以被简洁地表达。 

例6A。如果一个马尔可夫链的转移概率矩阵 P 由下式给出 P = [ 0 1 3 2 3 2 3 0 1 3 1 3 2 3 0 ] 那么该链由三个状态组成,因为 P 是一个 3 × 3 矩阵,并且2步和3步转移概率矩阵由下式给出 P 2 = P P = [ 4 9 4 9 1 9 1 9 4 9 4 9 4 9 1 9 4 9 ] , P 3 = P 2 P = [ 1 3 2 9 4 9 4 9 1 3 2 9 2 9 4 9 1 3 ]  

如果假设初始无条件概率由下式给出 p 1 = ( p 1 ( 1 ) , p 1 ( 2 ) , p 1 ( 3 ) ) = ( 1 2 , 1 4 , 1 4 ) , 那么

如果存在数 π 1 , π 2 , , π r 使得对于任何状态 i j ,有

 

则我们定义一个具有 r 个状态的马尔可夫链是遍历的。用文字来说,一个马尔可夫链是遍历的,如果当 m 趋于 时, m 步转移概率 P m ( i , j ) 趋于一个极限,该极限仅依赖于最终状态 j ,而不依赖于初始状态 i 。如果一个马尔可夫链是遍历的,那么经过大量试验后,它会达到统计平衡,即无条件概率 p n ( j ) 趋于极限

 

无论初始无条件概率 p 1 ( j ) 的值是多少,这些极限都是相同的。要看出(6.13)蕴含(6.14),对(6.7)两边取极限,并利用 k = 1 r p 1 ( k ) = 1 这一事实。

鉴于(6.14),我们称 π 1 , π 2 , , π r 为马尔可夫链的平稳概率,因为它们代表了在达到统计平衡后处于各个状态的概率。

马尔可夫链理论的重要问题之一是确定一个马尔可夫链在什么条件下是遍历的。对这个问题的讨论超出了本书的范围。我们不加证明地陈述以下定理。

如果存在一个整数 m 使得对于所有状态那么具有转移概率矩阵 P 的马尔可夫链是遍历的。 

有时无需展示一个所有元素都为正的 m 步转移概率矩阵 P m ,也可以确定一个马尔可夫链是遍历的。给定马尔可夫链中的两个状态 i j ,如果存在状态 i 1 , i 2 , , i Y 使得

 

我们就说可以从 j 到达 i 。如果既可以从 j 到达 i ,又可以从 i 到达 j ,则称两个状态 i j 是互通的。可以证明以下定理。

如果一个马尔可夫链中的所有状态都互通,并且存在一个状态 i 使得 P ( i , i ) > 0 ,那么该马尔可夫链是遍历的。 

在确定一个马尔可夫链是遍历的之后,下一个问题是求出平稳概率 π j 。从(6.4)可以清楚地看出,平稳概率满足线性方程组, 

因此,如果一个马尔可夫链是遍历的,那么存在(6.17)的一个解,满足条件对于。可以证明,如果一个具有转移概率矩阵 P 的马尔可夫链是遍历的,那么满足(6.18)(6.17)的解是唯一的,并且必然满足(6.13)(6.14)。因此,为了找到平稳概率,我们只需要求解(6.17)

例6B。例6A中考虑的马尔可夫链是遍历的,因为对于所有状态 i j ,有 P 2 ( i , j ) > 0 。为了计算平稳概率 π 1 , π 2 , π 3 ,我们只需要求解方程并满足(6.18)。显然 π 1 = π 2 = π 3 = 1 3 (6.19)的一个解,且满足(6.18)。从长远来看,状态1、2和3成为马尔可夫链的状态的可能性是相等的。

一个矩阵 A = [ a 11 a 12 a 1 r a 21 a 22 a 2 r a r 1 a r 2 a r r ] 如果其任意一行元素之和等于1,则被定义为随机矩阵;用符号表示,如果对于 ,则 A 是随机矩阵。

The matrix A is defined as doubly stochastic if in addition the sum of the entries in any column is equal to 1; in symbols, A is doubly stochastic if (6.20) holds and also  

It is clear that the transition probability matrix P of a Markov chain is stochastic. If P is doubly stochastic (as is the matrix in example 6A), then the stationary probabilities are given by in which r is the number of states in the Markov chain. To prove (6.22) one need only verify that if P is doubly stochastic then (6.22) satisfies (6.17) and (6.18) .

Example 6C . Random walk with retaining barriers. Consider a straight line on which are marked off positions 0 , 1 , 2 , 3 , 4 , and 5, arranged from left to right. A man (or an atomic particle, if one prefers physically significant examples) performs a random walk among the six positions by tossing a coin that has probability p (where 0 < p < 1 ) of falling heads and acting in accordance with the following set of rules: if the coin falls heads, move one position to the right, if at 0 , 1 , 2 , 3 , or 4, and remain at 5, if at 5; if the coin falls tails, move one position to the left, if at 1 , 2 , 3 , 4 , or 5, and remain at 0, if at 0. The positions 0 and 5 are retaining barriers; one cannot move past them. In example 6 D we consider the case in which positions 0 and 5 are absorbing barriers; if one reaches these positions, the walk stops. The transition probability matrix of the random walk with retaining barriers is given by All states in this Markov chain communicate, since 0 < P ( 0 , 1 ) P ( 1 , 2 ) P ( 2 , 3 ) P ( 3 , 4 ) P ( 4 , 5 ) P ( 5 , 4 ) P ( 4 , 3 ) P ( 3 , 2 ) P ( 2 , 1 ) P ( 1 , 0 )  

The chain is ergodic, since P ( 0 , 0 ) > 0 . To find the stationary probabilities π 0 , π 1 , , π 5 , we solve the system of equations:  

We solve these equations by successive substitution.

From the first equation we obtain q π 1 = p π 0  or  π 1 = p q π 0 By subtracting this result from the second equation in (6.24) , we obtain q π 2 = p π 1  or  π 2 = p q π 1 = ( p q ) 2 π 0 Similarly, we obtain q π 3 = p π 2  or  π 3 = p q π 2 = ( p q ) 3 π 0 q π 4 = p π 3  or  π 4 = p q π 3 = ( p q ) 4 π 0 q π 5 = p π 4  or  π 5 = p q π 4 = ( p q ) 5 π 0 .  

To determine π 0 , we use the fact that

We finally conclude that the stationary probabilities for the random walk with retaining barriers for j = 0 , 1 , , 5 are given by  

If a Markov chain is ergodic, then the physical process represented by the Markov chain can continue indefinitely. Indeed, after a long time it achieves statistical equilibrium and probabilities π 1 , , π r exist of being in the various states that depend only on the transition probability matrix P .

We next desire to study an important class of non-ergodic Markov chains, namely those that possess absorbing states. A state j in a Markov chain is said to be absorbing if P ( j , i ) = 0 for all states i j , so that it is impossible to leave an absorbing state. Equivalently, a state j is absorbing if P ( j , j ) = 1 .

Example 6D . Random walk with absorbing barriers. Consider a straight line on which positions 0 , 1 , 2 , 3 , 4 , and 5, arranged from left to right, are marked off. Consider a man who performs a random walk among the six positions according to the following transition probability matrix:  

In the Markov chain with transition probability matrix P , given by (6.26) , the states 0 and 5 are absorbing states; consequently, this Markov chain is called a random walk with absorbing barriers. The model of a random walk with absorbing barriers describes the fortunes of gamblers with finite capital. Let two opponents, A and B , have 5 cents between them. Let A toss a coin, which has probability p of falling heads. On each toss he wins a penny if the coin falls heads and loses a penny if the coin falls tails. For j = 0 , , 5 we define the chain to be in state j if A has j cents.

Given a Markov chain with an absorbing state j , it is of interest to compute for each state i u j ( i ) = conditional probability of ever arriving at the absorbing state  j ,  given that one started from state i .  

We call u j ( i ) the probability of absorption in state j , given the initial state i , since one remains in j if one ever arrives there.

The probability u j ( i ) is defined on a sample description space consisting of a countably infinite number of trials. We do not in this book discuss the definition of probabilities on such sample spaces. Consequently, we cannot give a proof of the following basic theorem, which facilitates the computation of the absorption probabilities u j ( i ) .

If j is an absorbing state in a Markov chain with states { 1 , 2 , , r } , then the absorption probabilities u j ( 1 ) , , u j ( r ) are the unique solution to the system of equations:

Equation (6.28) is proved as follows. The probability of going from state i to state j is the sum, over all states k , of the probability of going from i to j via k ; this probability is the product of the probability P ( i , k ) of going from i to k in one step and the probability u j ( k ) of then ever passing from k to j .

Example 6E . Probability of a gambler’s ruin. Let A and B play the coin-tossing game described in example 6D. If A ’s initial fortune is 3 cents and ’s initial fortune is 2 cents, what is the probability that A ’s fortune will be 0 cents before it is 5 cents, and A will be ruined?

 

Solution

For i = 0 , 1 , , 5 let u 0 ( i ) be the probability that A ’s fortune will ever be 0, given that his initial fortune was i cents. In view of (6.28), the absorption probabilities u 0 ( i ) are the unique solution of the equations

 

To solve these equations we note that, defining c = u 0 ( 1 ) u 0 ( 0 ) , Therefore, there is a constant c such that (since u 0 ( 0 ) = 1 ), To determine the constant c , we use the fact that u 0 ( 5 ) = 0 . We see that so that Consequently, for i = 0 , 1 , , 5 In particular, the probability that A will be ruined, given his initial fortune is 3 cents, is given by  

Exercises

6.1 . Compute the 2-step and 3-step transition probability matrices for the Markov chains whose transition probability matrices are given by

(i)

P = [ 1 2 1 2 1 2 1 2 ]  

P = [ 1 2 1 2 0 1 2 1 2 0 0 0 1 ]  

 

Answer

(i), (iii) P 2 = P 3 = P ;

 

(ii) P 2 = [ 1 2 1 2 0 1 2 1 2 0 1 4 1 2 1 4 ] , P 3 = [ 1 2 1 2 0 1 2 1 2 0 3 8 1 2 1 8 ]  

(iv) P 2 = P 3 = [ 1 4 1 2 1 4 1 4 1 2 1 4 1 4 1 2 1 4 ]  

6.2 . For each Markov chain in exercise 6.1, determine whether or not (i) it is ergodic, (ii) it has absorbing states.

6.3 . Find the stationary probabilities for each of the following ergodic Markov chains:

[ 2 3 1 3 1 3 2 3 ]  

(ii)

[ 2 3 1 3 2 3 1 3 ]  

(iii)

[ 0.99 0.01 0.01 0.99 ]  

 

Answer

(i), (iii) π 1 = π 2 = 1 2 ; (ii) π 1 = 2 3 , π 2 = 1 3 .

 

6.4 . Find the stationary probabilities for each of the following ergodic Markov chains: [ 1 3 1 4 5 12 1 3 1 4 5 12 1 3 1 4 5 12 ]  

6.5 . Consider a series of independent repeated tosses of a coin that has probability p > 0 of falling heads. Let us say that at time n we are in state s 1 , s 2 , s 3 , or s 1 depending on whether outcomes of tosses n 1 and n were ( H , H ) , ( H , T ) , ( T , H ) , or ( T , T ) . Find the transition probability matrix P of this Markov chain. Also find P 2 , P 3 , P 4 .

 

Answer

P has rows ( p , q , 0 , 0 ) , ( 0 , 0 , p , q ) , ( p , q , 0 , 0 ) , ( 0 , 0 , p , q ) . For n > 1 the rows are ( p 2 , p q , p q , q 2 ) .

 

6.6 . Random walk with retaining barriers. Consider a straight line on which positions 0 , 1 , 2 , , 7 are marked off. Consider a man who performs a random walk among the positions according to the following transition probability matrix: P = [ q p 0 0 0 0 0 0 q 0 p 0 0 0 0 0 0 q 0 p 0 0 0 0 0 0 q 0 p 0 0 0 0 0 0 q 0 p 0 0 0 0 0 0 q 0 p 0 0 0 0 0 0 q 0 p 0 0 0 0 0 0 q p ] Prove that the Markov chain is ergodic. Find the stationary probabilities.

6.7 . Gambler’s ruin. Let two players A and B have 7 cents between them. Let A toss a coin, which has probability p of falling heads. On each toss he wins a penny if the coin falls heads and he loses a penny if the coin falls tails. If A ’s initial fortune is 3 cents, what is the probability that A ’s fortune will be 0 cents before it is 7 cents, and that A will be ruined.

 

Answer

4 2 if p = q = 1 2 , ( q 7 p 4 q 3 ) / ( q 7 p 7 ) if p q .

 

6.8 . Consider 2 urns, I and II, each of which contains 1 white and 1 red ball. One ball is drawn simultaneously from each urn and placed in the other urn. Let the probabilities that after n repetitions of this procedure urn I will contain 2 white balls, 1 white and 1 red, or 2 red balls be denoted by p n , q n , and r n , respectively. Deduce formulas expressing p n + 1 , q n + 1 , and r n + 1 in terms of p n , q n , and r n . Show that p n , q n , and r n tend to limiting values as n tends to infinity. Interpret these values.

6.9 . In exercise 6.8 find the most probable number of red balls in urn I after (i) 2, (ii) 6 exchanges.

 

Answer

1 .