Summary of Bayesian Models as HTML Table"

knitr::opts_chunk$set(
  collapse = TRUE, 
  comment = "#>", 
  message = FALSE,
  eval = if (isTRUE(exists("params"))) params$EVAL else FALSE
)

This vignette shows examples for using tab_model() to create HTML tables for mixed models. Basically, tab_model() behaves in a very similar way for mixed models as for other, simple regression models, as shown in this vignette.

# load required packages
library(sjPlot)
library(sjmisc)
library(brms)

# load sample datasets
data("efc")
efc <- to_factor(efc, e42dep, c172code, c161sex, e15relat)
zinb <- read.csv("http://stats.idre.ucla.edu/stat/data/fish.csv")

# fit two sample models
m1 <- brm(
  bf(count ~ child + camper + (1 | persons), 
     zi ~ child + camper),
  data = zinb,
  family = zero_inflated_poisson(),
  cores = 4,
  iter = 1000
)

f1 <- bf(neg_c_7 ~ e42dep + c12hour + c172code + (1 |ID| e15relat))
f2 <- bf(c12hour ~ c172code + (1 |ID| e15relat))
m2 <- brm(
  f1 + f2 + set_rescor(FALSE), 
  data = efc, 
  cores = 4,
  iter = 1000
)

Bayesian models summaries as HTML table

For Bayesian regression models, some of the differences to the table output from simple models or mixed models of tab_models() are the use of Highest Density Intervals instead of confidence intervals, the Bayes-R-squared values, and a different "point estimate" (which is, by default, the median from the posterior draws).

tab_model(m1)

Multivariate response models

For multivariate response models, like mediator-analysis-models, it is recommended to print just one model in the table, as each regression is displayed as own "model" in the output.

tab_model(m2)

Just show one HDI-column

To show just one HDI-column, use show.hdi50 = FALSE.

tab_model(m2, show.hdi50 = FALSE)

Mixing multivariate and univariate response models

When both multivariate and univariate response models are displayed in one table, a column Response is added for the multivariate response model, to indicate the different outcomes.

tab_model(m1, m2, show.hdi50 = F)


Try the sjPlot package in your browser

Any scripts or data that you put into this service are public.

sjPlot documentation built on Oct. 15, 2018, 1:03 a.m.