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.

Mixed models summaries as HTML table

Unlike tables for non-mixed models, tab_models() adds additional information on the random effects to the table output for mixed models. You can hide these information with show.icc = FALSE and show.re.var = FALSE. Furthermore, the R-squared values are marginal and conditional R-squared statistics, based on Nakagawa et al. 2017.

  distance Reaction
Predictors Estimates CI p Estimates CI p
(Intercept) 17.71 16.07 – 19.34 <0.001 251.41 238.03 – 264.78 <0.001
age 0.66 0.54 – 0.78 <0.001
SexFemale -2.32 -3.81 – -0.83 0.002
Days 10.47 7.44 – 13.50 <0.001
Random Effects
σ2 2.05 654.94
τ00 3.27 Subject 612.09 Subject
τ11   35.07 Subject.Days
ρ01   0.07 Subject
ICC 0.61 Subject 0.48 Subject
Observations 108 180
Marginal R2 / Conditional R2 0.398 / 0.768 0.279 / 0.799

The marginal R-squared considers only the variance of the fixed effects, while the conditional R-squared takes both the fixed and random effects into account.

The p-value is a simple approximation, based on the t-statistics and using the normal distribution function. A more precise p-value can be computed using p.val = "kr". In this case, which only applies to linear mixed models, the computation of p-values is based on conditional F-tests with Kenward-Roger approximation for the degrees of freedom (using the using the pbkrtest-package). Note that here the computation is more time consuming and thus not used as default. You can also display the approximated degrees of freedom with show.df.

tab_model(m1, p.val = "kr", show.df = TRUE)
  distance
Predictors Estimates CI p df
(Intercept) 17.71 16.34 – 19.08 <0.001 99.00
age 0.66 0.56 – 0.76 <0.001 80.00
SexFemale -2.32 -3.57 – -1.07 0.005 25.00
Random Effects
σ2 2.05
τ00Subject 3.27
ICC Subject 0.61
Observations 108
Marginal R2 / Conditional R2 0.398 / 0.768
  distance cbind(incidence,size-incidence)
Predictors Estimates CI p Odds Ratios CI p
(Intercept) 17.71 16.07 – 19.34 <0.001 0.25 0.16 – 0.39 <0.001
age 0.66 0.54 – 0.78 <0.001
SexFemale -2.32 -3.81 – -0.83 0.002
period 2 0.37 0.20 – 0.67 0.001
period 3 0.32 0.17 – 0.61 <0.001
period 4 0.21 0.09 – 0.47 <0.001
Random Effects
σ2 2.05 3.29
τ00 3.27 Subject 0.41 herd
ICC 0.61 Subject 0.11 herd
Observations 108 56
Marginal R2 / Conditional R2 0.398 / 0.768 0.085 / 0.187

More complex models

Finally, an example from the glmmTMB-package to show how easy it is to print zero-inflated generalized linear mixed models as HTML table.

  distance cbind(incidence,size-incidence) count
Predictors Estimates p Odds Ratios p Incidence Rate Ratios p
(Intercept) 17.71 <0.001 0.25 <0.001 0.94 0.745
age 0.66 <0.001
SexFemale -2.32 0.002
period 2 0.37 0.001
period 3 0.32 <0.001
period 4 0.21 <0.001
sppPR 0.59 0.062
sppDM 1.25 0.121
sppEC-A 0.82 0.331
sppEC-L 1.91 <0.001
sppDES-L 1.83 <0.001
sppDF 1.05 0.765
minedno 2.76 <0.001
Zero-Inflated Model
(Intercept) 5.79 <0.001
sppPR 5.36 <0.001
sppDM 0.65 0.223
sppEC-A 3.02 0.003
sppEC-L 0.65 0.223
sppDES-L 0.51 0.056
sppDF 0.65 0.223
minedno 0.09 <0.001
Random Effects
σ2 2.05 3.29 1.00
τ00 3.27 Subject 0.41 herd 0.05 site
ICC 0.61 Subject 0.11 herd 0.05 site
Observations 108 56 644
Marginal R2 / Conditional R2 0.398 / 0.768 0.085 / 0.187 0.510 / 0.577

References

Nakagawa S, Johnson P, Schielzeth H (2017) The coefficient of determination R2 and intra-class correlation coefficient from generalized linear mixed-effects models revisted and expanded. J. R. Soc. Interface 14. doi: 10.1098/rsif.2017.0213

Site built with pkgdown.