Reporting your model outputs

Let’s see how to format your model outputs with parameters package in R by Lüdecke et al. (2020).

Fit a simple linear regression model

#install.packages("parameters")
library(parameters)
library(magrittr)
library(gt)
library(see)
model <- lm(Volume ~ Height + Girth, data=trees)

Reporting model parameter estimates

model %>% model_parameters()
Parameter   | Coefficient |   SE |           95% CI | t(28) |      p
--------------------------------------------------------------------
(Intercept) |      -57.99 | 8.64 | [-75.68, -40.29] | -6.71 | < .001
Height      |        0.34 | 0.13 | [  0.07,   0.61] |  2.61 | 0.014 
Girth       |        4.71 | 0.26 | [  4.17,   5.25] | 17.82 | < .001
model %>% model_parameters() %>% print_md()
Parameter Coefficient SE 95% CI t(28) p
(Intercept) -57.99 8.64 (-75.68, -40.29) -6.71 < .001
Height 0.34 0.13 (0.07, 0.61) 2.61 0.014
Girth 4.71 0.26 (4.17, 5.25) 17.82 < .001
model %>% model_parameters() %>% print_html()
Regression Model
Parameter Coefficient SE 95% CI t(28) p
(Intercept) -57.99 8.64 (-75.68, -40.29) -6.71 < .001
Height 0.34 0.13 (0.07, 0.61) 2.61 0.014
Girth 4.71 0.26 (4.17, 5.25) 17.82 < .001

Control the number of decimal places

model %>% model_parameters(digits=3) %>% print_html()
Regression Model
Parameter Coefficient SE 95% CI t(28) p
(Intercept) -57.988 8.638 (-75.68, -40.29) -6.713 < .001
Height 0.339 0.130 (0.07, 0.61) 2.607 0.014
Girth 4.708 0.264 (4.17, 5.25) 17.816 < .001

Visualise model parameter estimates

model %>% model_parameters(digits=3) %>% plot()

Reporting ANOVA table

model %>% aov() %>% model_parameters() %>% print_html()
Regression Model
Parameter Sum_Squares df Mean_Square F p
Height 2901.19 1 2901.19 192.53 < .001
Girth 4782.97 1 4782.97 317.41 < .001
Residuals 421.92 28 15.07

References

Lüdecke, Daniel, Mattan S. Ben-Shachar, Indrajeet Patil, and Dominique Makowski. 2020. “Parameters: Extracting, Computing and Exploring the Parameters of Statistical Models Using R.” Journal of Open Source Software 5 (53): 2445. https://doi.org/10.21105/joss.02445.

Related