This function is superseded by the group argument of the modelsummary function.

modelsummary_wide(
  models,
  output = "default",
  fmt = 3,
  estimate = "estimate",
  statistic = "std.error",
  vcov = NULL,
  conf_level = 0.95,
  stars = FALSE,
  coef_group = NULL,
  coef_map = NULL,
  coef_omit = NULL,
  coef_rename = NULL,
  gof_map = NULL,
  gof_omit = NULL,
  add_rows = NULL,
  align = NULL,
  notes = NULL,
  title = NULL,
  stacking = "horizontal",
  ...
)

Arguments

models

a model or (optionally named) list of models

output

filename or object type (character string)

  • Supported filename extensions: .html, .tex, .md, .txt, .png, .jpg.

  • Supported object types: "default", "html", "markdown", "latex", "latex_tabular", "data.frame", "modelsummary_list", "gt", "kableExtra", "huxtable", "flextable", "jupyter".

  • Warning: Users should not supply a file name to the output argument if they intend to customize the table with external packages. See the 'Details' section.

  • LaTeX compilation requires the booktabs and siunitx packages, but siunitx can be disabled or replaced with global options. See the 'Details' section.

  • The default output formats and table-making packages can be modified with global options. See the 'Details' section.

fmt

determines how to format numeric values

  • integer: the number of digits to keep after the period format(round(x, fmt), nsmall=fmt)

  • character: passed to the sprintf function (e.g., '%.3f' keeps 3 digits with trailing zero). See ?sprintf

  • function: returns a formatted character string.

  • Note on LaTeX formatting: To ensure proper typography, all numeric entries are enclosed in the \num{} command from the siunitx LaTeX package by default. This behavior can be altered with global options. See the 'Details' section.

estimate

string or glue string of the estimate to display (or a vector with one string per model). Valid entries include any column name of the data.frame produced by get_estimates(model). Examples:

  • "estimate"

  • "{estimate} ({std.error}){stars}"

  • "{estimate} [{conf.low}, {conf.high}]"

statistic

vector of strings or glue strings which select uncertainty statistics to report vertically below the estimate. NULL omits all uncertainty statistics.

  • "conf.int", "std.error", "statistic", "p.value", "conf.low", "conf.high", or any column name produced by: get_estimates(model)

  • glue package strings with braces, such as:

    • "{p.value} [{conf.low}, {conf.high}]"

    • "Std.Error: {std.error}"

  • Note: Parentheses are added automatically unless the string includes glue curly braces {}.

  • Note: To report uncertainty statistics next to coefficients, you can #' supply a glue string to the estimate argument.

vcov

robust standard errors and other manual statistics. The vcov argument accepts six types of input (see the 'Details' and 'Examples' sections below):

  • NULL returns the default uncertainty estimates of the model object

  • string, vector, or (named) list of strings. Omitting or specifying vcov = NULL will return the model's default uncertainty estimates, e.g. IID errors for standard models. Alternatively, use the string "iid" (aliases: "classical" or "constant") to present IID errors explicitly. The strings "HC", "HC0", "HC1" (alias: "stata"), "HC2", "HC3" (alias: "robust"), "HC4", "HC4m", "HC5", "HAC", "NeweyWest", "Andrews", "panel-corrected", "outer-product", and "weave" use variance-covariance matrices computed using functions from the sandwich package, or equivalent method. The behavior of those functions can (and sometimes must) be altered by passing arguments to sandwich directly from modelsummary through the ellipsis (...), but it is safer to define your own custom functions as described in the next bullet.

  • function or (named) list of functions which return variance-covariance matrices with row and column names equal to the names of your coefficient estimates (e.g., stats::vcov, sandwich::vcovHC, function(x) vcovPC(x, cluster="country")).

  • formula or (named) list of formulas with the cluster variable(s) on the right-hand side (e.g., ~clusterid).

  • (named) list of length(models) variance-covariance matrices with row and column names equal to the names of your coefficient estimates.

  • a (named) list of length(models) vectors with names equal to the names of your coefficient estimates. See 'Examples' section below. Warning: since this list of vectors can include arbitrary strings or numbers, modelsummary cannot automatically calculate p values. The stars argument may thus use incorrect significance thresholds when vcov is a list of vectors.

