Credit Monte Carlo

Overview

Credit Monte Carlo computes the risk due to default for a set of instruments by Simulating the default of those instruments a large number of times and measuring the resulting distribution.

This example uses the prcess monte carlo

Simulate One Period

When the simulate_item method is called, it is passed four arguments.

  • item - the record of the item (loan) being simulated
  • simulation - for each item, a list of simulation results is retained. It collects the results of each call to simulate_item. This list is passed to each call to simulate_item. This means that each simulation can maintain a history for each item, so that the simulation can have path dependencies
  • date - the id of the period being simulated
  • contexts - if a context function is passed into the simulation, the for each date in the iteration, the context function is called and the results saved in a contextts list. This list is then passed to simulate_item method and can be used in the simulation.

    Contexts are simulated objects that may affect an outcome, but is not specific to a particular loan. So for instance, you can simulate the interest rate curve, and this could a context that is passed into the simulate_item method for each loan, which may determine its probability of default based on the current curve.

Examples

  • Simple Model - takes a set of loans with defined probability of default, and simulates the loss in a portfolio due to defaults. Assumes no correlations among defaults
  • Intra Period Correlated Defaults - extends the simple example to account for correlations among the defaults in a given period.