主要内容

risk.validation.herfindahlIndexTest

Herfindahl index test

Since R2026a

    Description

    hHITest = risk.validation.herfindahlIndexTest(BaselineFrequency,TargetFrequency) returns the result of a Herfindahl index (HI) test, which compares the dispersion of the frequencies in a baseline and target portfolio. The output is 1 if the test rejects the null hypothesis at the 95% confidence level, or 0 otherwise.

    hHITest = risk.validation.herfindahlIndexTest(BaselineFrequency,TargetFrequency,ConfidenceLevel=confidenceLevel) specifies the confidence level for the HI test.

    [hHITest,Output] = risk.validation.herfindahlIndexTest(___) also returns a structure Output that contains summary metrics.

    example

    Examples

    collapse all

    Perform a Herfindahl index (HI) test on rating grade data to determine whether the HI for a baseline portfolio is larger than the HI for a target portfolio. The PDRatingGradeData file contains a table with variables that include RatingGrade and ObservationYear. These variables, respectively, contain data for customer rating grades and the observation year.

    Load the data.

    data = readtable("PDRatingGradeData.csv")
    pdData=500×4 table
        0.4074     9    2020    0
        0.4529    10    2020    0
        0.0635     2    2020    0
        0.4567    10    2020    1
        0.3162     7    2020    0
        0.0488     1    2020    0
        0.1392     3    2020    0
        0.2734     6    2020    0
        0.4788    10    2020    0
        0.4824    10    2020    0
        0.0788     2    2020    0
        0.4853    10    2020    0
        0.4786    10    2020    0
        0.2427     5    2020    0
          ⋮
    
    

    Use the groupcounts function to get counts for each rating grade in years 2023 and 2024.

    idx23 = data.ObservationYear==2023;
    idx24 = data.ObservationYear==2024; 
    Frequencies1 = groupcounts(data(idx23,:),"RatingGrade");
    Frequencies2 = groupcounts(data(idx24,:),"RatingGrade");

    Frequencies1 contains the baseline portfolio frequency data for 10 rating grades. Frequencies2 contains data for the target portfolio. Each column represents a rating grade.

    Perform a Herfindahl index (HI) test to test the null hypothesis that the HI for the baseline portfolio is larger than the HI for the target portfolio.

    risk.validation.herfindahlIndexTest(Frequencies1.GroupCount,Frequencies2.GroupCount)
    ans = logical
       1
    
    

    The output indicates that enough evidence exists to reject the null hypothesis.

    Input Arguments

    collapse all

    Baseline portfolio frequencies, specified as a numeric vector. For probability of default models, BaselineFrequency often contains frequencies or dollar exposures for each rating grade.

    The baseline frequencies are sometimes called the initial frequencies.

    Data Types: single | double

    Target portfolio frequencies, specified as a numeric vector. For probability of default models, TargetFrequency often contains frequencies or dollar exposures for each rating grade.

    The target frequencies are sometimes called the current frequencies.

    Data Types: single | double

    Confidence level of the hypothesis test, specified as a numeric scalar in the range (0,1).

    Output Arguments

    collapse all

    Hypothesis test results, returned as a numeric scalar.

    • A value of 1 rejects the null hypothesis at the specified confidence level.

    • A value of 0 fails to reject the null hypothesis at the specified confidence level.

    Output metrics, returned as a structure with the following fields:

    • RejectTest — Numeric scalar indicating whether the null hypothesis was rejected. This field represents the same values as hHITest.

    • PValuep-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 — Minimum value of the test statistic at which the test rejects the null hypothesis for the given probability and confidence level, returned as a numeric scalar.

    • BaselineCoefficientOfVariation — Coefficient of variation for the baseline portfolio, returned as a numeric scalar.

    • BaselineHerfindahlIndex — Herfindahl index for the baseline portfolio, returned as a numeric scalar.

    • TargetCoefficientOfVariation — Coefficient of variation for the target portfolio, returned as a numeric scalar.

    • TargetHerfindahlIndex — Herfindahl index for the target portfolio, returned as a numeric scalar.

    • ConfidenceLevel — Confidence level for the hypothesis test, returned as a numeric scalar.

    For more information about the Herfindahl Index test and its corresponding statistics, see More About.

    More About

    collapse all

    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