# Calculation of the Transition matrix for Credit rating

Let say, I have Cumulative default rates for various credit rating as below - Given this, how can I calculate the typical Transition matrix?

Appreciate for any help.

In order to arrive at an (partial) answer, let us assume that annual credit rating transitions form a Markov chain with absorbing default state $$D$$.

Further, let us assume that we have $$K$$ non-default states (in your example, $$K=7$$). Thus, I will formulate a transition matrix $$T$$ which holds the transition probabilities from state $$k$$ to state $$k'$$. The columns represent the state at begin of period, the rows the state at the end of the period:

\begin{align} T=\begin{pmatrix} p_{1\to1} & p_{2\to1} & \ldots & p_{K\to 1} & 0\\ p_{1\to2} & p_{2\to2} & \ldots & p_{K\to 2} & 0\\ \ldots &\ldots &\ldots &\ldots &\ldots \\ p_{1\to K} & p_{2\to K} & \ldots & p_{K\to K} & 0\\ p_{1\to D} & p_{2\to D} & \ldots & p_{K\to D} & 1\\ \end{pmatrix}\equiv\begin{pmatrix}\mathbf{M} & \mathbf{0}\\ \mathbf{p} &1\end{pmatrix} \end{align}

The transition matrix is composed of the pure non-default transition submatrix $$\mathbf{M}$$ and the default transition probability (vector) $$\mathbf{p}$$.

Next, we derive the implied cumulative default probabilities after $$N$$ years. We know that the $$N$$th power of the transition matrix contains the cumulative default probabilities in its lower left element (see above). Thus, we are interested in:

\begin{align} \mathbf{p}_{(N=1)}&=\mathbf{T}_{\{2,1\}}=\mathbf{p}\\ \mathbf{p}_{(N=2)}&=\mathbf{T}^2_{\{2,1\}}=\mathbf{p}+\mathbf{pM}=\mathbf{p}\left(\mathbf{I}+\mathbf{M}\right)\\ \mathbf{p}_{(N=3)}&=\mathbf{T}^3_{\{2,1\}}=\mathbf{p}+\mathbf{pM}+\mathbf{pM}^2=\mathbf{p}\left(\mathbf{I}+\mathbf{M}+\mathbf{M}^2\right)\\ &\ldots\\ \mathbf{p}_{(N=n)}&=\mathbf{T}^n_{\{2,1\}}=\ldots=\mathbf{p}\sum_{i=0}^{n-1}\mathbf{M}^i \end{align}

which can be reformulated as \begin{align} \mathbf{p}_{(N=n)}&=\mathbf{p}_{(N=1)}+\mathbf{p}_{(N=n-1)}\mathbf{M} \end{align}

Or, as a matrix equation system:

$$\mathbf{D}=\mathbf{C M}$$

where the matrix $$\mathbf{D}$$ contains in each row $$k$$, the $$k+1$$th cumulative default probability minus the first default probability vector and the matrix $$C$$ contains in each row $$k$$ the $$k$$th cumulative default probability vector.

Finally, the matrix $$M$$ is found via

$$\mathbf{M}=\mathbf{C}^{-1}\mathbf{D}$$

Worked example.

Say we know that our transition matrix $$T$$ is $$T=\begin{pmatrix} 80\% & 8\% & 5\% & 0\\ 10\% & 75\% & 10\% & 0\\ 8\% & 10\% & 70\% & 0\\ 2\% & 7\% & 15\% & 100\%\\ \end{pmatrix}$$

The year-$$k$$-cumulative default probability is found by the corresponding lower left submatrix in the $$k$$th matrix power. In our case, the row-wise cumulative default probabilties are:

$$cumulative PD = \begin{pmatrix} 2\% & 7\% & 15\% \\ 5.5\% & 13.91\% & 26.30\% \\ 9.90\% & 20.50\% & 35.08\% \\ 14.77\% & 26.68\% & 42.10\% \\ \end{pmatrix}$$

