tab_model | R Documentation |
tab_model()
creates HTML tables from regression models.
tab_model(
...,
transform,
show.intercept = TRUE,
show.est = TRUE,
show.ci = 0.95,
show.ci50 = FALSE,
show.se = NULL,
show.std = NULL,
std.response = TRUE,
show.p = TRUE,
show.stat = FALSE,
show.df = FALSE,
show.zeroinf = TRUE,
show.r2 = TRUE,
show.icc = TRUE,
show.re.var = TRUE,
show.ngroups = TRUE,
show.fstat = FALSE,
show.aic = FALSE,
show.aicc = FALSE,
show.dev = FALSE,
show.loglik = FALSE,
show.obs = TRUE,
show.reflvl = FALSE,
terms = NULL,
rm.terms = NULL,
order.terms = NULL,
keep = NULL,
drop = NULL,
title = NULL,
pred.labels = NULL,
dv.labels = NULL,
wrap.labels = 25,
bootstrap = FALSE,
iterations = 1000,
seed = NULL,
robust = FALSE,
vcov.fun = NULL,
vcov.type = NULL,
vcov.args = NULL,
string.pred = "Predictors",
string.est = "Estimate",
string.std = "std. Beta",
string.ci = "CI",
string.se = "std. Error",
string.std_se = "standardized std. Error",
string.std_ci = "standardized CI",
string.p = "p",
string.std.p = "std. p",
string.df = "df",
string.stat = "Statistic",
string.std.stat = "std. Statistic",
string.resp = "Response",
string.intercept = "(Intercept)",
strings = NULL,
ci.hyphen = " – ",
minus.sign = "-",
collapse.ci = FALSE,
collapse.se = FALSE,
linebreak = TRUE,
col.order = c("est", "se", "std.est", "std.se", "ci", "std.ci", "ci.inner", "ci.outer",
"stat", "std.stat", "p", "std.p", "df.error", "response.level"),
digits = 2,
digits.p = 3,
digits.rsq = 3,
digits.re = 2,
emph.p = TRUE,
p.val = NULL,
df.method = NULL,
p.style = c("numeric", "stars", "numeric_stars", "scientific", "scientific_stars"),
p.threshold = c(0.05, 0.01, 0.001),
p.adjust = NULL,
case = "parsed",
auto.label = TRUE,
prefix.labels = c("none", "varname", "label"),
bpe = "median",
CSS = css_theme("regression"),
file = NULL,
use.viewer = TRUE,
encoding = "UTF-8"
)
... |
One or more regression models, including glm's or mixed models.
May also be a |
transform |
A character vector, naming a function that will be applied
on estimates and confidence intervals. By default, |
show.intercept |
Logical, if |
show.est |
Logical, if |
show.ci |
Either logical, and if |
show.ci50 |
Logical, if |
show.se |
Logical, if |
show.std |
Indicates whether standardized beta-coefficients should also printed, and if yes, which type of standardization is done. See 'Details'. |
std.response |
Logical, whether the response variable will also be
standardized if standardized coefficients are requested. Setting both
|
show.p |
Logical, if |
show.stat |
Logical, if |
show.df |
Logical, if |
show.zeroinf |
Logical, if |
show.r2 |
Logical, if |
show.icc |
Logical, if |
show.re.var |
Logical, if |
show.ngroups |
Logical, if |
show.fstat |
Logical, if |
show.aic |
Logical, if |
show.aicc |
Logical, if |
show.dev |
Logical, if |
show.loglik |
Logical, if |
show.obs |
Logical, if |
show.reflvl |
Logical, if |
terms |
Character vector with names of those terms (variables) that should
be printed in the table. All other terms are removed from the output. If
|
rm.terms |
Character vector with names that indicate which terms should
be removed from the output Counterpart to |
order.terms |
Numeric vector, indicating in which order the coefficients should be plotted. See examples in this package-vignette. |
keep , drop |
Character containing a regular expression pattern that
describes the parameters that should be included (for |
title |
String, will be used as table caption. |
pred.labels |
Character vector with labels of predictor variables.
If not |
dv.labels |
Character vector with labels of dependent variables of all
fitted models. If |
wrap.labels |
Numeric, determines how many chars of the value, variable or axis labels are displayed in one line and when a line break is inserted. |
bootstrap |
Logical, if |
iterations |
Numeric, number of bootstrap iterations (default is 1000). |
seed |
Numeric, the number of the seed to replicate bootstrapped estimates. If |
robust |
Deprecated. Please use |
vcov.fun |
Variance-covariance matrix used to compute uncertainty
estimates (e.g., for robust standard errors). This argument accepts a
covariance matrix, a function which returns a covariance matrix, or a
string which identifies the function to be used to compute the covariance
matrix. See |
vcov.type |
Deprecated. The |
vcov.args |
List of arguments to be passed to the function identified by
the |
string.pred |
Character vector,used as headline for the predictor column.
Default is |
string.est |
Character vector, used for the column heading of coefficients.
Default is based on the response scale, e.g. for logistic regression models,
|
string.std |
Character vector, used for the column heading of standardized beta coefficients. Default is |
string.ci |
Character vector, used for the column heading of confidence interval values. Default is |
string.se |
Character vector, used for the column heading of standard error values. Default is |
string.std_se |
Character vector, used for the column heading of standard error of standardized coefficients. Default is |
string.std_ci |
Character vector, used for the column heading of confidence intervals of standardized coefficients. Default is |
string.p |
Character vector, used for the column heading of p values. Default is |
string.std.p |
Character vector, used for the column heading of p values. Default is |
string.df |
Character vector, used for the column heading of degrees of freedom. Default is |
string.stat |
Character vector, used for the test statistic. Default is |
string.std.stat |
Character vector, used for the test statistic. Default is |
string.resp |
Character vector, used for the column heading of of the response level for multinominal or categorical models. Default is |
string.intercept |
Character vector, used as name for the intercept parameter. Default is |
strings |
Named character vector, as alternative to arguments like |
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'. |
collapse.ci |
Logical, if |
collapse.se |
Logical, if |
linebreak |
Logical, if |
col.order |
Character vector, indicating which columns should be printed
and in which order. Column names that are excluded from |
digits |
Amount of decimals for estimates |
digits.p |
Amount of decimals for p-values |
digits.rsq |
Amount of decimals for r-squared values |
digits.re |
Amount of decimals for random effects part of the summary table. |
emph.p |
Logical, if |
df.method , p.val |
Method for computing degrees of freedom for p-values,
standard errors and confidence intervals (CI). Only applies to mixed models.
Use |
p.style |
Character, indicating if p-values should be printed as
numeric value ( |
p.threshold |
Numeric vector of length 3, indicating the treshold for
annotating p-values with asterisks. Only applies if
|
p.adjust |
Character vector, if not |
case |
Desired target case. Labels will automatically converted into the
specified character case. See |
auto.label |
Logical, if |
prefix.labels |
Indicates whether the value labels of categorical variables
should be prefixed, e.g. with the variable name or variable label. See
argument |
bpe |
For Stan-models (fitted with the rstanarm- or
brms-package), the Bayesian point estimate is, by default, the median
of the posterior distribution. Use |
CSS |
A |
file |
Destination file, if the output should be saved as file.
If |
use.viewer |
Logical, if |
encoding |
Character vector, indicating the charset encoding used
for variable and value labels. Default is |
Default standardization is done by completely refitting the model on the
standardized data. Hence, this approach is equal to standardizing the
variables before fitting the model, which is particularly recommended for
complex models that include interactions or transformations (e.g., polynomial
or spline terms). When show.std = "std2"
, 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 no standardization
is required.
CSS
-argument?With the CSS
-argument, the visual appearance of the tables
can be modified. To get an overview of all style-sheet-classnames
that are used in this function, see return value page.style
for details.
Arguments for this list have following syntax:
the class-names with "css."
-prefix as argument name and
each style-definition must end with a semicolon
You can add style information to the default styles by using a + (plus-sign) as initial character for the argument attributes. Examples:
css.table = 'border:2px solid red;'
for a solid 2-pixel table border in red.
css.summary = 'font-weight:bold;'
for a bold fontweight in the summary row.
css.lasttablerow = 'border-bottom: 1px dotted blue;'
for a blue dotted border of the last table row.
css.colnames = '+color:green'
to add green color formatting to column names.
css.arc = 'color:blue;'
for a blue text color each 2nd row.
css.caption = '+color:red;'
to add red font-color to the default table caption style.
Invisibly returns
the web page style sheet (page.style
),
the web page content (page.content
),
the complete html-output (page.complete
) and
the html-table with inline-css for use with knitr (knitr
)
for further use.
The HTML tables can either be saved as file and manually opened (use argument file
) or
they can be saved as temporary files and will be displayed in the RStudio Viewer pane (if working with RStudio)
or opened with the default web browser. Displaying resp. opening a temporary file is the
default behaviour (i.e. file = NULL
).
Examples are shown in these three vignettes:
Summary of Regression Models as HTML Table,
Summary of Mixed Models as HTML Table and
Summary of Bayesian Models as HTML Table.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.