Reputation: 11
When I use the R package modelsummary, I want the models to be vertically arragnged and the statistics to be horizontally. The default formula for shape is term + statistic ~ model, and the normal table is complete
mod_custom <- lm(hp ~ mpg + drat, mtcars)
modelsummary(mod_custom)
enter image description here. However, when I change the shape to be model ~term + statistic, all the goodness-of-fit disappears:
modelsummary(mod_custom,
shape=model ~term + statistic,
)
I have tried to set the parameter
gof_omit='NULL'
or
gof_map='all'
None of them worked. What should I do to make the goodness-of-fit ,such as AIC, display when the shape is changed or is there other methods to pivot the table with goodness-of-fit reserved?
Upvotes: 0
Views: 302
Reputation: 11
I have found the answer inspiring by https://github.com/vincentarelbundock/modelsummary/issues/620. This issue has not been fixed by the developer, so it can only be solved by add_columns. The method is as follows.
mod_custom <- lm(hp ~ mpg + drat, mtcars)
cols<-broom::glance(mod_custom)
modelsummary(mod_custom,
shape=model ~term + statistic,
add_columns=cols,
)
Upvotes: 1