Main Content

Probit

Create Probit model object for lifetime probability of default

Description

Create and analyze a Probit model object to calculate lifetime probability of default (PD) using this workflow:

  1. Use fitLifetimePDModel to create a Probit model object.

  2. Use predict to predict the conditional PD and predictLifetime to predict the lifetime PD.

  3. Use modelDiscrimination to return AUROC and ROC data.

  4. Use modelAccuracy to return the RMSE of observed and predicted PD data.

Creation

Description

ProbitPDModel = fitLifetimePDModel(data,ModelType) creates a Probit PD model object and sets the data and ModelType properties.

If you do not specify variable information for IDVar, AgeVar, LoanVars, MacroVars, and ResponseVar, then:

  • IDVar is set to the first column in the data input.

  • LoanVars is set to include all columns from the second to the second-to-last columns of the data input.

  • ResponseVar is set to the last column in the data input.

ProbitPDModel = fitLifetimePDModel(___,Name,Value) specifies options using one or more name-value pair arguments in addition to the input arguments in the previous syntax. The optional name-value pair arguments set the model object properties. For example, ProbitPDModel = fitLifetimePDModel(data(TrainDataInd,:),"Probit",'ModelID',"Probit_A",'Descripion',"Probit_model",'AgeVar',"YOB",'IDVar',"ID",'LoanVars',"ScoreGroup','MacroVars',{'GDP','Market'},'ResponseVar',"Default") creates a Probit model object.

Input Arguments

expand all

Data, specified as a table where the first column is IDVar, the last column is the ResponseVar, and all other columns are LoanVars.

Data Types: char | string

Model type, specified as a string with the value "Probit" or a character vector with the value 'Probit'.

Data Types: char | string

Probit Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside quotes. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Example: ProbitPDModel = fitLifetimePDModel(data(TrainDataInd,:),"Probit",'ModelID',"Probit_A",'Descripion',"Probit_model",'AgeVar',"YOB",'IDVar',"ID",'LoanVars',"ScoreGroup','MacroVars',{'GDP','Market'},'ResponseVar',"Default")

User-defined model ID, specified as the comma-separated pair consisting of 'ModelID' and a string or character vector.

Data Types: string | char

User-defined description for model, specified as the comma-separated pair consisting of 'Description' and a string or character vector.

Data Types: string | char

ID variable indicating which column in data contains the loan or borrower ID, specified as the comma-separated pair consisting of 'IDVar' and a string or character vector.

Data Types: string | char

Age variable indicating which column in data contains the loan age information, specified as the comma-separated pair consisting of 'AgeVar' and a string or character vector.

Data Types: string | char

Loan variables indicating which column in data contains the loan-specific information, such as origination score or loan-to-value ratio, specified as the comma-separated pair consisting of 'LoanVars' and a string array or cell array of character vectors.

Data Types: string | cell

Macro variables indicating which column in data contains the macroeconomic information, such as gross domestic product (GDP) growth or unemployment rate, specified as the comma-separated pair consisting of 'MacroVars' and a string array or cell array of character vectors.

Data Types: string | cell

Variable indicating which column in data contains the response variable, specified as the comma-separated pair consisting of 'ResponseVar' and a string or character vector.

Note

The response variable in the data must be a binary variable with 0 or 1 values, with 1 indicating default.

Data Types: logical

Properties

expand all

User-defined model ID, returned as a string.

Data Types: string

User-defined description, returned as a string.

Data Types: string

Model, returned as a vector.

Data Types: string

ID variable indicating which column in data contains the loan or borrower ID, returned as a string.

Data Types: string

Age variable indicating which column in data contains the loan age information, returned as a string.

Data Types: string

Loan variables indicating which column in data contains the loan-specific information, returned as a string array.

Data Types: string

Macro variables indicating which column in data contains the macroeconomic information, returned as a string array.

Data Types: string

Variable indicating which column in data contains the response variable, returned as a logical 0 or 1.

Data Types: logical

Object Functions

predictCompute conditional PD
predictLifetimeCompute cumulative lifetime PD, marginal PD, and survival probability
modelDiscriminationCompute AUROC and ROC data
modelAccuracyCompute RMSE of predicted and observed PDs on grouped data

Examples

collapse all

This example shows how to use fitLifetimePDModel to create a Probit model using credit and macroeconomic data.

Load Data

Load the credit portfolio data.

load RetailCreditPanelData.mat
disp(head(data))
    ID    ScoreGroup    YOB    Default    Year
    __    __________    ___    _______    ____

    1      Low Risk      1        0       1997
    1      Low Risk      2        0       1998
    1      Low Risk      3        0       1999
    1      Low Risk      4        0       2000
    1      Low Risk      5        0       2001
    1      Low Risk      6        0       2002
    1      Low Risk      7        0       2003
    1      Low Risk      8        0       2004
disp(head(dataMacro))
    Year     GDP     Market
    ____    _____    ______

    1997     2.72      7.61
    1998     3.57     26.24
    1999     2.86      18.1
    2000     2.43      3.19
    2001     1.26    -10.51
    2002    -0.59    -22.95
    2003     0.63      2.78
    2004     1.85      9.48

Join the two data components into a single data set.

data = join(data,dataMacro);
disp(head(data))
    ID    ScoreGroup    YOB    Default    Year     GDP     Market
    __    __________    ___    _______    ____    _____    ______

    1      Low Risk      1        0       1997     2.72      7.61
    1      Low Risk      2        0       1998     3.57     26.24
    1      Low Risk      3        0       1999     2.86      18.1
    1      Low Risk      4        0       2000     2.43      3.19
    1      Low Risk      5        0       2001     1.26    -10.51
    1      Low Risk      6        0       2002    -0.59    -22.95
    1      Low Risk      7        0       2003     0.63      2.78
    1      Low Risk      8        0       2004     1.85      9.48

Partition Data

Separate the data into training and test partitions.

nIDs = max(data.ID);
uniqueIDs = unique(data.ID);

rng('default'); % for reproducibility
c = cvpartition(nIDs,'HoldOut',0.4);

TrainIDInd = training(c);
% TestIDInd = test(c);

TrainDataInd = ismember(data.ID,uniqueIDs(TrainIDInd));
% TestDataInd = ismember(data.ID,uniqueIDs(TestIDInd));

Create a Probit Lifetime PD Model

Use fitLifetimePDModel to create a Probit model using the training data.

pdModel = fitLifetimePDModel(data(TrainDataInd,:),"Probit",...
    'AgeVar','YOB',...
    'IDVar','ID',...
    'LoanVars','ScoreGroup',...
    'MacroVars',{'GDP','Market'},...
    'ResponseVar','Default');
disp(pdModel)
  Probit with properties:

        ModelID: "Probit"
    Description: ""
          Model: [1x1 classreg.regr.CompactGeneralizedLinearModel]
          IDVar: "ID"
         AgeVar: "YOB"
       LoanVars: "ScoreGroup"
      MacroVars: ["GDP"    "Market"]
    ResponseVar: "Default"

Display the underlying model.

disp(pdModel.Model)
Compact generalized linear regression model:
    probit(Default) ~ 1 + ScoreGroup + YOB + GDP + Market
    Distribution = Binomial

Estimated Coefficients:
                               Estimate        SE         tStat       pValue   
                              __________    _________    _______    ___________

    (Intercept)                  -1.6267      0.03811    -42.685              0
    ScoreGroup_Medium Risk      -0.26542      0.01419    -18.704     4.5503e-78
    ScoreGroup_Low Risk         -0.46794     0.016364    -28.595     7.775e-180
    YOB                         -0.11421    0.0049724    -22.969    9.6208e-117
    GDP                        -0.041537     0.014807    -2.8052      0.0050291
    Market                    -0.0029609    0.0010618    -2.7885      0.0052954


388097 observations, 388091 error degrees of freedom
Dispersion: 1
Chi^2-statistic vs. constant model: 1.85e+03, p-value = 0

References

[1] Baesens, Bart, Daniel Roesch, and Harald Scheule. Credit Risk Analytics: Measurement Techniques, Applications, and Examples in SAS. Wiley, 2016.

[2] Bellini, Tiziano. IFRS 9 and CECL Credit Risk Modelling and Validation: A Practical Guide with Examples Worked in R and SAS. San Diego, CA: Elsevier, 2019.

[3] Breeden, Joseph. Living with CECL: The Modeling Dictionary. Santa Fe, NM: Prescient Models LLC, 2018.

Introduced in R2020b