Learn R Programming

blorr (version 0.3.2)

blr_confusion_matrix: Confusion matrix

Description

Confusion matrix and statistics.

Usage

blr_confusion_matrix(model, cutoff = 0.5, data = NULL, ...)

# S3 method for default blr_confusion_matrix(model, cutoff = 0.5, data = NULL, ...)

Value

Confusion matrix.

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.

cutoff

Cutoff for classification.

data

A tibble or a data.frame.

...

Other arguments.

References

Kuhn, M. (2008). Building predictive models in R using the caret package. Journal of Statistical Software, 28(5), 1--26.

See Also

Other model validation techniques: blr_decile_capture_rate(), blr_decile_lift_chart(), blr_gains_table(), 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'))

blr_confusion_matrix(model, cutoff = 0.4)

Run the code above in your browser using DataLab