Learn R Programming

blorr (version 0.3.2)

blr_gains_table: Gains table & lift chart

Description

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

Usage

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, print_plot = TRUE, ... )

Value

A tibble.

Arguments

model

An object of class glm. Only binary logistic regression models (binomial family with logit link) are supported. Weighted models (any prior weight other than 1) and grouped binomial models (cbind(successes, failures) or proportions) are not supported; the model must be fitted with model = TRUE, y = TRUE.

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.

print_plot

logical; if TRUE, prints the plot else returns a plot object.

...

Other inputs.

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 University Press.

Sobehart J, Keenan S, Stein R (2000): Benchmarking Quantitative Default Risk Models: A Validation 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

Run this code
model <- glm(honcomp ~ female + read + science, data = hsb2,
             family = binomial(link = 'logit'))
# gains table
blr_gains_table(model)

# lift chart
k <- blr_gains_table(model)
plot(k)

Run the code above in your browser using DataLab