jacob-long / jtools

Tools for summarizing/visualizing regressions and other helpful stuff
https://jtools.jacob-long.com
GNU General Public License v3.0
165 stars 22 forks source link

Extracting Adjusted R2 #81

Closed eredmiles closed 4 years ago

eredmiles commented 4 years ago

Hello,

This is an issue related to issue #56. When I use the suggested solution, it works perfectly for "rsq" but when I do the same for "arsq" (the name for adjusted R2 I could find in the source code) I get NULL, despite the summ() output showing an adjusted R2 value.

attr(summ(test_model), "rsq") 0.2514686 attr(summ(test_model), "arsq") NULL

summ(test_model) MODEL INFO: Observations: 16702 Dependent Variable: security_l28_ever_actioned_security_settings Type: Analysis of complex survey design Family: quasibinomial Link function: logit

MODEL FIT: Pseudo-R² (Cragg-Uhler) = 0.25 Pseudo-R² (McFadden) = 0.37 AIC = NA ....

jacob-long commented 4 years ago

The reason for this — and it's of course undocumented so I should look at fixing that — is that there's not really an equivalent to the adjusted R2 for GLMs.

In this case, you should be able to find the Cragg-Uhler R2 with attr(summ(test_model), "rsq") as you did and then you can extract the McFadden with attr(summ(test_model), "rsqmc"). Note that I wouldn't necessarily consider either of these to be equivalent to an "adjusted" R2 like you get with OLS models.

eredmiles commented 4 years ago

Thank you!