{'fraction_non_alphanumeric': 0.02618929222608984, 'fraction_numerical': 0.008895519089452455, 'mean_word_length': 4.768005098789038, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 2, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Predicting Credit Default Probabilities Using Bayesian Statistics and Monte Carlo Simulations

Banks and financial institutions all over the world manage portfolios containing tens of thousands of customers. Not all customers are high credit-worthy, and many possess varying degrees of risk to the Bank or financial institutions that lend money to these customers. Hence assessment of credit risk is paramount in the field of credit risk management. This paper discusses the use of Bayesian principles and simulation-techniques to estimate and calibrate the default probability of credit ratings. The methodology is a two-phase approach where, in the first phase, a posterior density of default rate parameter is estimated based the default history data. In the second phase of the approach, an estimate of true default rate parameter is obtained through simulations


Introduction
Probability of default (PD) or Default Rate is a financial risk management term describing the likelihood of a default over a particular time horizon. It provides an estimate of the likelihood that a borrower will be unable to meet its debt obligations. Under Basel II guidelines, formulated by the Basel Committee on Banking Supervision or BCBS (2001), PD is a key parameter used in the calculation of economic capital or regulatory capital for a banking institution. Banks that comply with the new Basel II internal ratings-based approach are obliged to assign a PD value (usually a 1-year PD) to their clients, which are used as the basis for regulatory capital requirements.
A popular method of quantifying Probability of default is through credit ratings, where each entity in a bank's portfolio is assigned a rating grade depending on its past, current and future behaviour. Entities with same rating grade represents similar credit risk. Some banks have internal score card and rating models that assign ratings based on internal methodologies. On occasions, banks may use ratings supplied by external credit rating agencies such as Moody's and Standard & Poor's (S&P) instead of internal ratings. For example, S&P Global ratings provide a rating system with 22 rating classes and Moody's, which is another popular rating agency classifies entities to 21 rating classes based on their credit worthiness. This is permissible because Basel II accord allows banks to base their capital requirements on internal as well as external rating systems and risk profile.
Large banks employ various mathematical techniques using the historical data of customer or account level ratings assigned by its internal ratings system (or external rating system) to forecast the default probability of each entity.
The number of grades used by the bank depends on the bank's individual preference. The "upper" grades represent lower default risk and hence lower probability values are assigned to them while "lower" grades represent higher default risk and consequently, higher probability values are assigned to them.
One of the important concerns of analysts in the financial industry is that the empirically estimated PD values of rating classes are non-monotonic in nature (Katja Pluto and Dirk Tasche, 2005), i.e. ′ > ( ′ is "lower" grade) need not imply ̂′ >̂. Where ̂ is the estimated default rate for rating grade R. Dirk Tasche (2013) discussed this issue which he termed it as the 'Inversion of default rates'. Non monotonicity is an issue because the observed default rates do not reflect the true default risk associated with the rating class. Krahnen, J.P & Weber, M. (2001) mentions monotonicity as one of the most important requirements for a rating system. It is easy to see that without monotonicity, the situation can lead to issues like misclassification of some customers into wrong risk buckets with under-estimation or over-estimation of default probability. It also affects the discriminatory power of a rating system thereby hindering meaningful risk differentiation between less risk and high-risk rating classes.
One reason for break in monotonic trend could be that the portfolio of most banks has an uneven distribution of accounts in the rating classes (Dirk Tasche, 2013). It is commonly observed by industry experts in many of the data that are analysed, that there is insufficient data in some rating groups, thereby making it impossible to obtain an accurate estimate of its default risk from the observed default rate itself. For example, Table 1 shows the observed default rates based on historical rating assignments (Long-Term Foreign-Currency) of corporate assets by Standard & Poor's Ratings Services for the years 2017 and 2016. Note that for both years, there is a break in monotonicity in the empirically obtained default rates. Such inversions need not be a problem with the rankordering capacity of the rating methodology. The issuer weighted long-run average grade-level default rates reported by S&P (2020, table 4) suggests that the observation of default rate inversions as in table 1 might be an exception. on Accuracy Ratio and distribution of good accounts. Here, the PD or default probability for each rating is modelled as a mathematical function of the distribution of non-defaulted population in the portfolio.
A recent work in the field using Bayesian framework was by Denis Surzhko (2017) who proposed a method where the portfolio default rate itself rather than rating level is calibrated to the default rate of another portfolio called the closest available portfolio by adjusting the Bayesian prior density of the default rate parameter.
Although the method can be adopted for a rating level system, it involves identifying a closely related rated portfolio with reliable default statistics.
This paper proposes a combination of Bayesian approach and Monte-Carlo simulations for achieving the default rate curve calibration. Using Bayesian principles, we attempt to model the default parameter for each rating class R and period t given data as a continuous random variable ( ) subject to certain conditions. We later see that the marginal density function of rating classes subject to a set of given restrictions, is an expression without any closed form solution. Hence a simulation approach is needed to be adopted for obtaining an approximate solution. The theoretical framework for the entire process has been discussed in detail in the following sections.
The proposed methodology is modelled using S&P corporate default data and the results are presented in Section 3.3. The results are then compared to the outputs from other well-known approaches, which have been provided in Section 4.

Beta Binomial Distribution
The beta-binomial distribution is the binomial distribution in which the probability of success at each of n trials is not fixed but randomly drawn from a beta distribution. Binomial distribution is the distribution of the number of successes that occur in n independent trials with the probability of success in each trial is . If we consider n to be the number of performing entities at the beginning and the k denote the number of entities at the end who defaulted, then the distribution of number of defaults can be considered as a binomial distributed random variable with likelihood.
where is the true probability of occurrence of a default event of a single entity.
In the Bayesian framework, the parameter is assumed to have a probability distribution of its own called the prior. The suitable prior density for a binomial likelihood is a Beta-density.
Beta distribution as a prior has the advantage that it is a conjugate prior to (1) and, therefore, allow us effective and simple posterior mean estimation. Beta posterior mean can be regressed on macro-variables (Ferrari and Cribari-Neto (2004)), so the model can be used seamlessly for stress-testing purposes.

Conditional Posterior Density
Bayesian Statistics is derived from Bayes theorem that describes the probability of an event, based on prior knowledge of conditions that might be related to the event. Bayesian statistics has three key components: • A probability density called prior distribution ( ( )) shows the distribution of the parameter ( ) before observing the evidence or data.
• After observing data we update our beliefs about the parameter given the knowledge of the data and prior knowledge of and calculate the posterior distribution ( ( | )).
In our case, the likelihood is the binomial likelihood discussed before.
At the beginning, the parameter is assumed to be uniformly distributed from 0 to 1, which is chosen as the prior distribution. This specification treats the PD as being unknown and assumes an uninformed or objective prior distribution. Therefore, it is assumed that there is no knowledge of what the realised PD might be.
Hence, Posterior density of comes out to be, For a portfolio with m ratings, the joint density of ( 1 , 2 , … ) given the data is the product of each of its beta distribution density.

Calibration using Simulation
We know that the true value of the parameter follows the order We assume that the reason that the observed value of the parameter breaks the order due to data limitations discussed earlier. Hence, we aim to solve for each under the constraint given by equation.
The marginal distribution of can be obtained from the joint density function as follows, This expression has no bounded solution. Hence, one can use a Monte-Carlo simulation approach to estimate the conditional marginal distribution of ( ). Suppose { 1 ′ , 2 ′ , 3 ′ … ′ } is the set of N simulated random variables of from the conditional marginal distribution of ( ).
If we assume that | 1 ≤ 2 ≤ ⋯ ≤ ~( , ), then from the simulated numbers, method of moment matching can used to estimate the parameters ( , ) of the density function of each .
Let ̅ and ̅ be the mean and standard deviation of the simulated samples for each rating group i.
Using the technique of moment matching for beta distribution, we obtain that where (̂,̂) is the set of estimated parameters of the conditional marginal distribution ( | 1 ≤ 2 … ) from the simulated sample { ′ }. Appendix provides proof for the derivation of equations 11 and 12.
The calibrated probability of default for rating i can hence be estimated as the beta distribution mean For the purpose of simplicity and overcoming data challenges like lack of enough defaults in some rating grades, a binning process 2 was carried out where in adjacent ratings were clubbed together to form a new rating group with 9 ratings. For example, ratings BBB+, BBB and BBB-were merged to form a new group BBB. Also, Ratings C and D were considered to be the default bucket with rating order 9.
December snapshots for the years 2016 and 2017 was analysed for the modelling. A 12-month window was considered as an ideal observation window because banks and financial institutions are usually interested in measuring probability of default over a 1-year time horizon. For each snapshot period, the number of performing entities in the beginning and the number of default cases (from the performing entities) at the end of the 12 month window were measured for each rating class separately. See Table 2 for details of obligor and default counts measured for each year.

Sampling Algorithm
The sampling and calibration process is performed in an iterative and step by step manner. i.
Simulate n values of and +1 (using estimated posterior distribution given by equation 6) for ratings i and i+1.
For the filtered data, beta distribution parameters are estimated using moment matching technique, as explained earlier in section 2.3. iv.
Steps i to iii are continued till all the ratings are calibrated, with each step yielding new values for the beta distribution shape parameters. For each sampling process, updated beta distribution parameters from the previous sampling step is used.
The sampling processes 3 in steps i to iv is performed multiple times, to obtain a sampling distribution for each calibrated . Once we have the sampling distribution, we can calculate mean, median and confidence intervals for our estimate of .

Calibrated PD Output
Using the method of moment matching, Beta distribution parameters (̂,̂) are determined from the simulated random variables subject to given conditions explained earlier for each rating in each snapshot period. The estimated parameters for sample size n = 100,000 and n = 500,000 are as shown in Table 3 and Table 4, along with 90% confidence bounds.  The distribution of calibrated PDs for all the ratings from 1 to 8 for both the years have been provided in the Appendix B. It is interesting to note that for some ratings, the distribution shows gaussian-like densities while for some others, the distribution shows 2 or more peaks, indicating mixture of multiple gaussian-like densities.

Comparison with other methods
The results obtained was also compared with other popular calibration techniques in the industry.

CAP Curve Calibration or VDB Calibration suggested by Van der Burgt
In order to compare the models, all PD values were scaled to their corresponding year's central tendency or Portfolio average default rate. This is done so that the estimated PD at portfolio level is same across all the methods. Where ̅ is the scaled default rate and is the number of observations of rating i, respectively. is the portfolio default rate.
The values after scaling the PD values from each calibration technique, have been displayed in the Table 6 given below. From the table, we can observe a significant variation among the different methods in the worst rating grades. A visual comparison of PD trend can be observed from Figure 3 and Figure 4.  • It can be observed that QMM method provided significantly higher PD results in worse rating grades in both the years, while Pluto Tasche method generated slightly lower PDs when compared to all the others in the same range.
• It can also be observed that simulation-based results give satisfactorily close results irrespective of the number of simulations (n = 100,000 vs n = 500,000). Even in rating grade 8, where the separation is maximum, the difference between the two PDs is just 15.80%-15.71% = 0.09%. This is advantageous as we need not choose large sampling size for the simulation of results. But even with 100,000 simulations, the algorithm consumed significant amount of time. For higher precision results, more simulations may be required which may be limited by the computational power of the user's computer system.

Potential application -Regression with exogenous variables.
So far, we have only considered the case where estimations are carried out on historical one-year observation periods for which data is available. But in many occasions, we may be required to estimate PDs for different points in time when default data is either unavailable (such as years before the start of default information) or unobserved (such as future time periods). In order to build a PD term structure ( Φ( ) = 0 + 1 1 + 2 2 + ⋯ + Our goal here, is to propose a regression model that is tailored for situations where the dependent variable ( ) is measured continuously on the standard unit interval, i.e. 0 < < 1. Beta regression model is based on the assumption that the response is beta distributed. Since our estimated means are from calibrated beta distributions, the beta regression model fits perfectly into the PD modelling framework. Ferrari and Cribari-Neto (2004) first proposed the beta regression model for continuous variates that assume values in the standard unit interval, e.g., rates, proportions, or concentration indices. Hence, we do not present the methodology in full generality with example but rather introduce it as a concept.
Using the estimated values of Probability of Default ̂( ) for historical snapshot periods from the previous approach and exogenous predictor variables ( 1 ( ), 2 ( ) … ( )) we can train a model for beta regression parameters (̂0,̂1,̂2, … ,̂). The model can then be used to predict the value of mean * given new data point ( 1 * , 2 * , … , * ).
One main advantage of our proposed PD estimation method is that, since the default rate parameter , is assumed to be a beta random variable, it naturally incorporates into the beta regression framework. Another advantage is that since the historical PD values are already calibrated in the 1 st step, the estimated future PDs from regression model will also be calibrated in nature.

Conclusion
In this paper, we have presented a method for estimation and calibration of rating systems, which solves the issue of non-monotonicity which creeps in when default rates are empirically determined. The method introduced in the document is implemented by assuming that the default rate parameter is a random variable that follows Beta distribution. A simulation algorithm is designed to sample from the conditional distribution of default rate parameter for each rating. In this paper, the method is demonstrated for a portfolio of corporate entities rated by Standard and Poor's credit rating agency and the results obtained have been observed to be comparable to that of other popular calibration methods that are widely used.
One advantage of this method is that it is conceptually simple and straight forward and has minimum number of assumptions. The simulation algorithm is also simple and easy to implement using a statistical software. The results can be scaled to any appropriate central tendency. It has also been elucidated, how this method can be used for estimating probability of default for future point in times and how it integrates well with a Beta regression framework.
Although this approach is simple and straightforward, one drawback is that the process consumes significant amount of time. For higher precision and for large number of ratings, more simulations may be required which may be limited by the computational power of the user's computer system. Further researches need to be conducted on how to improve the framework by using faster sampling with improved accuracy of the PD estimates.