conf_level

confidence level to use for confidence intervals

stars

to indicate statistical significance

  • FALSE (default): no significance stars.

  • TRUE: +=.1, *=.05, **=.01, ***=0.001

  • Named numeric vector for custom stars such as c('*' = .1, '+' = .05)

  • Note: a legend will not be inserted at the bottom of the table when the estimate or statistic arguments use "glue strings" with {stars}.

coef_group

the name of the coefficient groups to use as columns (NULL or character). If coef_group is NULL, modelsummary tries to guess the correct coefficient group identifier. To be valid, this identifier must be a column in the data.frame produced by get_estimates(model).

coef_map

character vector. Subset, rename, and reorder coefficients. Coefficients omitted from this vector are omitted from the table. The order of the vector determines the order of the table. coef_map can be a named or an unnamed character vector (see the Examples section below). If coef_map is a named vector, its values define the labels that must appear in the table, and its names identify the original term names stored in the model object: c("hp:mpg"="HPxM/G").

coef_omit

string regular expression. Omits all matching coefficients from the table using grepl(perl=TRUE). This argument uses perl-compatible regular expressions, which allows expressions such as "Int|ABC" which omits coefficients matching either "Int" or "ABC", and "^(?!.*Intercept)"` which omits every term except the intercept.

coef_rename

named character vector or function which returns a named vector. Values of the vector refer to the variable names that will appear in the table. Names refer to the original term names stored in the model object, e.g. c("hp:mpg"="hp X mpg") for an interaction term. If you provide a function to coef_rename, modelsummary will create a named vector for you by deriving the new variable names from the vector of original term names with your function.

gof_map

rename, reorder, and omit goodness-of-fit statistics and other model information. This argument accepts 3 types of values:

  • NULL (default): the modelsummary::gof_map dictionary is used for formatting, and all unknown statistic are included.

  • data.frame with 3 columns named "raw", "clean", "fmt". Unknown statistics are omitted. See the 'Examples' section below.

  • list of lists, each of which includes 3 elements named "raw", "clean", "fmt". Unknown statistics are omitted. See the 'Examples section below'.

gof_omit

string regular expression. Omits all matching gof statistics from the table. This argument uses perl-compatible regular expressions (grepl(perl=TRUE)), which allows expressions such as ".*" which omits everything, and "^(?!R2|Num)" which omits every term except those that start with "R2" or "Num".

add_rows

a data.frame (or tibble) with the same number of columns as your main table. By default, rows are appended to the bottom of the table. You can define a "position" attribute of integers to set the row positions. See Examples section below.

align

A string with a number of characters equal to the number of columns in the table (e.g., align = "lcc"). Valid characters: l, c, r, S.

  • "l": left-aligned column

  • "c": centered column

  • "r": right-aligned column

  • "d": dot-aligned column. Only supported for LaTeX/PDF tables produced by kableExtra. These commands must appear in the LaTeX preamble (they are added automatically when compiling Rmarkdown documents to PDF):

    • \usepackage{booktabs}

    • \usepackage{siunitx}

    • \newcolumntype{d}{S[input-symbols = ()]}

notes

list or vector of notes to append to the bottom of the table.

title

string

stacking

direction in which models are stacked: "horizontal" or "vertical"

...

all other arguments are passed through to the extractor and table-making functions. This allows users to pass arguments directly to modelsummary in order to affect the behavior of other functions behind the scenes. Examples include:

  • broom::tidy(exponentiate=TRUE) to exponentiate logistic regression. Please see the modelsummary vignette on the package website for important technical notes on this topic.

  • performance::model_performance(metrics="RMSE") to select goodness-of-fit statistics to extract using the performance package (must have set options(modelsummary_get="easystats") first).

Value

a regression table in a format determined by the output argument.