Main Content

displaypoints

Return points per predictor per bin for a compactCreditScorecard object

Description

example

PointsInfo = displaypoints(csc) returns a table of points for all bins of all predictor variables used in the compactCreditScorecard object. The PointsInfo table displays information on the predictor name, bin labels, and the corresponding points per bin.

example

[PointsInfo,MinScore,MaxScore] = displaypoints(csc) returns a table of points for all bins of all predictor variables used in the compactCreditScorecard object. The PointsInfo table displays information on the predictor name, bin labels, and the corresponding points per bin and displaypoints. In addition, the optional MinScore and MaxScore values are returned.

example

[PointsInfo,MinScore,MaxScore] = displaypoints(___,Name,Value) specifies options using one or more name-value pair arguments in addition to the input arguments in the previous syntax.

Examples

collapse all

To create a compactCreditScorecard object, first create a creditscorecard object using the CreditCardData.mat file to load the data (using a dataset from Refaat 2011).

load CreditCardData.mat
sc = creditscorecard(data)
sc = 
  creditscorecard with properties:

                GoodLabel: 0
              ResponseVar: 'status'
               WeightsVar: ''
                 VarNames: {'CustID'  'CustAge'  'TmAtAddress'  'ResStatus'  'EmpStatus'  'CustIncome'  'TmWBank'  'OtherCC'  'AMBalance'  'UtilRate'  'status'}
        NumericPredictors: {'CustID'  'CustAge'  'TmAtAddress'  'CustIncome'  'TmWBank'  'AMBalance'  'UtilRate'}
    CategoricalPredictors: {'ResStatus'  'EmpStatus'  'OtherCC'}
           BinMissingData: 0
                    IDVar: ''
            PredictorVars: {'CustID'  'CustAge'  'TmAtAddress'  'ResStatus'  'EmpStatus'  'CustIncome'  'TmWBank'  'OtherCC'  'AMBalance'  'UtilRate'}
                     Data: [1200x11 table]

Before creating a compactCreditScorecard object, you must use autobinning and fitmodel with the creditscorecard object.

sc = autobinning(sc);
sc = fitmodel(sc);
1. Adding CustIncome, Deviance = 1490.8527, Chi2Stat = 32.588614, PValue = 1.1387992e-08
2. Adding TmWBank, Deviance = 1467.1415, Chi2Stat = 23.711203, PValue = 1.1192909e-06
3. Adding AMBalance, Deviance = 1455.5715, Chi2Stat = 11.569967, PValue = 0.00067025601
4. Adding EmpStatus, Deviance = 1447.3451, Chi2Stat = 8.2264038, PValue = 0.0041285257
5. Adding CustAge, Deviance = 1441.994, Chi2Stat = 5.3511754, PValue = 0.020708306
6. Adding ResStatus, Deviance = 1437.8756, Chi2Stat = 4.118404, PValue = 0.042419078
7. Adding OtherCC, Deviance = 1433.707, Chi2Stat = 4.1686018, PValue = 0.041179769

Generalized linear regression model:
    logit(status) ~ 1 + CustAge + ResStatus + EmpStatus + CustIncome + TmWBank + OtherCC + AMBalance
    Distribution = Binomial

Estimated Coefficients:
                   Estimate       SE       tStat       pValue  
                   ________    ________    ______    __________

    (Intercept)    0.70239     0.064001    10.975    5.0538e-28
    CustAge        0.60833      0.24932      2.44      0.014687
    ResStatus        1.377      0.65272    2.1097      0.034888
    EmpStatus      0.88565        0.293    3.0227     0.0025055
    CustIncome     0.70164      0.21844    3.2121     0.0013179
    TmWBank         1.1074      0.23271    4.7589    1.9464e-06
    OtherCC         1.0883      0.52912    2.0569      0.039696
    AMBalance        1.045      0.32214    3.2439     0.0011792


1200 observations, 1192 error degrees of freedom
Dispersion: 1
Chi^2-statistic vs. constant model: 89.7, p-value = 1.4e-16

Use the creditscorecard object with compactCreditScorecard to create a compactCreditScorecard object.

