Credit Scoring models often become inputs into regulatory and economic capital calculations such as the Basel 2 RWA formula. Probability of Default (PD), Exposure at Default (EAD) and Loss given default (LGD) models are all used for this purpose. One measure of loss, *Expected Loss*, is simply given by EL=PD*EAD*LGD. But this is not sufficient to work out how much capital a bank should hold as it does not account for the uncertainties of losses from year to year.

*Unexpected Loss* solves this problem by calculating the losses that might occur in some specified probability. In Basel 2 banks are require to hold sufficient capital to withstand a 1 in 1000 year loss event. The mathematics required to do this is more difficult than in the Expected Loss equation. Luckily for us, the BIS, specifies the formulae and parameters to use to calculate capital requirements and RWA. The Basel 2 RWA formula uses an extension of the Vasicek formula, named after its founder. It is a single factor model which assumes that the default rate of assets is correlated rather than being independent. The higher the asset correlation, the risker an asset is.

Note: Risk Weighted Assets are simply as their name implies. The bank's assets (loans) are weighted according to their riskiness. The amount of capital the bank is required to hold is a mulitple of the total risk weighted assets.

## Calculating Capital Requirement and Risk Weighted Assets for retail

The capital requirement, K, is calculated as

from which we can then derive the Risk Weighted Assets as RWA = K * 12.5 * EAD

where R=0.04 for Credit Cards which also known as Qualifying Revolving Retail Exposures (QRRE) and R=0.15 for Residential Mortgages. N() is the standard normal cumulative distribution and G() is its inverse.

## Calculating Capital Requirement and Risk Weighted Assets for Corporate Exposures

First the asset correlation is calculated,

Then a maturity adjustment parameter is calculated

The capital requirement K is calculated as

From this we can calculated the Risk Weighted Assets as before RWA = K * 12.5 * EAD

Note that the BIS requires a calibration factor of 1.06 to be multiplied by the RWA on top of the results of the above formulae.

## Further information on RWA and Regulatory Capital

Discussion of the various formulae can be found at the following websites

I have created an R function to produce the various outputs of the Basel II RWA formulae.

## R function to calculate RWA and K

Calculate Basel 2 Risk Weighted Assets (RWA) and other related measures Description: Calculate Risk Weighted Assets given PD, EAD, LGD and maturity according to the Basel 2 formula Usage: rwa(pd, ead, lgd, m, s, product, cf, corr) Arguments: PDÂ Â Â Â Â Long-run Probability of Default for the customer or account EADÂ Â Â Â Downturn Exposure at Default for the the customer or account LGDÂ Â Â Â Downturn Loss Given Default for the customer or account mÂ Â Â Â Â Â Maturity (in years) sÂ Â Â Â Â Â Exposure adjustment product One of "Corporate", "Mortgage", "QRRE", "Retail Other" cfÂ Â Â Â Â Confidence for the prediction. Default is set to 0.999 which corresponds to 1/1000 year event corrÂ Â Â Asset Correlation if you wish to override the Basel 2 calculated value Details: Calculate Risk Weighted Assets given PD, EAD, LGD and maturity according to the Basel 2 formula Value: A list is output containing the following: elÂ Â Â Â Â Â Â Â Â Expected Loss ulÂ Â Â Â Â Â Â Â Â Unexpected Loss pd.impliedÂ The pd implied by the Vasicek formula for the specified confidence kÂ Â Â Â Â Â Â Â Â Â Capital requirement factor reg.capÂ Â Â Â Capital requirement in dollars rwaÂ Â Â Â Â Â Â Â Risk weighted assets in dollars risk.weight Final risk weight Author(s): R Credit Scoring http://www.rcreditscoring.com References: http://www.rcreditscoring.com/basel-2-rwa-formula/ http://www.bis.org/bcbs/irbriskweight.pdf http://en.wikipedia.org/wiki/Advanced_IRB

rwa<-function(pd=0.02,ead=100,lgd=0.4,m=2,s=50,product="Corporate", cf=0.999, corr=NULL){ m.adj 50] s[s<5] exp.adj # Correlation r # Maturity adjustment b m.adj # Calculate k k } else if (product=="Mortgage"){ r } else if (product=="QRRE"){ r } else if (product=="Retail Other"){ r } # Override the correlation if specified by the user if (!is.null(corr)) { r } el pd.implied ul k reg.cap rwa risk.weight res return(res) }

## Examples

# Calculate RWA for various products rwa(pd=0.01, ead=100, lgd=0.2, product="Mortgage") rwa(pd=0.01, ead=100, lgd=0.8, product="QRRE") rwa(pd=0.01, ead=100, lgd=0.4, product="Retail Other") rwa(pd=0.02, ead=100, lgd=0.4, m=2, s=50, product="Corporate") # Plot rwa versus PD for mortgages y plot(x = seq(0.001, to=0.1, by=0.001), y = y[ , "rwa"], type="l", xlab="PD", ylab="RWA")

Thanks for the code, are you sure that the function is presented correctly in the code snippet window?

Kind regards