get_estimates: Extract model estimates in a tidy format.

View source: R/get_estimates.R

get_estimatesR Documentation

Extract model estimates in a tidy format.


This is a mostly internal function which could be useful to users who want a unified approach to extract results from a wide variety of models. For some models get_estimates attaches useful attributes to the output. You can access this information by calling the attributes function: attributes(get_estimates(model))


  conf_level = 0.95,
  vcov = NULL,
  shape = NULL,
  coef_rename = FALSE,



a single model object


numeric value between 0 and 1. confidence level to use for confidence intervals. Setting this argument to NULL does not extract confidence intervals, which can be faster for some models.


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. "iid", "classical", and "constant" are aliases for NULL, which returns the model's default uncertainty estimates. 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.


formula which determines the shape of the table. The left side determines what appears on rows, and the right side determines what appears on columns. The formula can include a group identifier to display related terms together, which can be useful for models with multivariate outcomes or grouped coefficients (See examples section below). This identifier must be one of the column names produced by: get_estimates(model). The group identifier can be combined with the term identifier in a single column by using the colon to represent an interaction. If an incomplete formula is supplied (e.g., ~statistic), modelsummary tries to complete it automatically. Potential shape values include:

  • term + statistic ~ model: default

  • term ~ model + statistic: statistics in separate columns

  • model + statistic ~ term: models in rows and terms in columns

  • term + response + statistic ~ model: term and group id in separate columns

  • term : response + statistic ~ model: term and group id in a single column

  • term ~ response


logical, named or unnamed character vector, or function

  • Logical: TRUE renames variables based on the "label" attribute of each column. See the Example section below.

  • Unnamed character vector of length equal to the number of coefficients in the final table, after coef_omit is applied.

  • Named character vector: Values refer to the variable names that will appear in the table. Names refer to the original term names stored in the model object. Ex: c("hp:mpg"="hp X mpg")

  • Function: Accepts a character vector of the model's term names and returns a named vector like the one described above. The modelsummary package supplies a coef_rename() function which can do common cleaning tasks: modelsummary(model, coef_rename = coef_rename)


all other arguments are passed through to three functions. See the documentation of these functions for lists of available arguments.

  • parameters::model_parameters extracts parameter estimates. Available arguments depend on model type, but include:

    • standardize, centrality, dispersion, test, ci_method, prior, diagnostic, rope_range, power, cluster, etc.

  • performance::model_performance extracts goodness-of-fit statistics. Available arguments depend on model type, but include:

    • metrics, estimator, etc.

  • kableExtra::kbl or gt::gt draw tables, depending on the value of the output argument.

modelsummary documentation built on Nov. 27, 2022, 1:05 a.m.