risk.validation.migrationMatrixStabilityTest
Syntax
Description
returns the migration matrix stability (MMS) test result hMMSTest = risk.validation.migrationMatrixStabilityTest(CountMatrix)hMMSTest for a
count matrix CountMatrix. The output is 1 if the
test rejects the null hypothesis at the 95% confidence level, or
0 if it does not reject the null hypothesis.
specifies the confidence level for the MMS test.hMMSTest = risk.validation.migrationMatrixStabilityTest(CountMatrix,ConfidenceLevel=confidenceLevel)
Examples
Perform a migration matrix stability test on the matrix Grades, which contains counts for probability of default (PD) grade migrations. The migration matrix stability test tests the null hypothesis that migration frequencies closer to the diagonal are greater than those further from the diagonal. The rows of Grades correspond to grades at the beginning of the observation period and the columns correspond to grades at the end.
Load the matrix.
load Grades.mat
GradesGrades = 14×15
1 11 21 31 41 51 61 71 81 91 101 111 121 131 141
89 120 81 14 0 0 0 0 0 0 0 0 0 0 0
24 81 114 81 15 0 0 0 0 0 0 0 0 0 0
2 19 75 132 69 21 4 1 0 0 0 0 0 0 0
0 0 19 89 100 66 32 1 0 0 0 0 0 0 0
0 0 1 18 83 114 74 18 4 0 0 0 0 0 0
0 0 0 4 27 61 107 73 13 0 0 0 0 0 0
0 0 0 0 0 15 62 105 68 16 2 0 0 0 0
0 0 0 0 0 1 10 84 102 75 14 1 0 0 0
0 0 0 0 0 0 4 13 57 127 68 32 1 0 0
0 0 0 0 0 0 0 1 14 85 122 83 26 0 0
0 0 0 0 0 0 0 0 1 16 71 103 80 16 3
0 1500 1400 1300 1200 1100 1000 900 800 700 600 500 400 300 200
0 0 0 0 0 0 0 0 0 0 2 14 67 114 106
⋮
The element at position (3,5), for example, indicates that 15 customers migrated from rating grade 3 to rating grade 5.
Perform an MMS test using the counts in Grades.
[hMMSTest,Output] = risk.validation.migrationMatrixStabilityTest(Grades)
hMMSTest = 14×14
NaN 1 1 0 0 0 0 0 0 0 0 0 0 0
0 NaN 0 0 0 NaN NaN NaN NaN NaN NaN NaN NaN NaN
0 0 NaN 0 0 0 NaN NaN NaN NaN NaN NaN NaN NaN
0 0 0 NaN 0 0 0 0 0 NaN NaN NaN NaN NaN
NaN 0 0 0 NaN 0 0 0 0 NaN NaN NaN NaN NaN
NaN 0 0 0 0 NaN 0 0 0 0 NaN NaN NaN NaN
NaN NaN 0 0 0 0 NaN 0 0 0 NaN NaN NaN NaN
NaN NaN NaN NaN 0 0 0 NaN 0 0 0 0 NaN NaN
NaN NaN NaN NaN 0 0 0 0 NaN 0 0 0 0 NaN
NaN NaN NaN NaN NaN 0 0 0 0 NaN 0 0 0 0
NaN NaN NaN NaN NaN NaN 0 0 0 0 NaN 0 0 0
NaN NaN NaN NaN NaN NaN NaN 0 0 0 0 NaN 0 0
0 1 1 1 1 1 1 1 1 1 1 1 NaN 0
NaN NaN NaN NaN NaN NaN NaN NaN NaN 0 0 0 0 NaN
⋮
Output = struct with fields:
RejectTest: [14×14 double]
PValueMatrix: [14×14 double]
TestStatisticMatrix: [14×14 double]
CriticalValue: -1.6449
MigrationMatrix: [14×15 double]
The matrix hMMSTest contains the results of the MMS test. Above the main diagonal, an value of 1 indicates enough evidence exists to reject the null hypothesis that the corresponding probability in the migration matrix is significantly smaller than the probability in the same row of the previous column. Below the main diagonal, a value of 1 indicates enough evidence exists to reject the null hypothesis that the corresponding probability in the migration matrix is significantly smaller than the probability in the same row of the following column. NaN entries indicate that the test statistic is NaN.
The Output structure contains values that the migrationMatrixTest function uses to perform the hypothesis test, including p-values, test statistics, and the migration matrix.
Display the migration matrix.
Output.MigrationMatrix
ans = 14×15
0.0009 0.0103 0.0197 0.0291 0.0385 0.0479 0.0573 0.0667 0.0761 0.0854 0.0948 0.1042 0.1136 0.1230 0.1324
0.2928 0.3947 0.2664 0.0461 0 0 0 0 0 0 0 0 0 0 0
0.0762 0.2571 0.3619 0.2571 0.0476 0 0 0 0 0 0 0 0 0 0
0.0062 0.0588 0.2322 0.4087 0.2136 0.0650 0.0124 0.0031 0 0 0 0 0 0 0
0 0 0.0619 0.2899 0.3257 0.2150 0.1042 0.0033 0 0 0 0 0 0 0
0 0 0.0032 0.0577 0.2660 0.3654 0.2372 0.0577 0.0128 0 0 0 0 0 0
0 0 0 0.0140 0.0947 0.2140 0.3754 0.2561 0.0456 0 0 0 0 0 0
0 0 0 0 0 0.0560 0.2313 0.3918 0.2537 0.0597 0.0075 0 0 0 0
0 0 0 0 0 0.0035 0.0348 0.2927 0.3554 0.2613 0.0488 0.0035 0 0 0
0 0 0 0 0 0 0.0132 0.0430 0.1887 0.4205 0.2252 0.1060 0.0033 0 0
0 0 0 0 0 0 0 0.0030 0.0423 0.2568 0.3686 0.2508 0.0785 0 0
0 0 0 0 0 0 0 0 0.0034 0.0552 0.2448 0.3552 0.2759 0.0552 0.0103
0 0.1261 0.1176 0.1092 0.1008 0.0924 0.0840 0.0756 0.0672 0.0588 0.0504 0.0420 0.0336 0.0252 0.0168
0 0 0 0 0 0 0 0 0 0 0.0066 0.0462 0.2211 0.3762 0.3498
⋮
The migration matrix contains probabilities for customer migration from one state to another. The software uses these probabilities to calculate the test statistics for the hypothesis tests. For more information about the MMS test, see More About.
Input Arguments
Count matrix, specified as a wide matrix of nonnegative values. The elements of the matrix are counts for rating grade migrations and status migrations. The rating grades and statuses can belong to any ordinal rating system. Examples of ordinal rating systems include credit rating grades, loss given default (LGD) rating grades, probability of default (PD) rating grades, and mortgage delinquency states.
The rows of CountMatrix correspond to the grade at the
beginning of the observation period and the columns correspond to the grade at the end.
In other words, the element at position i,j
represents the number of customers whose grade was i at the start of
the observation period and j at then end of the observation
period.
Data Types: single | double
Confidence level of the hypothesis test, specified as a numeric scalar in the range (0,1).
Output Arguments
Hypothesis test results, returned as a numeric matrix. Each element in
hMMSTest corresponds to the element in
CountMatrix at the same position.
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.A value of
NaNindicates that the corresponding test statistic isNaN.
Output metrics, returned as a structure the following fields:
RejectTest— Numeric matrix indicating whether each null hypothesis was rejected. Each element inRejectTestcorresponds to the element inCountMatrixat the same position. This field represents the same values ashMMSTest.PValueMatrix— p-values for the hypothesis tests returned as a matrix of values in the range [0,1]. Each element inpValuecorresponds to the element inCountMatrixat the same position. A small value indicates that the null hypothesis might not be valid.TestStatisticMatrix— Test statistic values for the hypothesis tests, returned as a numeric matrix. Each element inTestStatisticcorresponds to the element inCountMatrixat the same position.CriticalValue— Critical value for the hypothesis tests returned as a numeric scalar.MigrationMatrix— A numeric matrix containing migration probabilities. The element at position i,j is the probability of migrating from state i to state j.
The test statistic can be undefined for some values of i and
j. In this case, the software returns 0 in the
corresponding positions of hMMSTest and
RejectTest, and NaN in the corresponding positions
of PValue, TestStatistic, and
CriticalValueMatrix.
For more information about the MMS test and its corresponding statistics, see More About.
More About
The migration matrix stability test [1] tests the null hypothesis that migration frequencies closer to the diagonal are greater than those further from the diagonal.
For a model that uses K grades, the test statistic zi,j for an upper diagonal element is
where i<j≤K, pi,j is the migration frequency
of customers from state i to state j, and
Ni,j is the number of customers that migrated
from state i to state j. The test statistic for a
lower diagonal element is
where 1≤j<i. The corresponding p-values are equal to , where F is the cumulative distribution function (cdf) for the standard normal distribution.
For more information about the MMS test, see Section 2.5.5.2 in [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.
选择网站
选择网站以获取翻译的可用内容,以及查看当地活动和优惠。根据您的位置,我们建议您选择:。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- 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)