%% Display Bin Information Using Name-Value Arguments
% Create a creditscorecard object using the CreditCardData.mat file to load the data (using a dataset from Refaat 2011).

load CreditCardData 
sc = creditscorecard(data);

%
% Display customized bin information for the categorical predictor ResStatus, keeping only the WOE column. The Weight-of-Evidence (WOE) is defined bin by bin, but there is no concept of "total WOE", therefore the last element in the 'Totals' row is set to NaN.

bi = bininfo(sc,'ResStatus','Statistics','WOE');
disp(bi)

%
% Display customized bin information for the categorical predictor ResStatus, keeping only the Odds and WOE columns, without the Totals row.

bi = bininfo(sc,'ResStatus','Statistics',{'Odds','WOE'},'Totals','Off');
disp(bi)

%
% Display information value, entropy, Gini, and chi square statistics. For more information on these statistics, see Statistics for a Credit Scorecard.
% For information value, entropy and Gini, the value reported at a bin level is the contribution of the bin to the total value. The total information value, entropy, and Gini measures are in the 'Totals' row.
% For chi square, if there are N bins, the first N-1 values in the 'Chi2' column report pairwise chi square statistics for contiguous bins. For example, this pairwise measure is also used by the 'Merge' algorithm in autobinning to determine if two contiguous bins should be merged. In this example, the first value in the 'Chi2' column (1.0331) is the chi square statistic of bins 1 and 2 ('Home Owner' and 'Tenant'), and the second value in the column (2.5103) is the chi square statistic of bins 2 and 3 ('Tenant' and 'Other'). There are no more pairwise chi square values to compute in this example, so the third element of the 'Chi2' column is set to NaN. The chi square value reported in the 'Totals' row is the chi square statistic computed over all bins.

bi = bininfo(sc,'ResStatus','Statistics',{'InfoValue','Entropy','Gini','Chi2'});
disp(bi)

%
% Copyright 2015 The MathWorks, Inc.