I'm running a logistic regression model in R. I've used both the Zelig and Car packages. However, I'm wondering if there is a simple way to get the model fit statistics for the model. (pseudo R-square, chi-square, log liklihood,etc)
Assume glm1
ist your model and your samplesize is n = 100
.
Here are some goodness-of-fit-measures:
R2 <- 1 - ((glm1$deviance/-2)/(glm1$null.deviance/-2))
cat("mcFadden R2 = ", R2, "\n")
R2 <- 1 - exp((glm1$deviance - glm1$null.deviance)/2 * n)
cat("Cox-Snell R2 = ", R2, "\n")
R2 <- R2/(1 - exp((-glm1$null.deviance)/n))
cat("Nagelkerke R2 = ", R2, "\n")
AIC <- glm1$deviance + 2 * 2
cat("AIC = ", AIC, "\n")
In this way you have an overview of how calculating the GoF-Measurements.
Typically this is done using the summary()
function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With