pseudoR2: Compute pseudo-R^2 for a logistic regression model

View source: R/GLM_functions.R

pseudoR2R Documentation

Compute pseudo-R^2 for a logistic regression model

Description

Computes a simple pseudo-R^2 measure for a logistic regression model.

Usage

pseudoR2(x, digits = NULL)

Arguments

x

A logistic regression model fit via glm(family = binomial).

digits

An integer specifying the number of decimal places to used when rounding the result. Defaults to NULL, which does not round the result.

Details

=============================================================================

This pseudo-R2 measure is just the Pearson correlation between the observed and fitted values from the logistic regression model, as discussed by Hosmer, Lemeshow, & Sturdivant (2013, p. 182).

Value

A numeric value for the pseudo-R^2.

References

Hosmer, D. W., Lemeshow, S., & Sturdivant, R. X. (2013). Applied logistic regression (3rd ed.). Hoboken, NJ: John Wiley & Sons, Inc.

Examples

m1 <- glm(formula = vs ~ wt + disp, family = binomial, data = mtcars)
pseudoR2(m1)
pseudoR2(m1, digits = 2)


sjpierce/piercer documentation built on Dec. 30, 2024, 3:28 p.m.