Skip to main content

Credit Risk Modeling using Excel and VBA, 2nd Edition

Credit Risk Modeling using Excel and VBA, 2nd Edition

Gunter Löeffler, Peter N. Posch

ISBN: 978-0-470-66092-8

Jan 2011

358 pages

In Stock



It is common to blame the inadequacy of credit risk models for the fact that the financial crisis has caught many market participants by surprise. On closer inspection, though, it often appears that market participants failed to understand or to use the models correctly. The recent events therefore do not invalidate traditional credit risk modeling as described in the first edition of the book. A second edition is timely, however, because the first dealt relatively briefly with instruments featuring prominently in the crisis (CDSs and CDOs). In addition to expanding the coverage of these instruments, the book will focus on modeling aspects which were of particular relevance in the financial crisis (e.g. estimation error) and demonstrate the usefulness of credit risk modelling through case studies.

This book provides practitioners and students with an intuitive, hands-on introduction to modern credit risk modelling.  Every chapter starts with an explanation of the methodology and then the authors take the reader step by step through the implementation of the methods in Excel and VBA.  They focus specifically on risk management issues and cover default probability estimation (scoring, structural models, and transition matrices), correlation and portfolio analysis, validation, as well as credit default swaps and structured finance.

The book has an accompanying website,, which has been specially updated for this Second Edition and contains slides and exercises for lecturers.

Preface to the 2nd edition.

Preface to the 1st edition.

Some Hints for Troubleshooting.

1 Estimating Credit Scores with Logit.

Linking scores, default probabilities and observed default behavior.

Estimating logit coefficients in Excel.

Computing statistics after model estimation.

Interpreting regression statistics.

Prediction and scenario analysis.

Treating outliers in input variables.

Choosing the functional relationship between the score and explanatory variables.

Concluding remarks.


Logit and probit.

Marginal effects.

Notes and literature.

2 The Structural Approach to Default Prediction and Valuation.

Default and valuation in a structural model.

Implementing the Merton model with a one-year horizon.

The iterative approach.

A solution using equity values and equity volatilities.

Implementing the Merton model with a T -year horizon.

Credit spreads.



Notes and literature.



3 Transition Matrices.

Cohort approach.

Multi-period transitions.

Hazard rate approach.

Obtaining a generator matrix from a given transition matrix.

Confidence intervals with the binomial distribution.

Bootstrapped confidence intervals for the hazard approach.

Notes and literature.


Matrix functions.

4 Prediction of Default and Transition Rates.

Candidate variables for prediction.

Predicting investment-grade default rates with linear regression.

Predicting investment-grade default rates with Poisson regression.

Backtesting the prediction models.

Predicting transition matrices.

Adjusting transition matrices.

Representing transition matrices with a single parameter.

Shifting the transition matrix.

Backtesting the transition forecasts.

Scope of application.

Notes and literature.


5 Prediction of Loss Given Default.

Candidate variables for prediction.

Instrument-related variables.

Firm-specific variables.

Macroeconomic variables.

Industry variables.

Creating a data set.

Regression analysis of LGD.

Backtesting predictions.

Notes and literature.


6 Modeling and Estimating Default Correlations with the Asset Value Approach.

Default correlation, joint default probabilities and the asset value approach.

Calibrating the asset value approach to default experience: the method of moments.

Estimating asset correlation with maximum likelihood.

Exploring the reliability of estimators with a Monte Carlo study.

Concluding remarks.

Notes and literature.

7 Measuring Credit Portfolio Risk with the Asset Value Approach.

A default-mode model implemented in the spreadsheet.

VBA implementation of a default-mode model.

Importance sampling.

Quasi Monte Carlo.

Assessing Simulation Error.

Exploiting portfolio structure in the VBA program.

Dealing with parameter uncertainty.


First extension: Multi-factor model.

Second extension: t-distributed asset values.

Third extension: Random LGDs.

Fourth extension: Other risk measures.

Fifth extension: Multi-state modeling.

Notes and literature.

8 Validation of Rating Systems.

Cumulative accuracy profile and accuracy ratios.

Receiver operating characteristic (ROC).

Bootstrapping confidence intervals for the accuracy ratio.

Interpreting caps and ROCs.

Brier score.

Testing the calibration of rating-specific default probabilities.

Validation strategies.

Testing for missing information.

Notes and literature.

9 Validation of Credit Portfolio Models.

Testing distributions with the Berkowitz test.

Example implementation of the Berkowitz test

Representing the loss distribution.

Simulating the critical chi-square value.

Testing modeling details: Berkowitz on subportfolios.

Assessing power.

Scope and limits of the test.

Notes and literature.

10 Credit Default Swaps and Risk-Neutral Default Probabilities.

Describing the term structure of default: PDs cumulative, marginal and seen from today.

From bond prices to risk-neutral default probabilities.

Concepts and formulae.


Pricing a CDS.

Refining the PD estimation.

Market values for a CDS.


Estimating upfront CDS and the 'Big Bang' protocol.

Pricing of a pro-rata basket.

Forward CDS spreads.


Pricing of swaptions.

Notes and literature.


Deriving the hazard rate for a CDS.

11 Risk Analysis and Pricing of Structured Credit: CDOs and First-to-Default Swaps.

Estimating CDO risk with Monte Carlo simulation.

The large homogeneous portfolio (LHP) approximation.

Systemic risk of CDO tranches.

Default times for first-to-default swaps.

CDO pricing in the LHP framework.

Simulation-based CDO pricing.

Notes and literature.


Closed-form solution for the LHP model.

Cholesky decomposition.

Estimating PD structure from a CDS.

12 Basel II and Internal Ratings.

Calculating capital requirements in the Internal Ratings-Based (IRB) approach.

Assessing a given grading structure.

Towards an optimal grading structure.

Notes and literature.

Appendix A1 Visual Basics for Applications (VBA).

Appendix A2 Solver.

Appendix A3 Maximum Likelihood Estimation and Newton’s Method.

Appendix A4 Testing and Goodness of Fit.

Appendix A5 User-defined Functions.