csc = compactCreditScorecard(sc)
csc = 
  compactCreditScorecard with properties:

              Description: ''
                GoodLabel: 0
              ResponseVar: 'status'
               WeightsVar: ''
        NumericPredictors: {'CustAge'  'CustIncome'  'TmWBank'  'AMBalance'}
    CategoricalPredictors: {'ResStatus'  'EmpStatus'  'OtherCC'}
            PredictorVars: {'CustAge'  'ResStatus'  'EmpStatus'  'CustIncome'  'TmWBank'  'OtherCC'  'AMBalance'}

Then use displaypoints with the compactCreditScorecard object to return a table of points for all bins of all predictor variables used in the compactCreditScorecard object.

[PointsInfo,MinScore,MaxScore] = displaypoints(csc)
PointsInfo=37×3 table
      Predictors            Bin            Points  
    ______________    ________________    _________

    {'CustAge'   }    {'[-Inf,33)'   }     -0.15894
    {'CustAge'   }    {'[33,37)'     }     -0.14036
    {'CustAge'   }    {'[37,40)'     }    -0.060323
    {'CustAge'   }    {'[40,46)'     }     0.046408
    {'CustAge'   }    {'[46,48)'     }      0.21445
    {'CustAge'   }    {'[48,58)'     }      0.23039
    {'CustAge'   }    {'[58,Inf]'    }        0.479
    {'CustAge'   }    {'<missing>'   }          NaN
    {'ResStatus' }    {'Tenant'      }    -0.031252
    {'ResStatus' }    {'Home Owner'  }      0.12696
    {'ResStatus' }    {'Other'       }      0.37641
    {'ResStatus' }    {'<missing>'   }          NaN
    {'EmpStatus' }    {'Unknown'     }    -0.076317
    {'EmpStatus' }    {'Employed'    }      0.31449
    {'EmpStatus' }    {'<missing>'   }          NaN
    {'CustIncome'}    {'[-Inf,29000)'}     -0.45716
      ⋮

MinScore = -1.3100
MaxScore = 3.0726

displaypoints always displays a '<missing>' bin for each predictor. The value of the '<missing>' bin comes from the initial creditscorecard object, and the '<missing>' bin is set to NaN whenever the scorecard model has no information on how to assign points to missing data.

To configure the points for the '<missing>' bin, you must use the initial creditscorecard object. For predictors that have missing values in the training set, the points for the '<missing>' bin are estimated from the data if the 'BinMissingData' name-value pair argument is set to true using creditscorecard. When the 'BinMissingData' parameter is set to false, or when the data contains no missing values in the training set, use the 'Missing' name-value pair argument in formatpoints to indicate how to assign points to the missing data. Then, rebuild the compactCreditScorecard object and rerun displaypoints. Here is an example of this workflow:

sc = formatpoints(sc,'Missing','minpoints');
csc = compactCreditScorecard(sc);
[PointsInfo,MinScore,MaxScore] = displaypoints(csc)
PointsInfo=37×3 table
      Predictors            Bin            Points  
    ______________    ________________    _________

    {'CustAge'   }    {'[-Inf,33)'   }     -0.15894
    {'CustAge'   }    {'[33,37)'     }     -0.14036
    {'CustAge'   }    {'[37,40)'     }    -0.060323
    {'CustAge'   }    {'[40,46)'     }     0.046408
    {'CustAge'   }    {'[46,48)'     }      0.21445
    {'CustAge'   }    {'[48,58)'     }      0.23039
    {'CustAge'   }    {'[58,Inf]'    }        0.479
    {'CustAge'   }    {'<missing>'   }     -0.15894
    {'ResStatus' }    {'Tenant'      }    -0.031252
    {'ResStatus' }    {'Home Owner'  }      0.12696
    {'ResStatus' }    {'Other'       }      0.37641
    {'ResStatus' }    {'<missing>'   }    -0.031252
    {'EmpStatus' }    {'Unknown'     }    -0.076317
    {'EmpStatus' }    {'Employed'    }      0.31449
    {'EmpStatus' }    {'<missing>'   }    -0.076317
    {'CustIncome'}    {'[-Inf,29000)'}     -0.45716
      ⋮

MinScore = -1.3100
MaxScore = 3.0726

To create a compactCreditScorecard object, first create a creditscorecard object using the CreditCardData.mat file to load the data (using a dataset from Refaat 2011). Using the dataMissing dataset, set the 'BinMissingData' indicator to true.

load CreditCardData.mat
sc = creditscorecard(dataMissing,'BinMissingData',true); 

Before creating a compactCreditScorecard object, you must use autobinning and fitmodel with the creditscorecard object. First, use autobinning with the creditscorecard object.

