Math Atom · M-C13

Markov chains and transition matrices

10 minMath AtomProbability

By the end you will be able to

  1. 1Read a transition matrix: rows are today's state, columns next period's, each entry a conditional probability, each row summing to 1.
  2. 2Move a distribution forward with π₁ = π₀P, and find n-step probabilities from Pⁿ, by hand for a 3 × 3 matrix.
  3. 3Read cumulative, marginal and conditional default probabilities off the default column of an absorbing chain.
  4. 4State the Markov assumption and say when rating data break it.

Why you need it

A BBB borrower has a 0.20% chance of defaulting this year. Over five years, is it five times that? No: it is 2.86%, because many BBB firms will not still be BBB in year five. A transition matrix and its powers keep track of that drift.

These Core Path lessons use it:

  • L3.3.07: Rating migration

    Rating migration: the book's transition matrix, multi-year default probabilities by matrix powers, and the limits of the Markov assumption.

  • L3.3.18: Provisioning basics

    Lifetime expected loss needs a default probability for every future year, which a transition matrix supplies.

  • L3.3.14: Retail credit portfolios

    Roll rates move retail accounts between arrears buckets (up to date, 30, 60, 90 days past due) month by month: another transition matrix.

You need conditional probability and the law of total probability from M-C12: Conditional probability and Bayes' rule, and multiplying a row vector by a matrix from M-E02: Matrix multiplication and quadratic forms.

The idea

Where you go next depends only on where you are

A borrower moves between a few states, one year at a time, by chance. A Markov chain fixes the odds of each move from each state and nothing else. Send 1,000 borrowers into a toy chain with two grades and default, and press “Next year”.

A thousand borrowers on a chain

toy chain, expected head-counts

All 1,000 start as

0.080.150.10.02Strong1,000stays: 0.9Weak0stays: 0.75Default0stays: 1
Strong Weak Default
012345678910

Year. Each bar is the 1,000 borrowers split by state.

One borrower, drawn at random:

  1. 0S
  2. 1S
  3. 2W
  4. 3W
  5. 4W
  6. 5S
  7. 6S
  8. 7S
  9. 8S
  10. 9S
  11. 10S

A single path jumps about at random; the head-counts above are what thousands of such paths average to. Once a path reaches D it stays there.

Year0
Strong1,000.0
Weak0.0
Default0.0
Total1,000

Each year the head-counts are multiplied by the same table of odds, the transition matrix. The default count only ever grows, because default is absorbing. Start everyone Strong and many reach default by way of Weak, so the number of new defaults each year rises for the first 6 years before it eases: each step looks only at the present, but the steps add up.

The rules

The chain and its matrix. Transition probabilities are conditional probabilities, and the Markov property says the current state is all that counts.

Moving forward. One period is one multiplication by P; n periods is Pⁿ.

Absorbing default. The default column of Pⁿ is the cumulative PD, and differences of it give the marginal and the conditional PD.

The rules, for reference

pij=P(Xt+1=j∣Xt=i),∑jpij=1,πt+1=πtP,πn=π0Pnp_{ij} = P(X_{t+1} = j \mid X_t = i), \qquad \sum_j p_{ij} = 1, \qquad \pi_{t+1} = \pi_t P, \qquad \pi_n = \pi_0 P^n
PDicum(n)=(Pn)i,D,conditionali(n)=PDicum(n)−PDicum(n−1)1−PDicum(n−1)\text{PD}^{\text{cum}}_i(n) = (P^n)_{i,\text{D}}, \qquad \text{conditional}_i(n) = \frac{\text{PD}^{\text{cum}}_i(n) - \text{PD}^{\text{cum}}_i(n-1)}{1 - \text{PD}^{\text{cum}}_i(n-1)}

In the calculator, enter P row by row with semicolons and use P^n; entry (i, j) of a matrix Q is Q[i, j], counting from 1.

Try it

This is the one-year matrix from RiskAtoms Bank's Module 3.3 book (illustrative, shaped like published long-run averages). Pick a starting rating and a horizon. Things to try: compare the cumulative PD with “one-year PD × n” for BBB and for CCC; push the horizon to 30 years, where a BBB borrower's cumulative PD reaches 35.0% (and 79.7% after 100, as everything drains into default); then turn up the downturn slider, which makes every downgrade and default more likely, to see how much a matrix from a bad stretch of the cycle differs from the average one.

