Learn R Programming

sjPlot (version 2.0.0)

sjt.lmer: Summary of linear mixed effects models as HTML table

Description

Summarizes (multiple) fitted linear mixed effects models (estimates, std. beta values etc.) as HTML table, or saves them as file. The fitted models may have different predictors, e.g. when comparing different stepwise fitted models.

Usage

sjt.lmer(..., pred.labels = NULL, depvar.labels = NULL,
  remove.estimates = NULL, group.pred = FALSE, p.numeric = TRUE,
  emph.p = TRUE, p.kr = TRUE, separate.ci.col = TRUE, newline.ci = TRUE,
  show.est = TRUE, show.std = NULL, show.ci = TRUE, show.se = FALSE,
  show.header = FALSE, show.col.header = TRUE, show.r2 = TRUE,
  show.icc = TRUE, show.re.var = TRUE, show.fstat = FALSE,
  show.aic = FALSE, show.aicc = FALSE, show.dev = FALSE,
  string.pred = "Predictors", string.dv = "Dependent Variables",
  string.interc = "(Intercept)", string.obs = "Observations",
  string.est = "B", string.std = "std. Beta", string.ci = "CI",
  string.se = "std. Error", string.p = "p",
  ci.hyphen = " – ", minus.sign = "-", digits.est = 2,
  digits.std = 2, digits.p = 3, digits.ci = 2, digits.se = 2,
  digits.summary = 3, cell.spacing = 0.2, cell.gpr.indent = 0.6,
  CSS = NULL, encoding = NULL, file = NULL, use.viewer = TRUE,
  no.output = FALSE, remove.spaces = TRUE)

Arguments

Value

Invisibly returns
  • the web page style sheet (page.style),
  • the web page content (page.content),
  • the complete html-output (output.complete) and
  • the html-table with inline-css for use with knitr (knitr)
for further use.

Details

See 'Details' in sjt.frq.

See Also

http://strengejacke.de/sjPlot/sjt.lmer/{sjPlot manual: sjt.lmer} and sjt.lm for further examples.

Examples

Run this code
library(lme4)
library(sjmisc)
data(efc)

# prepare group variable
efc$grp = as.factor(efc$e15relat)
levels(x = efc$grp) <- get_labels(efc$e15relat)
efc$care.level <- as.factor(sjmisc::rec(efc$n4pstu, "0=0;1=1;2=2;3:4=4"))
levels(x = efc$care.level) <- c("none", "I", "II", "III")

# data frame for fitted model
mydf <- data.frame(neg_c_7 = efc$neg_c_7,
                   sex = efc$c161sex,
                   c12hour = efc$c12hour,
                   barthel = efc$barthtot,
                   education = to_factor(efc$c172code),
                   grp = efc$grp,
                   carelevel = efc$care.level)
                   
# fit three sample models
fit1 <- lmer(neg_c_7 ~ sex + c12hour + barthel + (1|grp), data = mydf)
fit2 <- lmer(neg_c_7 ~ sex + c12hour + education + barthel + (1|grp), data = mydf)
fit3 <- lmer(neg_c_7 ~ sex + c12hour + education + barthel + 
              (1|grp) + (1|carelevel), data = mydf)

# print summary table... automatic grouping does not work here,
# barthel-index is printed as category of education (values are
# correct, however, indentation is wrong)
sjt.lmer(fit1, fit2, ci.hyphen = " to ", group.pred = TRUE)

# either change order of models
sjt.lmer(fit2, fit1, group.pred = TRUE)
# or turn off automatic grouping of categorical predictors
sjt.lmer(fit1, fit2, group.pred = FALSE)

# print table, using vector names as labels
sjt.lmer(fit1, fit2, fit3, pred.labels = "")

# show other statistics
sjt.lmer(fit1, fit2, show.aic = TRUE, show.ci = FALSE, 
         show.se = TRUE, p.numeric = FALSE)
           
sjt.lmer(fit1, fit2, fit3, show.aic = TRUE, 
         separate.ci.col = FALSE, newline.ci = FALSE)

# user defined predictor labels
sjt.lmer(fit1, fit2, fit3, pred.labels = c("Elder's gender (female)",
         "Hours of care per week", "Barthel Index", "Educational level (mid)",
         "Educational level (high)"))

Run the code above in your browser using DataLab