Workflow for Creating and Analyzing a defprobcurve
This example shows how to create and analyze a defprobcurve
object.
You can use defprobcurve
or defprobstrip
to create a defprobcurve
object.
% defprobcurve
Settle = datetime(2019,9,20);
DefProbTimes = [calmonths(6) calyears([1 2 3 4 5 7 10 20 30])];
DefaultProbabilities = [0.005 0.007 0.01 0.015 0.026 0.04 0.077 0.093 0.15 0.20]';
ProbDates = Settle + DefProbTimes;
DefaultProbCurve = defprobcurve(Settle,ProbDates,DefaultProbabilities)
DefaultProbCurve = defprobcurve with properties: Settle: 20-Sep-2019 Basis: 2 Dates: [10×1 datetime] DefaultProbabilities: [10×1 double]
You can then use the defprobcurve
object with survprobs
and hazardrates
.
% hazardrates
hazardrates(DefaultProbCurve)
ans = 10×1
0.0099
0.0039
0.0030
0.0050
0.0111
0.0142
0.0194
0.0057
0.0064
0.0060
% survprobs
Settle = datetime(2019,9,20);
SurvProbTimes = [calmonths([6 12 18])];
SurvProbDates = Settle + SurvProbTimes;
outSurvProb = survprobs(DefaultProbCurve, SurvProbDates)
outSurvProb = 3×1
0.9950
0.9930
0.9915
See Also
fininstrument
| finmodel
| finpricer