sc = autobinning(sc);

The binning map or rules for categorical data are summarized in a "category grouping" table, returned as an optional output. By default, each category is placed in a separate bin. Here is the information for the predictor ResStatus.

[bi,cg] = bininfo(sc,'ResStatus')
bi=5×6 table
         Bin          Good    Bad     Odds        WOE       InfoValue 
    ______________    ____    ___    ______    _________    __________

    {'Tenant'    }    296     161    1.8385    -0.095463     0.0035249
    {'Home Owner'}    352     171    2.0585     0.017549    0.00013382
    {'Other'     }    128      52    2.4615      0.19637     0.0055808
    {'<missing>' }     27      13    2.0769     0.026469    2.3248e-05
    {'Totals'    }    803     397    2.0227          NaN     0.0092627

cg=3×2 table
       Category       BinNumber
    ______________    _________

    {'Tenant'    }        1    
    {'Home Owner'}        2    
    {'Other'     }        3    

To group categories 'Tenant' and 'Other', modify the category grouping table cg, so the bin number for 'Other' is the same as the bin number for 'Tenant'. Then use modifybins to update the creditscorecard object.

cg.BinNumber(3) = 2; 
sc = modifybins(sc,'ResStatus','Catg',cg); 

Display the updated bin information using bininfo. Note that the bin labels has been updated and that the bin membership information is contained in the category grouping cg.

[bi,cg] = bininfo(sc,'ResStatus')
bi=4×6 table
         Bin         Good    Bad     Odds        WOE       InfoValue 
    _____________    ____    ___    ______    _________    __________

    {'Group1'   }    296     161    1.8385    -0.095463     0.0035249
    {'Group2'   }    480     223    2.1525     0.062196     0.0022419
    {'<missing>'}     27      13    2.0769     0.026469    2.3248e-05
    {'Totals'   }    803     397    2.0227          NaN       0.00579

cg=3×2 table
       Category       BinNumber
    ______________    _________

    {'Tenant'    }        1    
    {'Home Owner'}        2    
    {'Other'     }        2    

Use formatpoints with the 'Missing' name-value pair argument to indicate that missing data is assigned 'maxpoints'.

sc = formatpoints(sc,'BasePoints',true,'Missing','maxpoints','WorstAndBest',[300 800]); 

Use fitmodel to fit the model.

sc = fitmodel(sc,'VariableSelection','fullmodel','Display','Off'); 

Use the creditscorecard object with compactCreditScorecard to create a compactCreditScorecard object.

csc = compactCreditScorecard(sc)
csc = 
  compactCreditScorecard with properties:

              Description: ''
                GoodLabel: 0
              ResponseVar: 'status'
               WeightsVar: ''
        NumericPredictors: {'CustID'  'CustAge'  'TmAtAddress'  'CustIncome'  'TmWBank'  'AMBalance'  'UtilRate'}
    CategoricalPredictors: {'ResStatus'  'EmpStatus'  'OtherCC'}
            PredictorVars: {'CustID'  'CustAge'  'TmAtAddress'  'ResStatus'  'EmpStatus'  'CustIncome'  'TmWBank'  'OtherCC'  'AMBalance'  'UtilRate'}

Then use displaypoints with the compactCreditScorecard object to return a table of points for all bins of all predictor variables used in the compactCreditScorecard object. By setting the displaypoints name-value pair argument for 'ShowCategoricalMembers' to true, all the members contained in each individual group are displayed.

[PointsInfo,MinScore,MaxScore] = displaypoints(csc,'ShowCategoricalMembers',true)
PointsInfo=51×3 table
      Predictors            Bin          Points 
    _______________    ______________    _______

    {'BasePoints' }    {'BasePoints'}     535.25
    {'CustID'     }    {'[-Inf,121)'}     12.085
    {'CustID'     }    {'[121,241)' }     5.4738
    {'CustID'     }    {'[241,1081)'}    -1.4061
    {'CustID'     }    {'[1081,Inf]'}    -7.2217
    {'CustID'     }    {'<missing>' }     12.085
    {'CustAge'    }    {'[-Inf,33)' }    -25.973
    {'CustAge'    }    {'[33,37)'   }     -22.67
    {'CustAge'    }    {'[37,40)'   }    -17.122
    {'CustAge'    }    {'[40,46)'   }    -2.8071
    {'CustAge'    }    {'[46,48)'   }     9.5034
    {'CustAge'    }    {'[48,51)'   }     10.913
    {'CustAge'    }    {'[51,58)'   }     13.844
    {'CustAge'    }    {'[58,Inf]'  }     37.541
    {'CustAge'    }    {'<missing>' }    -9.7271
    {'TmAtAddress'}    {'[-Inf,23)' }    -9.3683
      ⋮