Try itRating paths on the book's matrix

Open the matrix calculator →

Starting rating

Where a BBB borrower is in 5 years: row BBB of P5
0.1%AAA1.3%AA14%A61%BBB13%BB5.6%B1.8%CCC2.9%D
cumulative PD
0%10%20%30%40%0102030

Years from today (up to 30).

The whole of P5 as a heat map (row: rating now; column: rating in 5 years). Every row adds up to 100%.

from \ toAAAAAABBBBBBCCCD
AAA59%30%7.9%1.7%0.4%0.3%0.1%0.1%
AA2.0%62%28%5.4%1.2%0.6%0.2%0.3%
A0.3%7.1%67%19%3.6%1.5%0.5%0.8%
BBB0.1%1.3%14%61%13%5.6%1.8%2.9%
BB·0.4%3.0%18%44%21%4.7%9.4%
B·0.2%1.1%3.7%15%45%9.6%25%
CCC·0.1%0.6%1.6%4.8%16%10%66%
D·······100%
Cumulative PD by year 52.86%
Marginal PD in year 50.88%
Conditional PD in year 50.90%
Still BBB after 5y61.0%
One-year PD × 51.00%

Worked examples

1. The toy chain by hand

Step 1 of 5
  1. 1

    The set-up

    Three states, Strong, Weak and Default, in that order. 1,000 borrowers start Strong. Where are they after one and two years, and what is the two-year PD from each grade?

    P=[0.90.080.020.150.750.1001]P = \begin{bmatrix} 0.9 & 0.08 & 0.02 \\ 0.15 & 0.75 & 0.1 \\ 0 & 0 & 1 \end{bmatrix}

2. Five-year PDs from the book's matrix

Step 1 of 4
  1. 1

    The set-up

    The Module 3.3 book has an 8 × 8 one-year matrix on AAA, AA, A, BBB, BB, B, CCC and D. Its one-year PD is 0.20% for BBB and 4% for B. Raise the matrix to the powers 1 to 5 and read the D column.

3. A portfolio of 1,000 bonds

Step 1 of 4
  1. 1

    The set-up

    A portfolio holds 200 A, 500 BBB and 300 BB bonds, one issuer each (illustrative). Using the book's matrix, how is it spread over ratings in one and three years, and how many issuers do we expect to have defaulted?

Common mistakes

Each line below is a tempting slip. Spot what is wrong, then check.

Reaction

Check what stuck

Question 1 · objective 2

A chain has P = [0.80, 0.15, 0.05; 0.20, 0.70, 0.10; 0, 0, 1], with state 3 absorbing default. What is the two-year default probability from state 1? (3 decimal places)

Question 2 · objective 1

In a transition matrix with rows as today's state, what must add up to 1?

Question 3 · objective 3

A cumulative PD is 6% by year 3 and 8.35% by year 4. What is the PD in year 4 given survival to the start of it, as a percentage? (1 decimal place)

Question 4 · objective 2

In the toy chain (Strong: 0.90, 0.08, 0.02; Weak: 0.15, 0.75, 0.10), 60% of a book is Strong and 40% Weak. What share is in default after one year, as a percentage? (1 decimal place)

Question 5 · objective 4

Which finding, if true of a rating history, breaks the Markov assumption?

Glossary

Markov chain
A Markov chain: a sequence of states X₀, X₁, X₂, … in which the chance of the next state depends only on the current one.
Markov property
The Markov property: given today's state, the past adds nothing to the forecast of tomorrow's state.
Transition matrix
A transition matrix P: entry pᵢⱼ is the probability of moving from state i (row) to state j (column) in one period. Every row sums to 1.
Absorbing state
An absorbing state is one that is never left once entered: its row has a 1 on the diagonal. Default is one.
Cumulative PD
Cumulative PD: the probability of having defaulted at any time up to year n, the default entry of Pⁿ.
Conditional (forward) PD
Conditional (or forward) PD: the probability of defaulting during year n given survival to the start of it.
Time-homogeneous
Time-homogeneous: the same matrix P applies in every period, in good years and bad.