Project Description
Our Stata | Mata code implements the Merton distance to default or Merton DD model using the iterative process used by Crosbie and Bohn (2003), Vassalou and Xing (2004), and Bharath and Shumway (2008). Specifically, our code implements the model in the following steps:
1.Generate log returns from stock prices
2. Find volatility for each stock in each year from the daily stock returns and convert it to yearly volatility
3. Use the above stock volatility as a proxy for asset volatility in the first iteration and use the following equation to infer the firm value.

where E is the market value of the firm’s equity, F is the face value of the firm’s debt, r is the risk-free rate, N(.) is the cumulative standard normal distribution function and d1 and d2 are equal to
4. Step 3 is repeated for each observation while using the volatility values of a given firm in a given year. This way the firm values are generated daily. Also note, that we have to find the root for the firm value in Equation 1. For finding the root, we set the iteration limit at 1000.
5. Once the implied firm values are generated, log returns are re-calculated from these values.
6. Daily volatility from the log returns is re-calculated for each firm-year combinations and converted into yearly volatility.
7. The new volatility values are plugged again in Equation 1 to infer firm values.
8. The process is iterated (up to 500 times) until the new volatility value is converged to the previous volatility.
9. After convergence, the firm and volatility values from the last successful iteration are then used to derive the probability of default using the following equation

Accuracy of the Code
The code has been tested with actual and dummy data. The code produces expected results and matches the benchmarks created for it in the dummy data construction.
Pricing
The code is available available for $139, plus a $50 for raw data processing (in case the data is not in Stata format and variables are not already constructed). For further details, please contact us at:
attaullah.shah@imsciences.edu.pk
References
Bharath, S. T., & Shumway, T. (2008). Forecasting default with the Merton distance to default model. The Review of Financial Studies, 21(3), 1339-1369.
Crosbie, P., & Bohn, J. (2003). Modeling Default Risk: Modeling Methodology, Moody’s KMV Company. available at http:\\www.moodyskmv.com.
Merton, R. C. (1974). On the pricing of corporate debt: The risk structure of interest rates. The Journal of finance, 29(2), 449-470.
Vassalou, M., & Xing, Y. (2004). Default risk in equity returns. The journal of finance, 59(2), 831-868.
See our full list of completed projects
I have several questions regarding to the code.
1. is there any published paper using this code to estimate the Distance to default? Please list some of them.
2. Does the code estimate the naive distance to default or modified one?
3. What the input from WRDS I should access to estimate the US public firms?
Many thanks!
Eric
Eric Won
Thanks for stopping by and posting your comments. So far more than 5 clients have purchased and used this code. I am not aware of any paper using it. However, the code is reliable as it can be easily tested against benchmarks. One benchmark that I have used for testing this code is the example on Page 250 of the book PROFESSIONAL FINANCIAL COMPUTING USING EXCEL AND VBA
The code requires the following variables:
Daily share price (prc)
Shares outstanding (shout)
total liabilities
risk-free rate
Equity