We find the corresponding matrices as

$$\mathbf{D}=\begin{pmatrix} 3.50\% & 6.91\% & 11.30\% \\ 7.90\% & 13.50\% & 20.08\% \\ 12.77\% & 19.68\% & 27.10\% \end{pmatrix}$$

and $$\mathbf{C}$$ is simply the matrix of the first three rows of our cumulative PD matrix.

Calculating $$\mathbf{C}^{-1}\mathbf{D}$$ will recover the transition matrix $$M$$.

Note that, in practice, this approach is very much prone to accuracy issues. If you literally use the stated cumulative PDs from above (up to 4 digits of accuracy), you will not recover the initial transition Matrix. Hence, you should form a larger equation system (as in your example!) and use more information, i.e. find $$M$$ as

$$\hat{M}=\left(\mathbf{C}^T\mathbf{C}\right)^{-1}\mathbf{C}^T\mathbf{D}$$

...or you have to resort to an optimization routine in order to formulate the appropriate constraints (e.g. probabilities sum to $$1-PD_1$$...)

To summarise the shortfalls with this method:

1. May fail if underlying transition process is not Markov (I think...)
2. May yield nonsensical results if the accuracy of the cumulative PD matrix is not sufficiently high. This can be counteracted by using a large Cumulative Default matrix, $$T>>K$$.

Example Rcode below as per your request in the comment.

# this is our initial transition matrix
# we use it only ot produce the cumulative PDs (as in your table)

transition_matrix <- t(matrix(c(
0.80,0.08,0.05,0.00
,0.10,0.75,0.10,0.00
,0.08,0.10,0.70,0.00
,0.02,0.07,0.15,1.00),4,4))

# simple helper function for a matrix power (don't use in production)
matrix_power <- function(x, n) Reduce(%*%, replicate(n, x, simplify = FALSE))

# for K = 3 states, we need at least K + 1 = 4 cumulative default time horizons (4 years)
N <- 4

# cumulative PD table (as in your example, but transposed)
CPD <- t(sapply(1:N, function(i){matrix_power(transition_matrix,i)[4,1:3]}))

# the D matrix in my answer
D <- t(apply(CPD[-1,],1,function(x){x-CPD[1,]}))
# the C matrix in my answer
C <- CPD[1:N-1,]

# the OLS style solution. If N==K+1, this boils down to solve(C) %*% D
solve(t(C) %*% C) %*% t(C) %*% D

# output here for convenience:
[,1] [,2] [,3]
[1,] 0.80 0.08 0.05
[2,] 0.10 0.75 0.10
[3,] 0.08 0.10 0.70



All you need to do us update the CPDto your needs and run the last part of the code.

• Many thanks. Can you please help me to understand where are we using the Markov Properties? Nov 20, 2020 at 20:41
• Using that property we can „re-use“ the transition matrix for each phase. From a purely econometric point of view, I think it is not too crucial, but from a theoretical point of view, the Markov property is required. Nov 20, 2020 at 20:52
• can you also please elaborate how to obtained the $𝑐𝑢𝑚𝑢𝑙𝑎𝑡𝑖𝑣𝑒𝑃𝐷$ and $D$, from given $T$? Nov 21, 2020 at 15:10
• @Bogaso as stated in the answer: the $n$-year cumulative PD is obtained by calculating $T^n$ and selecting the Row that corresponds to default. The matrices C and D are defined in the text. Nov 21, 2020 at 15:44
• Thanks. But unfortunately I still failed to get those values. This is my R code : C1 = t(cbind(c(80, 8, 5, 0), c(10, 75, 10, 0), c(8, 10, 70, 0), c(2, 7, 15, 199)))/100; C1 %*% C1 %*% C1 %*% C1 %*% C1. With this, I failed to regenerate your numbers Nov 21, 2020 at 16:33