View source: R/GLM_functions.R
R2Dev | R Documentation |
Computes an R^2 measure for a generalized linear model (GLM) that is based on deviance residuals, as discussed in Fox (1997, p. 481) and Cameron and Windmeijer (1997).
R2Dev(x, digits = NULL)
x |
A model fit via glm(). |
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 R^2 measure has a number of desirable properties and is also called R^2_KL (Cameron & Windmeijer, 1997). It is suitable for use with logistic regression and Poisson regression models.
A numeric value for the R^2
.
Cameron, A. C., & Windmeijer, F. A. G. (1997). An R-squared measure of goodness of fit for some common nonlinear regression models. Journal of Econometrics, 77(2), 329-342. doi:10.1016/S0304-4076(96)01818-0
Fox, J. (1997). Applied regression analysis, linear models, and related methods. Thousand Oaks, CA: Sage Publications.
m1 <- glm(formula = vs ~ wt + disp, family = binomial, data = mtcars)
R2Dev(m1)
R2Dev(m1, digits = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.