Pseudo R-square

Recall that a true R-square measure is not a standard output statistic for logistic regression but there are other goodness of fit measures we can use, such as the McFadden pseudo R-square.

We calculate this in code, by first obtaining both the residual deviance and the null deviance. The residual deviance measures the deviation in the model with all of the dependent variables included. The null deviation measures the residuals with only the intercepts included. You want the ratio of deviation/null.devation to be as small as possible for a good model. Subtract this value from 1 to obtain a pseudo R-square.

All of these measures are available via the model_summary object:

#mcfadden pseudo Rsquare 1-(model_summary$deviance/model_summary$null.deviance) ...

Get Practical Predictive Analytics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.