1

I am using modelsummary to create a table. I would like to the estimate (regression coefficients) to be standardized. I used lm.beta() but the estimate = is giving me the non-standardized coefficient. Also, I would like to use coef.omitt to take out more than one variable. How might I do this?

hrl
  • 11
  • 1

1 Answers1

2

This solution only works using the development version of modelsummary. This version should be on CRAN in the next few weeks, but you can install it now:

library(remotes)
install_github("vincentarelbundock/modelsummary")

Under the hood, modelsummary uses the parameters package to extract parameters from model objects. As you can see here, that package can apply several different kinds of standardization. You can pass a standardize argument directly to modelsummary(), which will then pass it down to parameters.

The coef_omit argument accepts regular expressions. See the documentation to learn how to omit several coefficients. ex: coef_omit="x|y|z"

For example:

library(modelsummary)
mod <- lm(mpg ~ hp + factor(cyl), data = mtcars)
modelsummary(mod, standardize = "basic")
Model 1
(Intercept) 0.000
(0.000)
hp -0.273
(0.175)
factor(cyl)6 -0.416
(0.114)
factor(cyl)8 -0.713
(0.195)
Num.Obs. 32
R2 0.754
R2 Adj. 0.727
AIC 169.9
BIC 177.2
F 28.585
RMSE 2.94
Vincent
  • 15,809
  • 7
  • 37
  • 39
  • Thank you! I ran the code with standardize = "basic" but did not seem to get the standardized coefficients. There was no error though - just brings in the unstandardized coefficients. – hrl May 21 '22 at 19:50
  • Did you install the development version and restart `R` before trying? – Vincent May 22 '22 at 03:45
  • As in hrl's case, modelsummary with standardize="basic" works for the mtcars example but just shows unstandardized coefficients for my data using feols. My modelsummary version is 1.1.0.9000. Interesting that easystats only works with "refit" method and throws errors with all others. – astrae_research Jan 25 '23 at 01:24
  • Maybe `parameters:: parameters` does not support `fixest` models for standardization? – Vincent Jan 25 '23 at 01:40