Transition Matrix Library First Release

Open Risk released version 0.1 of the Transition Matrix Library


State transition phenomena where a system exhibits stochastic (random) migration between well defined discrete states (see picture below for an illustration) are very common in a variety of fields. Depending on the precise specification and modelling assumptions they may go under the name of multi-state models, Markov chain models or state-space models.

In financial applications a prominent example of phenomena that can be modelled using state transitions are credit rating migrations of pools of borrowers. The credit rating is a discrete label that captures the creditworthiness of an obligor. With the introduction of new accounting standards like IFRS 9 and CECL there is an increasing emphasis on developing and using credit ratings as an internal risk parameter that helps estimate future expected credit losses.

In such applications we don’t have a single stochastic system, but samples (observations) from an entire population. Under some conditions it may be reasonable to try to segment the observations into homogeneous pools and attempt to estimate the respective transition matrices.

The properties of system transitions must be estimated using appropriate statistical techniques. In the simplest case this involves estimating the observed frequency of transitions from one state to the other, but there can be considerable additional complexities in the form of absorbing states, competing risks, non-Markovian behavior etc.

In the R ecosystem there are a number of packages for estimating transition matrices there is little available in the Python universe (and even less with a more specific credit risk management focus).


This is where the release of the TransitionMatrix package comes in. The purpose is to provide a new python package that supports the empirical analysis and visualization of state transition phenomena.

The library can be used in any relevant field but there is a particular focus on credit risk applications, for example time-inhomogeneous transition rates due to economic conditions.

The current release is in alpha state, hence it is advisable to use with caution. The documentation available with distribution outlines the future work plan

Getting Started

Experienced python users can simply download the package and explore it. The examples directory contains a number of worked examples that demonstrate the structure and functionality of the library.

There is also an Open Risk Academy short course that provides a more guided sequence for learning to use the package.