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

Description Usage Arguments Details Value Note

View source: R/sjTabLinReg.R

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
sjt.lmer(..., pred.labels = NULL, depvar.labels = NULL,
  remove.estimates = NULL, group.pred = FALSE, p.numeric = TRUE,
  emph.p = FALSE, p.zero = FALSE, 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, sep.column = TRUE, CSS = NULL,
  encoding = NULL, file = NULL, use.viewer = TRUE,
  remove.spaces = TRUE)

Arguments

...

One or more regression models, including glm's or mixed models. May also be a list with fitted models. See 'Examples'.

pred.labels

Character vector with labels of predictor variables. If not NULL, pred.labels will be used in the first table column with the predictors' names. By default, if auto.label = TRUE and get_term_labels is called to retrieve the labels of the coefficients, which will be used as predictor labels. If pred.labels = "" or auto.label = FALSE, the raw variable names as used in the model formula are used as predictor labels. If pred.labels is a named vector, predictor labels (by default, the names of the model's coefficients) will be matched with the names of pred.labels. This ensures that labels always match the related predictor in the table, no matter in which way the predictors are sorted. See 'Examples'.

depvar.labels

Character vector with labels of dependent variables of all fitted models. See 'Examples'.

remove.estimates

Numeric vector with indices (order equals to row index of coef(fit)) or character vector with coefficient names that indicate which estimates should be removed from the table output. The first estimate is the intercept, followed by the model predictors. The intercept cannot be removed from the table output! remove.estimates = c(2:4) would remove the 2nd to the 4th estimate (1st to 3rd predictor after intercept) from the output. remove.estimates = "est_name" would remove the estimate est_name. Default is NULL, i.e. all estimates are printed.

group.pred

Logical, if TRUE (default), automatically groups table rows with factor levels of same factor, i.e. predictors of type factor will be grouped, if the factor has more than two levels. Grouping means that a separate headline row is inserted to the table just before the predictor values.

p.numeric

Logical, if TRUE, the p-values are printed as numbers. If FALSE (default), asterisks are used.

emph.p

Logical, if TRUE, significant p-values are shown bold faced.

p.zero

logical, if TRUE, p-values have a leading 0 before the period (e.g. 0.002), else p-values start with a period and without a zero (e.g. .002).

p.kr

Logical, if TRUE, the computation of p-values is based on conditional F-tests with Kenward-Roger approximation for the df.

separate.ci.col

Logical, if TRUE, the CI values are shown in a separate table column. Default is FALSE.

newline.ci

Logical, if TRUE and separate.ci.col = FALSE, inserts a line break between estimate and CI values. If FALSE, CI values are printed in the same line as estimate values.

show.est

Logical, if TRUE, the estimates are printed.

show.std

Indicates whether standardized beta-coefficients should also printed, and if yes, which type of standardization is done. See 'Details'.

show.ci

Either logical, and if TRUE, the confidence intervals is printed to the table; if FALSE, confidence intervals are omitted. Or numeric, between 0 and 1, indicating the range of the confidence intervals.

show.se

Logical, if TRUE, the standard errors are also printed.

show.header

Logical, if TRUE, the header strings string.pred and string.dv are shown. By default, they're hidden.

show.col.header

Logical, if TRUE (default), the table data columns have a headline with abbreviations for estimates, std. beta-values, confidence interval and p-values.

show.r2

Logical, if TRUE, the r-squared value is also printed. Depending on the model, these might be pseudo-r-squared values, or Bayesian r-squared etc. See r2 for details.

show.icc

Logical, if TRUE, prints the intraclass correlation coefficient for mixed models. See icc for details.

show.re.var

Logical, if TRUE, prints the random effect variances for mixed models. See re_var for details.

show.fstat

Logical, if TRUE, the F-statistics for each model is printed in the table summary. This option is not supported by all model types.

show.aic

Logical, if TRUE, the AIC value for each model is printed in the table summary.

show.aicc

Logical, if TRUE, the second-order AIC value for each model is printed in the table summary.

