Learn R Programming

performance (version 0.1.0)

error_rate: Error Rate for Logistic Regression Models

Description

Compute the error rate for logistic regression models, which is a crude measure for the model fit.

Usage

error_rate(model)

Arguments

model

A glm-object with binomial-family.

Value

A list with four values: the error rate of the full and the null model, as well as the chi-squared and p-value from the Likelihood-Ratio-Test between the full and null model.

Details

The error rate is a crude measure for model fit for logistic regression models. It is defined as the proportion of cases for which the deterministic prediction is wrong, i.e. the proportion where the the predicted probability is above 0.5, although y = 0 (and vice versa). In general, the error rate should be below 0.5 (i.e. 50%), the closer to zero, the better. Furthermore, the error rate of the full model should be considerably below the null model's error rate (cf. Gelman and Hill 2007, pp. 99).

References

Gelman, A., & Hill, J. (2007). Data analysis using regression and multilevel/hierarchical models. Cambridge; New York: Cambridge University Press.

Examples

Run this code
# NOT RUN {
data(mtcars)
m <- glm(am ~ mpg + hp + cyl, data = mtcars, family= binomial)
error_rate(m)

# }

Run the code above in your browser using DataLab