View source: R/GLM_functions.R
pseudoR2 | R Documentation |
R^2
for a logistic regression modelComputes a simple pseudo-R^2
measure for a logistic
regression model.
pseudoR2(x, digits = NULL)
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. |
=============================================================================
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).
A numeric value for the pseudo-R^2
.
Hosmer, D. W., Lemeshow, S., & Sturdivant, R. X. (2013). Applied logistic regression (3rd ed.). Hoboken, NJ: John Wiley & Sons, Inc.
m1 <- glm(formula = vs ~ wt + disp, family = binomial, data = mtcars)
pseudoR2(m1)
pseudoR2(m1, digits = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.