Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Model Fit statistics for a Logistic Regression

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)

like image 316
Tony Avatar asked Jul 26 '10 16:07

Tony


2 Answers

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.

like image 96
Redfood Avatar answered Sep 25 '22 23:09

Redfood


Typically this is done using the summary() function.

like image 37
Shane Avatar answered Sep 22 '22 23:09

Shane