MinScore = 300.0000
MaxScore = 800.0000

Input Arguments

collapse all

Compact credit scorecard model, specified as a compactCreditScorecard object.

To create a compactCreditScorecard object, use compactCreditScorecard or compact from Financial Toolbox™.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: [PointsInfo,MinScore,MaxScore] = displaypoints(csc,'ShowCategoricalMembers',true)

Indicator for how to display bins labels of categories that were grouped together, specified as the comma-separated pair consisting of 'ShowCategoricalMembers' and a logical scalar with a value of true or false.

By default, when 'ShowCategoricalMembers' is false, bin labels are displayed as Group1, Group2,...,Groupn, or if the bin labels were modified in creditscorecard, then the user-defined bin label names are displayed.

If 'ShowCategoricalMembers' is true, all the members contained in each individual group are displayed.

Data Types: logical

Output Arguments

collapse all

One row per bin, per predictor, with the corresponding points, returned as a table. For example:

PredictorsBinPoints
Predictor_1Bin_11Points_11
Predictor_1Bin_12Points_12
Predictor_1Bin_13Points_13
 ......
Predictor_1'<missing>'NaN (Default)
Predictor_2Bin_21Points_21
Predictor_2Bin_22Points_22
Predictor_2Bin_23Points_23
 ......
Predictor_2'<missing>'NaN (Default)
Predictor_jBin_jiPoints_ji
 ......
Predictor_j'<missing>'NaN (Default)

displaypoints always displays a '<missing>' bin for each predictor. The value of the '<missing>' bin comes from the initial creditscorecard object, and the '<missing>' bin is set to NaN whenever the scorecard model has no information on how to assign points to missing data.

To configure the points for the '<missing>' bin, you must use the initial creditscorecard object. For predictors that have missing values in the training set, the points for the '<missing>' bin are estimated from the data if the 'BinMissingData' name-value pair argument for is set to true using creditscorecard. When the 'BinMissingData' parameter is set to false, or when the data contains no missing values in the training set, use the 'Missing' name-value pair argument in formatpoints to indicate how to assign points to the missing data. Then rebuild the compactCreditScorecard object and rerun displaypoints.

When base points are reported separately (see formatpoints), the first row of the returned PointsInfo table contains the base points.

Minimum possible total score, returned as a scalar.

Note

Minimum score is the lowest possible total score in the mathematical sense, independently of whether a low score means high risk or low risk.

Maximum possible total score, returned as a scalar.

Note

Maximum score is the highest possible total score in the mathematical sense, independently of whether a high score means high risk or low risk.

Algorithms

The points for predictor j and bin i are, by default, given by

Points_ji = (Shift + Slope*b0)/p + Slope*(bj*WOEj(i))
where bj is the model coefficient of predictor j, p is the number of predictors in the model, and WOEj(i) is the Weight of Evidence (WOE) value for the i-th bin corresponding to the j-th model predictor. Shift and Slope are scaling constants.

When the base points are reported separately (see the formatpoints name-value pair argument BasePoints), the base points are given by

Base Points = Shift + Slope*b0,
and the points for the j-th predictor, i-th row are given by
Points_ji = Slope*(bj*WOEj(i))).

By default, the base points are not reported separately.

The minimum and maximum scores are:

MinScore = Shift + Slope*b0 + min(Slope*b1*WOE1) + ... +min(Slope*bp*WOEp)),
MaxScore = Shift + Slope*b0 + max(Slope*b1*WOE1) + ... +max(Slope*bp*WOEp)).

Use formatpoints to control the way points are scaled, rounded, and whether the base points are reported separately. See formatpoints for more information on format parameters and for details and formulas on these formatting options.

References

[1] Anderson, R. The Credit Scoring Toolkit. Oxford University Press, 2007.

[2] Refaat, M. Credit Risk Scorecards: Development and Implementation Using SAS. lulu.com, 2011.

Version History

Introduced in R2019a