Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

displaypoints

Return points per predictor per bin

Syntax

PointsInfo = displaypoints(sc)
[PointsInfo,MinScore,MaxScore] = displaypoints(sc)

Description

example

PointsInfo = displaypoints(sc) returns a table of points for all bins of all predictor variables used in the creditscorecard object after a linear logistic regression model is fit using fitmodel to the Weight of Evidence data. The PointsInfo table displays information on the predictor name, bin labels, and the corresponding points per bin.

example

[PointsInfo,MinScore,MaxScore] = displaypoints(sc) returns a table of points for all bins of all predictor variables used in the creditscorecard object after a linear logistic regression model is fit (fitmodel) to the Weight of Evidence data. 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.

Examples

collapse all

This example shows how to use displaypoints after a model is fitted to compute the unscaled points per bin, for a given predictor in the creditscorecard model.

Create a creditscorecard object using the CreditCardData.mat file to load the data (using a dataset from Refaat 2011). Use the 'IDVar' argument in the creditscorecard function to indicate that 'CustID' contains ID information and should not be included as a predictor variable.

load CreditCardData 
sc = creditscorecard(data,'IDVar','CustID');

Perform automatic binning to bin for all predictors.

sc = autobinning(sc);

Fit a linear regression model using default parameters.

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:
    status ~ [Linear formula with 8 terms in 7 predictors]
    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

Display unscaled points for predictors retained in the fitting model.

PointsInfo = displaypoints(sc)
PointsInfo=30x3 table null
     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
    'ResStatus'     'Tenant'           -0.031252
    'ResStatus'     'Home Owner'         0.12696
    'ResStatus'     'Other'              0.37641
    'EmpStatus'     'Unknown'          -0.076317
    'EmpStatus'     'Employed'           0.31449
    'CustIncome'    '[-Inf,29000)'      -0.45716
    'CustIncome'    '[29000,33000)'     -0.10466
    'CustIncome'    '[33000,35000)'     0.052329
    'CustIncome'    '[35000,40000)'     0.081611

This example shows how to use formatpoints after a model is fitted to format scaled points, and then use displaypoints to display the scaled points per bin, for a given predictor in the creditscorecard model.

Points become scaled when a range is defined. Specifically, a linear transformation from the unscaled to the scaled points is necessary. This transformation is defined either by supplying a shift and slope or by specifying the worst and best scores possible. (For more information, see formatpoints.)

Create a creditscorecard object using the CreditCardData.mat file to load the data (using a dataset from Refaat 2011). Use the 'IDVar' argument in the creditscorecard function to indicate that 'CustID' contains ID information and should not be included as a predictor variable.

load CreditCardData 
sc = creditscorecard(data,'IDVar','CustID');

Perform automatic binning to bin for all predictors.

sc = autobinning(sc);

Fit a linear regression model using default parameters.

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:
    status ~ [Linear formula with 8 terms in 7 predictors]
    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 formatpoints function to scale providing the 'Worst' and 'Best' score values. The range provided below is a common score range.

sc = formatpoints(sc,'WorstAndBestScores',[300 850]);

Display the points information again to verify that the points are now scaled and also display the scaled minimum and maximum scores.

sc = formatpoints(sc,'WorstAndBestScores',[300 850]);
[PointsInfo,MinScore,MaxScore] = displaypoints(sc)
PointsInfo=30x3 table null
     Predictors           Bin          Points
    ____________    _______________    ______

    'CustAge'       '[-Inf,33)'        46.396
    'CustAge'       '[33,37)'          48.727
    'CustAge'       '[37,40)'          58.772
    'CustAge'       '[40,46)'          72.167
    'CustAge'       '[46,48)'          93.256
    'CustAge'       '[48,58)'          95.256
    'CustAge'       '[58,Inf]'         126.46
    'ResStatus'     'Tenant'           62.421
    'ResStatus'     'Home Owner'       82.276
    'ResStatus'     'Other'            113.58
    'EmpStatus'     'Unknown'          56.765
    'EmpStatus'     'Employed'         105.81
    'CustIncome'    '[-Inf,29000)'     8.9706
    'CustIncome'    '[29000,33000)'    53.208
    'CustIncome'    '[33000,35000)'     72.91
    'CustIncome'    '[35000,40000)'    76.585

