Why does my code return the wrong Expected Default Frequency?

2 Ansichten (letzte 30 Tage)
Bernard
Bernard am 2 Sep. 2012
I am attempting to calculate the one year EDF of a firm using the iterative method of Bharath and Shumway (2008). When I calculate an answer I get an EDF of 0.98 (I know that the firm in question has an EDF of ~ 0.30. What am I doing wrong?
Here's the code I have written:
%loads test datafile with equity and debt values in it
load test_dd.mat
%The risk free rate
Rf = 0.03;
T = 1;
%volatility of equity from time series of market cap data(Value_equity)
Log_returns_equity = zeros(length(Value_equity),1);
for i=1:length(Value_equity)-1
Log_returns_equity(i+1,1) = log(Value_equity(i+1)/Value_equity(i));
end
standard_dev_equity = std(Log_returns_equity(end-364:end,1));
volatility_equity = standard_dev_equity*sqrt(365);
%Initial estimate of volatility_v using the last data observations.
Volatility_v = volatility_equity*((Face_value_debt(end,1)/(Value_equity(end,1)+Face_value_debt(end,1))));
% loop will solve for v_firm each day. Then caclulate the volatility_v. Iteration occurs until the starting volatitliy_v equals the volatility calculated from the returns of v_firm
V_firm_years = zeros(365,1);
End_Volatility_v = 0;
counter = 0;
%loops until convergence
while abs(Volatility_v-End_Volatility_v)>0.001
counter = counter+1;
%leaves volatlity_v unchanged for initial loop
if counter>1
Volatility_v = End_Volatility_v;
end
row_counter = 0;
%For last 365 days of data, solve for value of vfirm using fzero
for i=(length(Value_equity)-364):(length(Value_equity))
% Initial guess at V_firm
guess = 5000000;
%solve for Vfirm at each day over last year, usingfunction solveMerton(see second section of code)
f=@(z)solveMerton(Volatility_v,Face_value_debt(i,1),Value_equity(i,1),Rf,T,z);
V_firm= fzero(f,guess);
%write v_firm estimate to matrix
row_counter = row_counter+1;
V_firm_years(row_counter,1) = V_firm;
end
%calculate returns over the last year based on the values of V_firm
Log_V_returns =zeros(365,1);
for i=1:365-1 %Calculates the log returns
Log_V_returns(i+1,1) = log(V_firm_years(i+1)/V_firm_years(i));
end
%calculate volatility of v based on this series of returns
standard_dev =std(Log_V_returns);
End_Volatility_v = standard_dev*sqrt(365);
end
%Once convergence occurs, Volatility_V set equal to volatiltiy from last iteration
Volatility_v = End_Volatility_v;
%Calculates Mu
mu = mean(Log_V_returns(end-364:end,1));
%calculates the distance to default
dd = (log(V_firm_years(end)/Face_value_debt(end))+(mu-0.5*Volatility_v^2)*T)/Volatility_v;
%calculates the EDF
EDF = normcdf(-dd)
The function which is called to actually solve the Black-Scholes-Merton for v_firm in each iteration is below:
function Y= solveMerton(Volatility_v,Face_value_debt,Value_equity,Rf,T,z)
V_firm = z;
%Black-Scholes-Merton model
d1 =(log(V_firm/Face_value_debt) + (Rf + 0.5*Volatility_v^2)*T)/(Volatility_v*sqrt(T));
d2 = d1 - (Volatility_v*sqrt(T));
N_d1 =normcdf(d1);
N_d2 =normcdf(d2);
%set equal to zero in order to solve
Y =(V_firm*N_d1)-(exp(-Rf*T)*Face_value_debt*N_d2)-Value_equity;
end
The test datafile that I have used is available from: https://www.dropbox.com/s/pz1shbryt4c1wrl/test_data.mat
Source of method: Bharath, Sreedhar T., and Tyler Shumway. 2008. “Forecasting Default with the Merton Distance to Default Model.” Review of Financial Studies 21 (3): 1339–69.

Antworten (1)

Alberto
Alberto am 10 Jul. 2013
I am trying through the use of the Merton model to recover some default probability of some US firms to investigate about the moral hazard of the CRAs. I have built my personal merton model but it do not work. I have seen that you upload your merton model but I do not understand when you write standard_dev_equity = std(Log_returns_equity(end-364:end,1));.IN PARTICULAR THE PART end-364:end,1. My datas are a matrix of equity with dimensions 263 (trading days)*120(firms) and a vector of debt with dimensions (1*120). I will really appreciate if you can explain this part of your model

Kategorien

Mehr zu Descriptive Statistics and Visualization finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by