Wrapper for confMatrix from the caret package.

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

Arguments

model

An object of class glm.

cutoff

Cutoff for classification.

data

A tibble or a data.frame.

Value

Confusion matix.

See also

Examples

model <- glm(honcomp ~ female + read + science, data = hsb2, family = binomial(link = 'logit')) blr_confusion_matrix(model, cutoff = 0.4)
#> Confusion Matrix and Statistics #> #> Reference #> Prediction 0 1 #> 0 125 16 #> 1 22 37 #> #> Accuracy : 0.81 #> 95% CI : (0.7487, 0.8619) #> No Information Rate : 0.735 #> P-Value [Acc > NIR] : 0.008453 #> #> Kappa : 0.5293 #> Mcnemar's Test P-Value : 0.417304 #> #> Sensitivity : 0.6981 #> Specificity : 0.8503 #> Pos Pred Value : 0.6271 #> Neg Pred Value : 0.8865 #> Prevalence : 0.2650 #> Detection Rate : 0.1850 #> Detection Prevalence : 0.2950 #> Balanced Accuracy : 0.7742 #> #> 'Positive' Class : 1 #>