Compute sensitivity, specificity, accuracy and KS statistics to generate the lift chart and the KS chart.

blr_gains_table(model, data = NULL)

# S3 method for blr_gains_table
plot(x, title = "Lift Chart",
  xaxis_title = "% Population", yaxis_title = "% Cumulative 1s",
  diag_line_col = "red", lift_curve_col = "blue",
  plot_title_justify = 0.5, ...)

Arguments

model

An object of class glm.

data

A tibble or a data.frame.

x

An object of class blr_gains_table.

title

Plot title.

xaxis_title

X axis title.

yaxis_title

Y axis title.

diag_line_col

Diagonal line color.

lift_curve_col

Color of the lift curve.

plot_title_justify

Horizontal justification on the plot title.

...

Other inputs.

Value

A tibble.

References

Agresti, A. (2007), An Introduction to Categorical Data Analysis, Second Edition, New York: John Wiley & Sons.

Agresti, A. (2013), Categorical Data Analysis, Third Edition, New York: John Wiley & Sons.

Thomas LC (2009): Consumer Credit Models: Pricing, Profit, and Portfolio. Oxford, Oxford Uni-versity Press.

Sobehart J, Keenan S, Stein R (2000): Benchmarking Quantitative Default Risk Models: A Valid-ation Methodology, Moody’s Investors Service.

See also

Other model validation techniques: blr_confusion_matrix, blr_decile_capture_rate, blr_decile_lift_chart, blr_gini_index, blr_ks_chart, blr_lorenz_curve, blr_roc_curve, blr_test_hosmer_lemeshow

Examples

model <- glm(honcomp ~ female + read + science, data = hsb2, family = binomial(link = 'logit')) # gains table blr_gains_table(model)
#> # A tibble: 10 x 12 #> decile total `1` `0` ks tp tn fp fn sensitivity #> <dbl> <int> <int> <int> <dbl> <int> <int> <int> <int> <dbl> #> 1 1.00 20 14 6 22.3 14 141 6 39 26.4 #> 2 2.00 20 13 7 42.1 27 134 13 26 50.9 #> 3 3.00 20 10 10 54.2 37 124 23 16 69.8 #> 4 4.00 20 7 13 58.5 44 111 36 9 83.0 #> 5 5.00 20 3 17 52.6 47 94 53 6 88.7 #> 6 6.00 20 3 17 46.7 50 77 70 3 94.3 #> 7 7.00 20 1 19 35.7 51 58 89 2 96.2 #> 8 8.00 20 2 18 27.2 53 40 107 0 100 #> 9 9.00 20 0 20 13.6 53 20 127 0 100 #> 10 10.0 20 0 20 0 53 0 147 0 100 #> # ... with 2 more variables: specificity <dbl>, accuracy <dbl>
# lift chart k <- blr_gains_table(model) plot(k)