Main Content

risk.validation.herfindahlIndexTest

R2026b

Herfindahl index test

Since R2026a

    Description

    hHITest = risk.validation.herfindahlIndexTest(BaselineFrequency,TargetFrequency) returns the result of a Herfindahl index (HI) test, hHlTest, 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,HIOutput] = risk.validation.herfindahlIndexTest(___) also returns a structure HIOutput that contains summary metrics. Specify HIOutput as the second output argument with any of the input argument combinations in the previous syntaxes.

    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")
    data = 500×4 table
           PD       RatingGrade    ObservationYear    Default
        ________    ___________    _______________    _______
    
         0.40736         9              2020             0   
          0.4529        10              2020             0   
        0.063493         2              2020             0   
         0.45669        10              2020             1   
         0.31618         7              2020             0   
         0.04877         1              2020             0   
         0.13925         3              2020             0   
         0.27344         6              2020             0   
         0.47875        10              2020             0   
         0.48244        10              2020             0   
        0.078807         2              2020             0   
          0.4853        10              2020             0   
         0.47858        10              2020             0   
         0.24269         5              2020             0   
         0.40014         9              2020             0   
        0.070943         2              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 row 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 = 
    1
    

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

    Input Arguments

    collapse all

    Baseline portfolio frequencies, specified as a nonnegative 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.

    Target portfolio frequencies, specified as a nonnegative 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.

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

    Output Arguments

    collapse all

    Hypothesis test result, returned as a 1 or 0.

    • 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.

    • PValue — Numeric scalar with values in the range [0,1] representing the p-value for the hypothesis test. A small value indicates that the null hypothesis might not be valid.

    • TestStatistic — Numeric scalar representing the value of the test statistic for the hypothesis test.

    • CriticalValue — Numeric scalar representing the minimum value of the test statistic at which the test rejects the null hypothesis for the given probability and confidence level.

    • BaselineCoefficientOfVariation — Numeric scalar representing the coefficient of variation for the baseline portfolio.

    • BaselineHerfindahlIndex — Numeric scalar representing the Herfindahl index for the baseline portfolio.

    • TargetCoefficientOfVariation — Numeric scalar representing the coefficient of variation for the target portfolio.

    • TargetHerfindahlIndex — Numeric scalar representing the Herfindahl index for the target portfolio.

    • ConfidenceLevel — Numeric scalar representing the confidence level for the hypothesis test.

    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