risk.validation.slotBacktest
Syntax
Description
returns the result of a slot backtest, which is a z-test that compares
the expected loss with the mean realized loss rate for a portfolio or a slot. The output is
hSlotTest = risk.validation.slotBacktest(NumDefaults,NumLoans,ObservedLGDRates,ExpectedLossRate)1 if the test rejects the null hypothesis at the 95%
confidence level, or 0 otherwise.
specifies the confidence level for the slot backtest.hSlotTest = risk.validation.slotBacktest(NumDefaults,NumLoans,ObservedLGDRates,ExpectedLossRate,ConfidenceLevel=confidenceLevel)
Examples
Perform a slot backtest to determine whether a portfolio's expected loss (EL) rate is greater than its mean realized loss rate for the year 2024. Use loss-given-default (LGD) data from the year 2024, and default data from the lookback period between years 2020 to 2024.
Load the portfolio LGD data.
LGDData = readtable("LGDRatingGradeData.csv");The LGDData table contains loss-given-default (LGD) data for the portfolio. Each row of LGDData corresponds to a defaulted loan whose recovery period closed in 2023 or 2024. The RealizedLGD and RecoveryClosedYear table variables contain the realized LGD and the year the recovery period was closed.
Create a table that contains only the data for the year 2024.
observationLGD = LGDData(LGDData.RecoveryClosedYear==2024,:);
Load the portfolio default data.
defaultData = readtable("PDRatingGradeData.csv");defaultData contains portfolio observations made in the lookback period between 2020 to 2024. The table variable Default indicates whether a loan defaulted in the year contained in ObservationYear. Each row of defaultData corresponds to a loan and observation year pair.
Use the groupsummary function to calculate the number of defaults in each observation year.
lookbackDefault = groupsummary(defaultData, "ObservationYear", "sum", "Default")
lookbackDefault=5×3 table
2020 100 22
2021 100 16
2022 100 37
2023 100 35
2024 100 40
lookbackDefault contains table variables ObservationYear, GroupCount, and sum_Default. For each year in ObservationYear, GroupCount and sum_Default, respectively, contain counts for the total number of loans and the number of defaulted loans in the portfolio.
Perform the hypothesis test using an EL rate of 0.177, the number of defaults and loans in lookbackDefault, and the realized LGDs in observationLGD. The EL rate is set by the portfolio's corresponding regulatory body.
expectedLossRate = 0.177; numDefaults = lookbackDefault.sum_Default; numLoans = lookbackDefault.GroupCount; observedLGDRates = observationLGD.RealizedLGD; [hTest,Output] = risk.validation.slotBacktest(numDefaults,numLoans,observedLGDRates,expectedLossRate)
hTest = logical
1
Output = struct with fields:
RejectTest: 1
PValue: 0.0028
TestStatistic: 2.7652
CriticalValue: 1.6449
MeanDefaultRate: 0.3000
MeanDefaultRateVariance: 4.2000e-04
MeanObservedLGDRate: 0.7638
MeanObservedLGDRateVariance: 0.0012
MeanLossRate: 0.2292
MeanLossRateVariance: 3.5570e-04
ExpectedLossRate: 0.1770
ConfidenceLevel: 0.9500
The output shows that enough evidence exists to reject the null hypothesis that the portfolio's EL is greater than its mean loss rate.
Input Arguments
Number of defaults for each year in the lookback period, specified as a vector of
nonnegative integers. NumDefaults has the same number of elements
as the number of years in the lookback period, and each element corresponds to a
particular year. For more information about the observation and lookback periods, see
More About.
To perform a slot backtest on the portfolio level, specify
NumDefaults as the number of defaults in the portfolio. To
perform a slot backtest on the slot level, specify NumDefaults as
the number of defaults in the slot.
Example: [22 16 45 30 28]
Data Types: single | double
Number of loans for each year in the lookback period, specified as a vector of
positive integers. NumLoans has the same number of elements as the
number of years in the lookback period, and each element corresponds to a particular
year. For more information about the observation and lookback periods, see More About.
To perform a slot backtest on the portfolio level, specify
NumLoans as the number of loans in the portfolio. To perform a
slot backtest on the slot level, specify NumLoans as the number of
loans in the slot.
Example: [98 107 115 113]
Data Types: single | double
Loss-given-default (LGD) rates for loans whose recovery period closed in the
observation period. ObservedLGDRates has the same number of
elements as the number of loans whose recovery periods were closed in the observation
period, and each element corresponds to a loan. For more information about the
observation year, see More About.
To perform a slot backtest on the portfolio level, specify
ObservedLGDRates as the number of loans in the portfolio whose
recovery period was closed in the observation period. To perform a slot backtest on the
slot level, specify NumLoans as the number of loans in the slot
whose recover period was closed in the observation period.
Example: [1.00 0.85 1.07 … 0.32 0.82 1.03]
Data Types: single | double
Expected loss (EL) rate, specified as a positive numeric scalar. You can use an EL rate set by the portfolio's regulatory body, or estimate it by using historical data and a formula that is relevant for your data.
Example: 0.177
Data Types: single | double
Confidence level of the hypothesis test, specified as a numeric scalar in the range (0,1).
Output Arguments
Hypothesis test result, returned as a numeric scalar.
A value of
1rejects the null hypothesis at the specified confidence level.A value of
0fails to reject the null hypothesis at the specified confidence level.
Output metrics, returned as a structure the following fields:
RejectTest— Numeric scalar indicating whether the null hypothesis was rejected. This field represents the same value ashSlotTest.PValue— p-value for the hypothesis test returned as a scalar in the range [0,1]. A small value indicates that the null hypothesis might not be valid.TestStatistic— Value of the test statistic for the hypothesis test, returned as a numeric scalar.CriticalValue— Critical value for the hypothesis test, returned as a numeric scalar.MeanDefaultRate— Mean default rate for the lookback period, returned as a numeric scalar.MeanDefaultRateVariance— Estimated variance forMeanDefaultRate.MeanObservedLGDRate— Mean LGD rate for the loans whose recovery period closed in the observation period, returned as a numeric scalar.MeanObservedLGDRateVariance— Estimated variance forMeanObservedLGDRate, returned as a numeric scalar.MeanLossRate— Mean loss rate, returned as a numeric scalar. The mean loss rate is the product ofMeanDefaultRateandMeanObservedLGDRate.MeanLossRateVariance— Estimated variance for the mean loss rate, returned as a numeric scalar.ExpectedLossRate— Expected loss rate, returned as a numeric scalar.ConfidenceLevel— Confidence level for the hypothesis test.
For more information about the slot backtest and its corresponding statistics, see More About.
More About
The slot backtest [1] is a one-sample z-test that requires you to input the number of defaults and loans, observed LGD rates, and expected loss (EL) rate for given observation and lookback periods. The null hypothesis for the slot backtest is that the EL rate is larger than the mean realized loss rate in the observation period. You can use an EL rate set by the portfolio's regulatory body, or estimate it using historical data and a formula that is relevant for your data. The lookback period is a period of time that begins before the start of the observation year and ends at the end of the observation year.
The test statistic for the slot backtest is
where μ1 is the mean default rate for the lookback period and μ2 is the mean realized loss rate for customers whose recovery periods closed in the observation period. EL is the expected loss rate and s is the standard deviation for the mean loss rate μ1μ2.
The p-value for Z is equal to , where F is the cumulative distribution function (CDF) for the standard normal distribution.
You can use risk.validation.slotBacktest to perform a slot backtest for an entire
portfolio or a slot by providing corresponding inputs. For more information about the slot
backtest, see Section 2.10.1 of [1].
References
[1] European Central Bank, “Instructions for reporting the validation results of internal models.” February, 2019. https://www.bankingsupervision.europa.eu/activities/internal_models/shared/pdf/instructions_validation_reporting_credit_risk.en.pdf.
Version History
Introduced in R2026a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- 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)