KMV model and default probability
//////////////////////////////////////
Objective: 
   1) Estimate market value and its volatility for KMV model
   2) estimate default point
   3) estimate default probability 

 KMV stands for Kealhofer, McQuown and Vasicek who found a company focusing 
    on measuring default risk. KMV methodology is one of the most important 
    methods to estimate the probability of default for a given company by 
    using its balance sheet information and the equity market information.  

 The objective here is to estimate the market value of total assets (A) and 
    its corresponding volatility (sigmaA). The result will be used to estimate 
    default distance and default probability. 

 The basic idea is to treat the equity of a firm as a call option and the debt is 
    its strike price. Let us look at the following simplest example. For a firm, 
    if its debt is $80 and equity is $20 then the total assets will be $100. 

 Assume that the assets jump to $110 and the debt remains the same, the equity 
    increases to $30. On the other hand, if the assets drop to $90, the equity 
    will be only $10. Since the equity holders are the residual claimer, their 
    value has the following expression. 

           E  = max?(assets - debt,0)=max?(A-D,0)          (1)

    Recall for a call option, we have the following payoff function. 

       Payoff(call) = max?(sT-K,0)                        (2)

   This means that we could treat equity as a call option with debt as 
      our exercise price.  With appropriate notations, we will have the 
      following formulae for a firm s equity. KMV model is defined below. 

             E=A*N(d1 )-e^(-rT) N(d2)

               ln?(A/D)+(r+0.5*sigma^2 )T
        d1 =   ---------------------------               (3)
                   sigmaA * sqrt(T)

        d2 =d1- sigmaA *sqrt(T)                         

  On the other hand, the following relationship between the volatilities 
     of the equity and the total assets holds. In the following equation, 
     we have  delta=dE/(dVA )=N(d1 ). 

         sigmaE=A/E
                       N(d1)*A*sigmaA
        delta_sigmaA=   -------------                    (4)
                           E
   Since d1 and d2 are defined by the above equations, we have two equations 
      for two unknown (A and sgimaA), see below. Thus, we could use a 
      trial-and-error or simultaneous equation method to solve for those 
     two unknowns.  Eventually, we want to solve the following two equations for A and s_A.

                 E=A*N(d1)-e^(-rT) *N(d2 )
                           A
                 sigmaE=  --- * N(d1)*siamgA             (5)
                           E
   We should pay attention that the estimated A (Market value of total assets) 
      from Equation (5) is different from the summation of market value of assets 
      plus the book value of the debt. The usages of those two derived values 
      (A and sigmaA) will be used by Equations (6-8). 

   Here is a KMV example: E=110,688 (shares outstanding*price of stock), 
      D=64,062 (total debt), Rf=0.07 (risk-free rate), T=1 (1 year).  
      The result is A=170,558 sA=0.29.  Based on the following codes 
      we got A=170,393 and sigmaE=0.2615. The output is : A=170,393.78 
      and sigmaE is 0.2615. Please pay attention that the summation of 
      the book value of debt and the market value of equity is 174,750 (?170,558). 

  Distance to Default
     Distance to default (DD) is defined by the following formula, where A 
     is the market value of the total assets and sigmaA  is its risk. 
     The interpretation of this measure is clear, the higher DD, the safer is the firm. 

               A - Default Point 
       DD= -----------------------                      (6)
                  A *sigmaA                              

  In terms of Default Point, there is no theoretical fixed default point. 
     However, we could use all short-term debts plus the half of long-term 
     debts as our default point.  After we have the values of MV of assets 
     and its volatility, we could use the following equation to estimate the 
     Distance to Default. The A and s_A are from the output from Equation (5). 
     On the other hand, if the default point equals to E, we would have the following formula. 

                  ln(VA/D)+(r-0.5*sigmaA^2)T
          DD= -  -------------------------------        (7)
                    sigmaA*sqrt(T) 				

    Note that there is a negative sign in front of the ratio
    According to Black-Scholes model, the relationship between DD and Default Probability
           is given below. 

        DP(Default Probability) = N(-DD)                (8)

//////////////////////////////////////