get_vcov.mlm: Allow users to override uncertainty estimates

View source: R/methods_stats.R

get_vcov.mlmR Documentation

Allow users to override uncertainty estimates

Description

Allow users to override uncertainty estimates

Usage

## S3 method for class 'mlm'
get_vcov(model, vcov = NULL, conf_level = NULL, ...)

Arguments

model

object type with an available tidy method.

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.

...

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.

Value

a numeric vector of test statistics


modelsummary documentation built on Oct. 15, 2023, 5:06 p.m.