STA03B3 Lecture 4
STA03B3 Lecture 4
STOCHASTIC PROCESSES
Lecture 4
Dr V. van Appel
Department of Statistics
Faculty of Science, University of Johannesburg
1 / 34
Overview
2 / 34
2.3 Basic Computations
3 / 34
▶ For matrix computations we will identify discrete probability
distributions with row vectors.
▶ For a Markov chain X0 , X1 , · · · , the distribution of X0 is called the
initial distribution of the Markov chain.
▶ If α is the initial distribution, then P (X0 = j) = αj , for all j.
▶ For states i and j, and n ≥ 1, P (Xn = j|X0 = i) is the probability
that the chain started in i hits j in n steps.
▶ The n-step transition probabilities can be arranged in a matrix.
▶ The matrix whose ij th entry is P (Xn = j|X0 = i) is the n-step
transition matrix of the Markov chain.
4 / 34
Definition (n-Step Transition Probabilities)
▶ Of course, for n = 1, this is just the usual transition matrix P.
▶ For n ≥ 1, one of the central computational results for Markov
chains is that the n-step transition matrix is precisely Pn , the nth
matrix power of P.
Proof:
To show that P (Xn = j|X0 = i) = (Pn )ij , condition on Xn−1 , which
gives:
X
P (Xn = j|X0 = i) = P (Xn = j|Xn−1 = k, X0 = i)
k
× P (Xn−1 = k|X0 = i)
X
= P (Xn = j|Xn−1 = k)P (Xn−1 = k|X0 = i)
k
X
= Pkj P (Xn−1 = k|X0 = i),
k
where the second equality is by the Markov property, and the third
equality is by time homogeneity.
5 / 34
For n = 2, this gives
X
P (X2 = j|X0 = i) = Pkj P (X1 = k|X0 = i)
k
X
= Pkj Pik
k
= (P2 )ij .
7 / 34
Note that Pijn = (Pn )ij .
▶ Do not confuse this with (Pij )n , which is the number Pij raised to
the nth power.
▶ Also note that P0 is the identity matrix.
▶ That is,
1, if i = j,
P0ij = P (Xn = j|X0 = i) =
0, if i ̸= j.
▶ P1ij = pij
8 / 34
Example (2.14)
For gambler’s ruin, assume that the gambler’s initial stake is $3 and the
gambler plays until either gaining $8 or going bust. At each play the
gambler wins $1, with probability 0.6, or loses $1, with probability 0.4.
Find the gambler’s expected fortune after four plays.
Solution:
The transition matrix is
0 1 2 3 4 5 6 7 8
0 1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
1 0.40 0.00 0.60 0.00 0.00 0.00 0.00 0.00 0.00
2 0.00
0.40 0.00 0.60 0.00 0.00 0.00 0.00 0.00
3 0.00 0.00 0.40 0.00 0.60 0.00 0.00 0.00 0.00
P = 4 0.00 0.00 0.00 0.40 0.00 0.60 0.00 0.00 0.00.
5 0.00 0.00 0.00 0.00 0.40 0.00 0.60 0.00 0.00
6 0.00 0.00 0.00 0.00 0.00 0.40 0.00 0.60 0.00
7 0.00 0.00 0.00 0.00 0.00 0.00 0.40 0.00 0.60
8 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 1.00
9 / 34
▶ The one-step transition matrix
Consider the one-step transition matrix given as follows
1.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
0.40 0.00 0.60 0.00 0.00 0.00 0.00 0.00 0.00
0.00 0.40 0.00 0.60 0.00 0.00 0.00 0.00 0.00
0.00 0.00 0.40 0.00 0.60 0.00 0.00 0.00 0.00
P= 0.00 0.00 0.00 0.40 0.00 0.60 0.00 0.00 0.00
0.00 0.00 0.00 0.00 0.40 0.00 0.60 0.00 0.00
0.00 0.00 0.00 0.00 0.00 0.40 0.00 0.60 0.00
0.00 0.00 0.00 0.00 0.00 0.00 0.40 0.00 0.60
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 1.00
10 / 34
▶ The two-step transition matrix
The two-step transition matrix, P2 = P.P, is:
11 / 34
▶ The three-step transition matrix
The three-step transition matrix, P3 = P2 .P, is:
12 / 34
▶ The four-step transition matrix
The four-step transition matrix, P4 = P3 .P, is:
P4 = P3 .P =
0 1 2 3 4 5 6 7 8
0 1.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000
1 0.496 0.115 0.000 0.259 0.000 0.130 0.000 0.000 0.000
2 0.237
0.000 0.288 0.000 0.346 0.000 0.130 0.000 0.000
3 0.064 0.115 0.000 0.346 0.000 0.346 0.000 0.130 0.000
P4 =
4 0.026 0.000 0.154 0.000 0.346 0.000 0.346 0.000 0.130.
5 0.000 0.026 0.000 0.154 0.000 0.346 0.000 0.259 0.216
6 0.000 0.000 0.026 0.000 0.154 0.000 0.288 0.000 0.533
7 0.000 0.000 0.000 0.026 0.000 0.115 0.000 0.115 0.744
8 0.000 0.000 0.000 0.000 0.000 0.000 0.000 0.000 1.000
13 / 34
The gambler’s expected fortune is
8
X
E(X4 |X0 = 3) = jP (X4 = j|X0 = 3)
j=0
8
X
4
= jP3j
j=0
= 0(0.064) + 1(0.115) + 2(0) + 3(0.346) + 4(0)
+ 5(0.346) + 6(0) + 7(0.130) + 8(0)
= $3.79
14 / 34
Exercise
Find the gambler’s expected fortune after
1. three plays i.e., E(X3 |X0 = 2).
2. six plays i.e., E(X6 |X0 = 5).
15 / 34
The following proposition deals with a class of equations called the
Chapman-Kolmogorov equations, which provide a generalization of the
preceding results obtained for the two-step transition probability.
Proposition (Chapman–Kolmogorov Relationship)
For all 0 < r < n,
(n−r)
X
Pijn = r
Pik Pkj .
k
This proposition states that the probability that the process starts
in state i and finds itself in state j at the end of the nth transition
is the product of the probability that the process starts in state i
and finds itself in an intermediate state k after r transitions and
the probability that it goes from state k to state j after additional
n − r transitions.
16 / 34
Proof.
X
Pijn = P [Xn = j|X0 = i] = P [Xn = j, Xr = k|X0 = i]
k
X
= P [Xn = j|Xr = k, X0 = i]P [Xr = k|X0 = i]
k
X
= P [Xn = j|Xr = k]P [Xr = k|X0 = i]
k
(n−r) (n−r)
X X
r r
= Pkj Pik = Pik Pkj
k k
17 / 34
Distribution of Xn
▶ In general, a Markov chain X0 , X1 , . . . is not a sequence of
identically distributed random variables.
▶ For n ≥ 1, the marginal distribution of Xn depends on the n-step
transition matrix Pn , as well as the initial distribution α.
▶ To obtain the probability mass function of Xn , condition on the
initial state X0 .
▶ For all j,
X X
P (Xn = j) = P (Xn = j|X0 = i)P (X0 = i) = Pijn αi (1)
i i
18 / 34
▶ It is the dot product of the initial probability vector α with the jth
column of Pn .
▶ That is, it is the jth component of the vector–matrix product αPn .
(Remember: α is a row vector.)
Definition (Distribution of Xn )
▶ Let X0 , X1 , · · · be a Markov chain with transition matrix P and
initial distribution α.
▶ For all n ≥ 0, the distribution of Xn is αPn .
▶ That is,
P (Xn = j) = (αPn )j , for all j.
19 / 34
Example (2.15)
Consider the weather chain introduced in Example 2.3. For tomorrow,
the meteorologist predicts a 50% chance of snow and a 50% chance of
rain. Find the probability that it will snow 2 days later.
Solution As the ordered states of the chain are rain, snow, and
clear, the initial distribution is α = (0.5, 0.5, 0). We have
r s c r s c
r 0.2 0.6 0.2! r 0.12 0.72 0.16!
P= s 0.1 0.8 0.1 and P2 = s 0.11 0.76 0.13 .
c 0.1 0.6 0.3 c 0.11 0.72 0.17
This gives
20 / 34
0.12 0.72 0.16
αP2 = 0.5
0.5 0 0.11 0.76 0.13 = 0.115 0.74 0.145
0.11 0.72 0.17
Excercise
1. Find the probability that it will rain 2 days later.
Answer:
The desired probability of rain is P (X2 = r) = (αP2 )r = 0.115.
2. Find the probability that it will snow 3 days later.
Answer:
The desired probability of rain is P (X3 = s) = (αP3 )s =?
21 / 34
Present, Future, and Most Recent Past
The Markov property says that past and future are independent given the
present. It is also true that past and future are independent, given the
most recent past.
Markov Property
Let X0 , X1 , · · · be a Markov chain. Then, for all m < n,
22 / 34
Proof.
With m = 0, Equation (2) reduces to the defining Markov relationship as
stated in the Equation given in the previous lecture as follows:
23 / 34
The third equality is by time-homogeneity.
24 / 34
Joint Distribution
▶ The marginal distributions of a Markov chain are determined by the
initial distribution α and the transition matrix P.
▶ In fact, α and P determine all the joint distributions of a Markov
chain, that is, the joint distribution of any finite subset of
X0 , X1 , X2 , . . ..
▶ In that sense, the initial distribution and transition matrix give a
complete probabilistic description of a Markov chain.
▶ To illustrate, consider an arbitrary joint probability, such as
25 / 34
Joint Distribution
P (X5 = i, X6 = j, X9 = k, X17 = l)
26 / 34
For completeness, here is the general formula.
Joint Distribution
▶ Let X0 , X1 , · · · be a Markov chain with transition matrix P
and initial distribution α.
▶ For all 0 ≤ n1 < n2 < · · · < nk−1 < nk and states
i1 , i2 , · · · , ik−1 , ik ,
27 / 34
Example (2.16)
Danny’s daily lunch choices are modelled by a Markov chain with
transition matrix
Burrito Falafel Pizza Sushi
Burrito 0.0 0.5 0.5 0.0
Falafel 0.5 0.0 0.5 0.0
P= .
Pizza 0.4 0.0 0.0 0.6
Sushi 0.0 0.2 0.6 0.2
Solution
Let b, f, p, s denote Danny’s lunch choices, respectively. Let X0
denote Danny’s lunch choice on Sunday.
28 / 34
The desired probability is
b f p s
b 0.45 0.00 0.25 0.30
f 0.20 0.25 0.25 0.30
P2 =
p 0.00 0.32 0.56 0.12
s 0.34 0.04 0.22 0.40
b f p s
b 0.100 0.285 0.405 0.210
f 0.225 0.160 0.405 0.210
P3 =
p 0.384 0.024 0.232 0.360
s 0.108 0.250 0.430 0.212
29 / 34
The desired probability is
30 / 34
31 / 34
Tutorial Exercises
Do the following exercises from [Dobrow, 2016] :
32 / 34
References I
33 / 34
Questions?
34 / 34