Skip to contents

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))

Usage

get_estimates(model, conf_level = 0.95, vcov = NULL, shape = NULL, ...)

Arguments

model

a single model object

conf_level

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.

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. "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.

shape

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

...

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