model_clo_insight.engines.defaults module¶
Default Pooling Analytics
- run_defaults(obligors, loans, transaction_data, settings, methodology_params)¶
CLO Insight Pool Default Monte Simulation
This is the
Monte Carlo Simulation
engine for thePool Default
analysis. The inputs to this method are all custom classes, and must be constructed earlier in pre-processing. The simulation is a multi-factor model, where each obligor’s random shock is a linear combination of:Global Shock
Industry shock
Region Shock
Idiosyncratic Shock
The coefficients are computed from the asset correlation assumptions within meth_params. In practice, the correlation assumptions for inter- and intra- region are the same, which results in a zero for the coefficient of regional shock. To optimize this engine for speed, all random numbers are drawn inside Numpy earlier, and matrix arithmetic is used to perform the computations.
Algorithm Steps
Pre-compute factor coefficients from correlation parameters \(a + b\)
Setup random number generator
Simulate \(n_{trials}\) independent random normal
Global Shocks
\(n_{trials} = a + b\)
Compute lookup arrays
Simulate \(n_{trials}\) x \(n_{obligors}\) independent random normal
Idiosyncratic Shocks
\(n_{trials} = a * b\)
Simulate \(n_{trials}\) x \(n_{industries}\) independent random normal
Industry Shocks
Calculate \(n_{trials}\) x \(n_{obligors}\) correlated random normal variables based on linear combination of the
Shocks
Calculate default timing per obligor per trial by looking up the simulated shock variable to the obligor’s normalized PD curve
- Parameters
obligors (clo_internal_objects.Obligor) – pool of obligors
loans (clo_internal_objects.CorpLoan) – list of the loans in the pool
transaction_data (clo_internal_objects.TransactionData) – Data at the
Transaction
(e.g. securitization) levelsettings (clo_internal_objects.ModelSettings) –
Settings
object, e.g. Monte Carlo seed, number of trialsmethodology_params (clo_internal_objects.MethodologyParamsDefaults) –
Methodology Parameters
- Returns
ttd_matrix (\(n_{trials}\) x \(n_{obligors}\) matrix of simulated default times) and global_shocks (\(n_{trials}\)
Global Shock
values)- Return type
tuple of numpy.ndarray
Notes
Dictionaries cannot be used inside of Numpy’s vectorized code, so positional lookups need to be determined prior to the simulation