show.dev

Logical, if TRUE, shows the deviance of the model.

string.pred

Character vector,used as headline for the predictor column. Default is "Predictors".

string.dv

Character vector, used as headline for the dependent variable columns. Default is "Dependent Variables".

string.interc

Character vector, used as headline for the Intercept row. Default is "Intercept".

string.obs

character vector, used in the summary row for the count of observation (cases). Default is "Observations".

string.est

Character vector, used for the column heading of estimates.

string.std

Character vector, used for the column heading of standardized beta coefficients. Default is "std. Beta".

string.ci

Character vector, used for the column heading of confidence interval values. Default is "CI".

string.se

Character vector, used for the column heading of standard error values. Default is "std. Error".

string.p

Character vector, used for the column heading of p values. Default is "p".

ci.hyphen

Character vector, indicating the hyphen for confidence interval range. May be an HTML entity. See 'Examples'.

minus.sign

string, indicating the minus sign for negative numbers. May be an HTML entity. See 'Examples'.

digits.est

Amount of decimals for table values.

digits.std

Amount of decimals for standardized beta.

digits.p

Amount of decimals for p-values

digits.ci

Amount of decimals for confidence intervals.

digits.se

Amount of decimals for standard error.

digits.summary

Amount of decimals for values in model summary.

cell.spacing

Numeric, inner padding of table cells. By default, this value is 0.2 (unit is cm), which is suitable for viewing the table. Decrease this value (0.05 to 0.1) if you want to import the table into Office documents. This is a convenient argument for the CSS argument for changing cell spacing, which would be: CSS = list(css.thead = "padding:0.2cm;", css.tdata = "padding:0.2cm;").

cell.gpr.indent

Indent for table rows with grouped factor predictors. Only applies if group.pred = TRUE.

sep.column

Logical, if TRUE, an empty table column is added after each model column, to add margins between model columns. By default, this column will be added to the output; however, when copying tables to office applications, it might be helpful not to add this separator column when modifying the table layout.

CSS

A list with user-defined style-sheet-definitions, according to the official CSS syntax. See 'Details' or this package-vignette.

encoding

String, indicating the charset encoding used for variable and value labels. Default is NULL, so encoding will be auto-detected depending on your platform (e.g., "UTF-8" for Unix and "Windows-1252" for Windows OS). Change encoding if specific chars are not properly displayed (e.g. German umlauts).

file

Destination file, if the output should be saved as file. If NULL (default), the output will be saved as temporary file and openend either in the IDE's viewer pane or the default web browser.

use.viewer

Logical, if TRUE, the HTML table is shown in the IDE's viewer pane. If FALSE or no viewer available, the HTML table is opened in a web browser.

remove.spaces

Logical, if TRUE, leading spaces are removed from all lines in the final string that contains the html-data. Use this, if you want to remove parantheses for html-tags. The html-source may look less pretty, but it may help when exporting html-tables to office tools.

Details

Concerning the show.std argument, show.std = "std" will print normal standardized estimates. For show.std = "std2", however, standardization of estimates follows Gelman's (2008) suggestion, rescaling the estimates by dividing them by two standard deviations instead of just one. Resulting coefficients are then directly comparable for untransformed binary predictors. For backward compatibility reasons, show.std also may be a logical value; if TRUE, normal standardized estimates are printed (same effect as show.std = "std"). Use show.std = NULL (default) or show.std = FALSE, if standardized estimats should not be printed.

Computation of p-values (if necessary and if p.kr = TRUE) are based on conditional F-tests with Kenward-Roger approximation for the df, using the pbkrtest-package. If pbkrtest is not available or p.kr = FALSE, computation of p-values is based on normal-distribution assumption, treating the t-statistics as Wald z-statistics. See 'Details' in p_value.

The confidence intervals stem from broom's tidy-function. For linear mixed models, the computation method is "Wald" (lme4::confint.merMod(fit, method = "Wald")).

Value

Invisibly returns

for further use.

Note

The variance components of the random effects (see show.re.var) are denoted like:


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