jacob-long / jtools

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

Include other options for standardizing coefficients #113

Closed e-leib closed 2 years ago

e-leib commented 3 years ago

I was using export_summs() and summ() with the argument scale=TRUE because I wanted standardized coefficients. I had assumed that these functions were standardizing coefficients in the way common in my field, by operating on the unstandardized coefficients (example). However, after a strange occurence where a regression coefficient in summary(myModel) was not significant and it became significant in the export_summs() output (which I had assumed would give the same result), I took a deeper dive into what scale=TRUE was actually doing.

I found this (description): "To be clear, since the meaning of “standardized beta” can vary depending on who you talk to, this option mean-centers the predictors as well but does not alter the dependent variable whatsoever. "

It would be a great additional feature if the user could choose which method to calculate standardized coefficients.

Thank you for considering this feature request!

jacob-long commented 2 years ago

I'll take this under advisement. When I first built the package, I calculated standardized coefficients in this way — based on the coefficients themselves rather than scaling the underlying data. The main reason I switched away from it is that ordinarily scaling should give equivalent results — the most common situation I encountered in which it didn't is when there are interactions and this was an important situation to get right in my own research.

When there are interactions, the data-scaling method gives a correct interaction coefficient while the method like the one used by Stata gives an incorrect value (although I don't know for sure whether perhaps Stata catches this and uses data scaling instead when there are interactions). The other difference is the mean-centering, which changes the lower-order coefficients in interactions, but changes them in a way that usually renders them more interpretable.

I'll think about the feasibility of computing betas based solely on coefficients, but it would be a not-small task at this juncture.

jacob-long commented 2 years ago

I have added an option for scaling without mean-centering in 3060fecdae8d90319dce7be1acca42ce803e8aac (to address #104), but this still involves scaling the data and re-fitting the model.