Skip to Content
Practical Predictive Analytics
book

Practical Predictive Analytics

by Ralph Winters
June 2017
Beginner to intermediate content levelBeginner to intermediate
576 pages
15h 22m
English
Packt Publishing
Content preview from Practical Predictive Analytics

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) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Data Superstream: Analytics Engineering

Data Superstream: Analytics Engineering

Alistair Croll, Anna Filippova, Emilie Schario, Lewis Davies, Jacob Frackson, Benn Stancil, Nick Acosta, Elizabeth Caley
R: Predictive Analysis

R: Predictive Analysis

Tony Fischetti, Eric Mayor, Rui Miguel Forte
Python: Advanced Predictive Analytics

Python: Advanced Predictive Analytics

Ashish Kumar, Joseph Babcock

Publisher Resources

ISBN: 9781785886188Supplemental Content