Appendix D — Summary tables

While we need to report the parameters and statistics of our models in text with any reports, it can also be extremely useful to provide a model summary table, especially when reporting complex analyses. Below I present examples from two of my favourite packages for model reporting.

Both packages come with lots of options for customisation to produce presentation ready tables

D.1 sjPlot

sjPlot A really nice package that helps produce model summaries for you automatically, currently it will only output in HTML format

library(sjPlot)
tab_model(William_ls2)
  William
Predictors Estimates CI p
(Intercept) 8.53 8.38 – 8.68 <0.001
O3 -7.14 -9.15 – -5.13 <0.001
Stress [Well-watered] 0.18 0.07 – 0.29 0.003
Observations 30
R2 / R2 adjusted 0.703 / 0.681
tab_model(
  William_ls2, 
  pred.labels = c("Intercept", "O³", "Stress[Well-watered]"),
  dv.labels = "Biomass",
  string.pred = "Coefficient",
  string.ci = "Conf. Int (95%)",
  string.p = "P-Value"
)
  Biomass
Coefficient Estimates Conf. Int (95%) P-Value
Intercept 8.53 8.38 – 8.68 <0.001
-7.14 -9.15 – -5.13 <0.001
Stress[Well-watered] 0.18 0.07 – 0.29 0.003
Observations 30
R2 / R2 adjusted 0.703 / 0.681

gtsummary Is an extension of the gt package and provides even greater levels of flexibility and customisation. It is also compatible with HTML, word or pdf. Perhaps the only downside is the level of options and customisability can be slightly overwhelming. In addition the gt package has been undergoing a lot of active development, so sometimes older code examples are now defunct.

library(gtsummary)
tbl_regression(William_ls2)
Characteristic Beta 95% CI1 p-value
O3 -7.1 -9.2, -5.1 <0.001
Stress


    Stressed
    Well-watered 0.18 0.07, 0.29 0.003
1 CI = Confidence Interval
tbl_regression(William_ls2,
               intercept = TRUE,
               label = list(O3 ~ "O³", Stress ~ "Stress"),
               pvalue_fun = ~ style_pvalue(.x, digits = 2)) %>% 
  modify_header(label = "Coefficient",
                estimate = "Estimate") %>% 
  bold_labels() %>% 
  bold_p(t = 0.05) %>% 
  as_gt () %>% 
   gt::tab_source_note(gt::md("*This is an ordinary least squares model*"))
Coefficient Estimate 95% CI1 p-value
(Intercept) 8.5 8.4, 8.7 <0.001
-7.1 -9.2, -5.1 <0.001
Stress


    Stressed
    Well-watered 0.18 0.07, 0.29 0.003
This is an ordinary least squares model
1 CI = Confidence Interval