资源简介

kmv merton probability of default

资源截图

代码片段和文件信息

function [N1TVSG]=KMV_MODEL(SEQFrTENDN)

%% Document title
% KMV-Merton model Probability of Default represented by  Jin-Chuan Duan Genevi‘eve Gauthier and
% Jean-Guy Simonato (2005)
% This code calculates the probability of default based on Moody抯 KMV
% where firms equity follows European call option.
%% Author
% Author : Haidar Haidar University of Sussex Email: h.haidar@sussex.ac.uk
% Date: 3rd - April - 2010 homepage: http://www.maths.sussex.ac.uk/~hh56

%% Reference:  
% 1) On the Equivalence of the KMV and Maximum Likelihood Methods for
%    Structural Credit Risk Models by Jin-Chuan Duan Genevi‘eve Gauthier and
%    Jean-Guy Simonato 2005

%% Inputs

% S  : Vector of Share prices as a time series starts with times t=123.
% EQ : Number of outstanding shares
% F  : Total Liabilities
% r  : free interest rate
% TEND : Time horizontal in years
% N : Number of time steps

%% Accuracy
% NR_Acc : The accuracy of Newton Raphson method
% Sig_Acc : The accuracy of Sigma

%% Example
% [N1TSG]=KMV_MODEL(cumprod(((rand(1100)-0.55)/10)+1)10.90.05550)

%% OutPut

% N1 : The Expected Probability of Default  
% TV : Time Horizontal for the correspoding probability of default
% SG : Asset Volatility

%% Code
%%%%%%%%%%%%
Sig_Acc=10^-7;
lm=length(S);
E=S*EQ;
% Scale the values
if E>1000
    E=E/10000;
    F=F/10000;
end

LS=log(S(2:end)./S(1:end-1));
h=length(E);
SGE=std(LS);
% SG : Asset Volatility to be computed here is given an initial value.
SG=SGE*(E(1)/(E(1)+F));

TV=TEND/N:TEND/N:TEND;
for jkk=1:N
%     i=1;
    % TM is the Asset Volatility at the previous iteration 
    % TM is initialized at the first step
    TM=100;
    while abs(SG-TM)>Sig_Acc
        for j=1:lm
            % V(j) is the asset value at time step j
            V(j)=NRMethod(FFE(j)rTV(jkk)SG);
        end
        % LR is the implied asset returns ( Log returns )
        LR=log(V(2:end)./V(1:end-1));
        R=mean(LR);
        TM=SG;
        SG=std(LR)*sqrt(h);
        % Mu is the expected return of the asset value
        Mu =h*R+0.5*SG^2;
%         i=i+1;
    end
    % SG % asset volatility
    d1=-(log(V(lm)/F(1))+(Mu -(0.5*SG^2))*TV(jkk))/(SG*sqrt(TV(jkk)));
    N1(jkk)=0.5*(1+erf(d1/sqrt(2)));
end

plot(TVN1‘b‘)
xlabel(‘Time Horizontal in Years‘)
ylabel(‘Expected Probability of Default‘)
return

% Date: 3rd - April - 2010
% Author : Haidar Haidar
% University of Sussex
% Email: h.haidar@sussex.ac.uk
% Newton Raphson method

function [S]=NRMethod(SEcrTsig)
NR_Acc=10^-7;
Tem=0;
k=1;
while abs(S-Tem)>NR_Acc
    d1=(log(S/E)+(r+(0.5*sig^2))*T)/(sig*sqrt(T));
    d2=d1-(sig*sqrt(T));
    f=c-S*0.5.*(1+erf(d1/sqrt(2)))+exp(-r*(T))*E*0.5*(1+erf(d2/sqrt(2)));
    df=-0.5.*(1+erf(d1/sqrt(2)));   % the derivative
    Tem=S;
    S=Tem-f/df;
    k=k+1;
end
return


 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2015-05-12 05:54  KMV_MODEL\
     文件        9161  2012-06-22 22:09  KMV_MODEL\KMV_MODEL.html
     文件        2922  2012-06-22 22:09  KMV_MODEL\KMV_MODEL.m
     文件        1313  2014-02-12 13:03  KMV_MODEL\license.txt
     文件        2861  2011-12-09 23:45  KMV_MODEL\PD.fig

评论

共有 条评论