MinScore = 300.0000
MaxScore = 850.0000

Notice that, as expected, the values of MinScore and MaxScore correspond to the worst and best possible scores.

This example shows how to use displaypoints after a model is fitted to separate the base points from the rest of the points assigned to each predictor variable. The name-value pair argument 'BasePoints' in the formatpoints function is a boolean that serves this purpose. By default, the base points are spread across all variables in the scorecard.

Create a creditscorecard object using the CreditCardData.mat file to load the data (using a dataset from Refaat 2011). Use the 'IDVar' argument in the creditscorecard function to indicate that 'CustID' contains ID information and should not be included as a predictor variable.

load CreditCardData 
sc = creditscorecard(data,'IDVar','CustID');

Perform automatic binning to bin for all predictors.

sc = autobinning(sc);

Fit a linear regression model using default parameters.

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:
    status ~ [Linear formula with 8 terms in 7 predictors]
    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 formatpoints function to separate the base points by providing the 'BasePoints' name-value pair argument.

sc = formatpoints(sc,'BasePoints',true);

Display the base points, separated out from the other points, for predictors retained in the fitting model.

PointsInfo = displaypoints(sc)
PointsInfo=31x3 table
     Predictors           Bin           Points  
    ____________    _______________    _________

    'BasePoints'    'BasePoints'         0.70239
    'CustAge'       '[-Inf,33)'         -0.25928
    'CustAge'       '[33,37)'           -0.24071
    'CustAge'       '[37,40)'           -0.16066
    'CustAge'       '[40,46)'          -0.053933
    'CustAge'       '[46,48)'            0.11411
    'CustAge'       '[48,58)'            0.13005
    'CustAge'       '[58,Inf]'           0.37866
    'ResStatus'     'Tenant'            -0.13159
    'ResStatus'     'Home Owner'        0.026616
    'ResStatus'     'Other'              0.27607
    'EmpStatus'     'Unknown'           -0.17666
    'EmpStatus'     'Employed'           0.21415
    'CustIncome'    '[-Inf,29000)'       -0.5575
    'CustIncome'    '[29000,33000)'       -0.205
    'CustIncome'    '[33000,35000)'    -0.048013

This example shows how to use displaypoints after a model is fitted and the modifybins function is used to provide user-defined bin labels for a numeric predictor.

Create a creditscorecard object using the CreditCardData.mat file to load the data (using a dataset from Refaat 2011). Use the 'IDVar' argument in the creditscorecard function to indicate that 'CustID' contains ID information and should not be included as a predictor variable.

load CreditCardData 
sc = creditscorecard(data,'IDVar','CustID');

Perform automatic binning to bin for all predictors.

sc = autobinning(sc);

Fit a linear regression model using default parameters.

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:
    status ~ [Linear formula with 8 terms in 7 predictors]
    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 displaypoints function to display point information.

[PointsInfo,MinScore,MaxScore] = displaypoints(sc)
PointsInfo=30x3 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
    'ResStatus'     'Tenant'           -0.031252
    'ResStatus'     'Home Owner'         0.12696
    'ResStatus'     'Other'              0.37641
    'EmpStatus'     'Unknown'          -0.076317
    'EmpStatus'     'Employed'           0.31449
    'CustIncome'    '[-Inf,29000)'      -0.45716
    'CustIncome'    '[29000,33000)'     -0.10466
    'CustIncome'    '[33000,35000)'     0.052329
    'CustIncome'    '[35000,40000)'     0.081611

MinScore = -1.3100
MaxScore = 3.0726

Use the modifybins function to specify user-defined bin labels for 'CustAge' so that the bin ranges are described in natural language.

labels = {'Up to 32','33 to 36','37 to 39','40 to 45','46 to 47','48 to 57','At least 58'};
sc = modifybins(sc,'CustAge','BinLabels',labels);

Rerun displaypoints to verify the updated bin labels.

