I am trying to display both unstandardized and standardized coefficients in a table using modelsummary (incredibly useful package, by the way) in a wide format. Calculating the standardized coefficients works fine and they are displayed in the table. However, I would like to also display the unstandardized coefficients with their respective SE as well. My code so far looks something like this:
models = list(
"Model X" <- lm(mpg ~ hp + factor(cyl), data = mtcars),
"Model Y" <- lm(mpg ~ hp + factor(cyl) + qsec, data = mtcars))
names(models) <- c("Model X", "Model Y")
test <- modelsummary(models,
standardize = "basic",
shape = term~model + statistic,
statistic = c("statistic", "p.value"),
estimate = "{estimate} ({std.error})",
stars = TRUE,
fmt = 2,
col.names = c("", "Std. Est. (SE)", "t", "p", "Std. Est (SE)", "t", "p"),
gof_omit = 'AIC|BIC|Log.Lik.|RMSE',
notes = "Note: Model Y includes control variables"
) %>%kable_styling(font_size = 8) %>% row_spec(0, italic = T)
test
At the moment, the resulting table only shows the standardized coefficients. In addition, two other questions I had:
- Stars are currently not showing, is there any possibility to show them after the p-values?
- Is it possible to give three decimals for p-values, but keep two decimals for all other columns?