Distance to Default and Probability of Default
Installing the Packages
Install the required packages that are important to run the code. The following code reads the list of packages from the ``packages” list provided. If the package is not installed, then it installs, and if already installed then it uses it directly.
if (!require(pacman)) install.packages("pacman")## Loading required package: pacman
pacman::p_load(nleqslv,rootSolve,CreditRisk,DtD,utils,ITNr,RColorBrewer,scales,graphsim,igraph,readxl,plyr,quantreg,bayesQR, spatstat,ggplot2,ggpubr, gtools, car, devtools,statar,reshape2,MASS,dynpanel,plm,dummies,ggridges,ggthemes)Distance to Default
This measure is based on the ability of the firm to pay its obligations and debts. Similar to options, when firms value falls below the debt level, then the firm is declared bankrupt (a legal term). Let \(V_A(t)\) be the value of assets at time \(t\), \(V_E(t)\) is the value of equity at time \(t\), \(\sigma_A\) is the volatility of the assets, \(\sigma_E\) is volatility of equity, \(r_f\) is risk-free interest rate, and \(D\) is debt level defined by short-term debts + 0.5 long-term debts. Notice that \((V_E,\sigma_E)\) are observable in the equity market, whereas \((V_A, \sigma_A)\) is unobservable. Therefore, based on the Black-Scholes-Merton formula, the following simultaneous equation needs to be solved to obtain \((V_A, \sigma_A)\) for a future debt maturity time \(T\).
\[\begin{aligned} V_E(t)=V_A(t)N(d_+) -r_fDN(d_-) \\ \sigma_E=\sigma_A \frac{V_A(t)}{V_E(t)}N(d_+)\end{aligned}\]
where \(N(.)\) is standard normal cumulative distribution function and \[d_{\pm}=\frac{\ln (\frac{e^{r_f(T-t)}V_A(t)}{D})\pm \frac{1}{2}\sigma_A^2(T-t)}{\sigma_A \sqrt{T-t}}\] Now the distance to default (DD) is defined by \[\begin{aligned} DD &=\frac{\ln V_A(T) - \ln D}{\sigma_A} \\ & =\frac{\ln (e^{r_f(T-t)}V_A(t)) - \frac{1}{2}\sigma_A^2(T-t)- \ln D}{\sigma_A} \\ & =d_- \end{aligned}\] And the probability of default (PD) is defined by \[\text{Probability of Default (PD)}=P(V_A < D)=N(-DD)\] For a bank , the distance to default is known as the distance to capital (DC), defined by
\[DC=\frac{\ln (e^{r_f(T-t)}V_A(t)) - \frac{1}{2}\sigma_A^2(T-t)- \ln\lambda D}{\sigma_A} \ \ , \ \ \lambda=\frac{1}{1-\kappa}\] where \(\kappa\) is the capital is the capital requirement by the regulator.
Inputs
VE=Value of Equity
SE=standard deviation of stock returns
r=risk-free rate
t=time to maturirty / time horizon
D= short-term + ½long-term debts
DTD=function(VE, SE, r, t, D){
f <- function (x) {
VA = x [1]
SA = x [2]
d1 = (log(VA/D) + (r - SA^2/2)*t) /(SA*sqrt(t))
d2 = d1 + SA* sqrt (t)
e1 = VE - (VA* pnorm (d2) - exp( -r*t) *D* pnorm (d1) )
e2 = SE * VE - pnorm (d2) *SA*VA
return (e1^2 + e2^2)
}
sl=nlminb(c(VE,SE), f, lower =c(0 , 0) , upper =c(100000000,100))$par
sl
VA = sl[1] # value of assets
SA = sl[2] # volatility of assets
VA;SA
# calculate probability of default & recovery rate
market_val = VA - VE
payment = D * exp(-r * t)
d1 = (log(VA/D) + (r - SA^2/2)*t) /(SA*sqrt(t))
PD = pnorm(-d1)
Result=c(VA, SA, d1, PD)
message("Value of Assets =", VA)
message("Standard deviation of Assets=", SA)
message("Distance to default=", d1)
message("Probability of default=", PD)
}
#DTD=function(VE, SE, r, t, D)
DTD(10, 1.3, 5, 1, 3000)## Value of Assets =27.6220350232929
## Standard deviation of Assets=0.592102262212212
## Distance to default=0.231300775619051
## Probability of default=0.408540572082522