Allow users to override uncertainty estimates
get_vcov(model, vcov = NULL, ...)
a numeric vector of test statistics
object type with an available tidy
method.
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. "BS", "bootstrap", "residual", "mammen", "webb", "xy", "wild" use the sandwich::vcovBS()
. 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.
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
, include_reference
, 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.
tinytable::tt, kableExtra::kbl or gt::gt draw tables, depending on the value of the output
argument. For example, by default modelsummary
creates tables with tinytable::tt, which accepts a width
and theme
arguments.