survprobs
Description
computes the survival probability based on the default probability curve object. outSurvProbs
= survprobs(obj
,inDates
)
Examples
Calculate Survival Probability Based on Default Probability Curve
Create a defprobcurve
object using defprobcurve
and then use survprobs
to calculate the survival probability.
Settle = datetime(2017,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]';
DefProbDates = Settle + DefProbTimes;
DefaultProbCurve = defprobcurve(Settle,DefProbDates,DefaultProbabilities,'Basis',5)
DefaultProbCurve = defprobcurve with properties: Settle: 20-Sep-2017 Basis: 5 Dates: [10x1 datetime] DefaultProbabilities: [10x1 double]
SurvProbTimes = [calmonths([6 12 18])]; SurvProbDates = Settle + SurvProbTimes; outSurvProb = survprobs(DefaultProbCurve, SurvProbDates)
outSurvProb = 3×1
0.9950
0.9930
0.9915
Input Arguments
obj
— defprobcurve
object
defprobcurve
object
defprobcurve
object, specified as a previously created defprobcurve
object.
Data Types: object
inDates
— Survival probability dates
datetime array | string array | date character vector
Survival probability dates, specified as a vector using a datetime array, string array, or date character vectors.
To support existing code, survprobs
also
accepts serial date numbers as inputs, but they are not recommended.
Output Arguments
outSurvProbs
— Survival probability
numeric
Survival probability, returned as a numeric.
Version History
Introduced in R2020aR2022b: Serial date numbers not recommended
Although survprobs
supports serial date numbers,
datetime
values are recommended instead. The
datetime
data type provides flexible date and time
formats, storage out to nanosecond precision, and properties to account for time
zones and daylight saving time.
To convert serial date numbers or text to datetime
values, use the datetime
function. For example:
t = datetime(738427.656845093,"ConvertFrom","datenum"); y = year(t)
y = 2021
There are no plans to remove support for serial date number inputs.
Beispiel öffnen
Sie haben eine geänderte Version dieses Beispiels. Möchten Sie dieses Beispiel mit Ihren Änderungen öffnen?
MATLAB-Befehl
Sie haben auf einen Link geklickt, der diesem MATLAB-Befehl entspricht:
Führen Sie den Befehl durch Eingabe in das MATLAB-Befehlsfenster aus. Webbrowser unterstützen keine MATLAB-Befehle.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)