If you’ve read our previous R Tip on using sigr with linear models, you might have noticed that the lm()
summary object does in fact carry the R-squared and F statistics, both in the printed form:
and also in the summary()
object:
Note, though, that while the summary reports the model’s significance, it does not carry it as a specific summary()
object item. sigr::wrapFTest()
is a convenient way to extract the model’s R-squared and F statistic and simultaneously calculate the model significance, as is required by many scientific publications.
sigr
is even more helpful for logistic regression, via glm()
, which reports neither the model’s chi-squared statistic nor its significance.
To get the significance of a logistic regression model, call wrapr::wrapChiSqTest():
Notice that the fit summary also reports a pseudo-R-squared. You can extract the values directly off the sigr
object, as well:
And of course you can render the sigr
object into one of several formats (Latex, html, markdown, and ascii) for direct inclusion in a report or publication.
Chi-Square Test summary: pseudo-R2=0.21 (χ2(2,N=150)=39, p<1e-05).
By the way, if you are interested, we give the explicit formula for calculating the significance of a logistic regression model in Practical Data Science with R.
Like this:
Like Loading…
Related