Week 07 · Discrete-time Markov chains
Compute transient probabilities and verify a stationary distribution.
← Week 6 · Subject contents · Week 8 →
Compute transient probabilities and verify a stationary distribution.
Work through the problem
A daily machine state is working, degraded, or failed. Rows of P give tomorrow’s distribution conditional on today’s state. A row vector p evolves as pₜ₊₁ = pₜP. The Markov assumption is that today’s state contains all the past information needed for tomorrow’s distribution.
From working, let the transition probabilities be [0.8, 0.2, 0]. Let degraded transition [0.3, 0.5, 0.2]. After two days the failure probability is 0.8×0 + 0.2×0.2 = 0.04. A stationary distribution π solves πP = π with probabilities summing to one.
Machine state probabilities over time.
Run the Python lab
import numpy as np
P = np.array([[.8,.2,0],[.3,.5,.2],[.4,0,.6]])
p = np.array([1.,0,0])
paths = [p]
for _ in range(30):
paths.append(paths[-1] @ P)
print("Day 2:", paths[2].round(3))
print("Day 30:", paths[-1].round(3))
assert np.isclose(paths[2][-1], .04)
assert np.allclose(paths[-1] @ P, paths[-1])
Output from the lab
Day 2: [0.7 0.26 0.04]
Day 30: [0.625 0.25 0.125]
Practice
- Can a chain spend positive time in failed state in equilibrium even when repairs happen?
Check your reasoning
- Yes. Continued transitions into failure replenish the probability that leaves via repairs.