[PointsInfo,MinScore,MaxScore] = displaypoints(sc)
PointsInfo=30x3 table
     Predictors           Bin           Points  
    ____________    _______________    _________

    'CustAge'       'Up to 32'          -0.15894
    'CustAge'       '33 to 36'          -0.14036
    'CustAge'       '37 to 39'         -0.060323
    'CustAge'       '40 to 45'          0.046408
    'CustAge'       '46 to 47'           0.21445
    'CustAge'       '48 to 57'           0.23039
    'CustAge'       'At least 58'          0.479
    'ResStatus'     'Tenant'           -0.031252
    'ResStatus'     'Home Owner'         0.12696
    'ResStatus'     'Other'              0.37641
    'EmpStatus'     'Unknown'          -0.076317
    'EmpStatus'     'Employed'           0.31449
    'CustIncome'    '[-Inf,29000)'      -0.45716
    'CustIncome'    '[29000,33000)'     -0.10466
    'CustIncome'    '[33000,35000)'     0.052329
    'CustIncome'    '[35000,40000)'     0.081611

MinScore = -1.3100
MaxScore = 3.0726

This example shows how to use a credit scorecard to compute the weights of the predictors. The weights of the predictors are determined from the range of points of each predictor, divided by the total range of points for the scorecard. The points for the scorecard not only take into consideration the betas, but also implicitly the binning of the predictor values and the corresponding weights of evidence.

Create a scorecard.

load CreditCardData.mat
sc = creditscorecard(data,'IDVar','CustID');
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:
    status ~ [Linear formula with 8 terms in 7 predictors]
    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

Compute scorecard points and the MinPts and MaxPts scores.

sc = formatpoints(sc,'PointsOddsAndPDO',[500 2 50]);
[PointsTable,MinPts,MaxPts] = displaypoints(sc);
PtsRange = MaxPts-MinPts;
disp(PointsTable(1:10,:)); 
    Predictors         Bin         Points
    ___________    ____________    ______

    'CustAge'      '[-Inf,33)'     52.821
    'CustAge'      '[33,37)'       54.161
    'CustAge'      '[37,40)'       59.934
    'CustAge'      '[40,46)'       67.633
    'CustAge'      '[46,48)'       79.755
    'CustAge'      '[48,58)'       80.905
    'CustAge'      '[58,Inf]'      98.838
    'ResStatus'    'Tenant'        62.031
    'ResStatus'    'Home Owner'    73.444
    'ResStatus'    'Other'         91.438
 fprintf('Min points: %g, Max points: %g\n',MinPts,MaxPts); 
Min points: 355.505, Max points: 671.64

Compute the predictor weights.

Predictor = unique(PointsTable.Predictors,'stable');
NumPred = length(Predictor);
Weight = zeros(NumPred,1);
for ii=1:NumPred
   Ind = cellfun(@(x)strcmpi(Predictor{ii},x),PointsTable.Predictors);
   MaxPtsPred = max(PointsTable.Points(Ind));
   MinPtsPred = min(PointsTable.Points(Ind));
   Weight(ii) = 100*(MaxPtsPred-MinPtsPred)/PtsRange;
end

PredictorWeights = table(Predictor,Weight);
PredictorWeights(end+1,:) = PredictorWeights(end,:);
PredictorWeights.Predictor{end} = 'Total';
PredictorWeights.Weight(end) = sum(Weight);
disp(PredictorWeights)
     Predictor      Weight
    ____________    ______

    'CustAge'       14.556
    'ResStatus'      9.302
    'EmpStatus'     8.9174
    'CustIncome'    20.401
    'TmWBank'       25.884
    'OtherCC'       7.9885
    'AMBalance'     12.951
    'Total'            100

The weights are defined as the range of points for the predictor divided by the range of points for the scorecard.

Input Arguments

collapse all

Credit scorecard model, specified as a creditscorecard object. Use creditscorecard to create a creditscorecard object.

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_2Bin_21Points_21
 ......
Predictor_jBin_jiPoints_ji
 ......

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.

Introduced in R2014b

Was this topic helpful?