Learn R Programming

marginaleffects (version 1.0.0)

sanitize_model_specific: Method to raise model-specific warnings and errors

Description

Method to raise model-specific warnings and errors

Usage

sanitize_model_specific(model, ...)

# S3 method for default sanitize_model_specific( model, vcov = NULL, calling_function = "marginaleffects", ... )

# S3 method for DirichletRegModel sanitize_model_specific(model, calling_function = "marginaleffects", ...)

# S3 method for glimML sanitize_model_specific(model, ...)

# S3 method for betareg sanitize_model_specific(model, ...)

# S3 method for biglm sanitize_model_specific(model, vcov = NULL, ...)

# S3 method for brmsfit sanitize_model_specific(model, ...)

# S3 method for bart sanitize_model_specific(model, calling_function, ...)

# S3 method for fixest sanitize_model_specific( model, vcov = TRUE, calling_function = "predictions", ... )

# S3 method for gamlss sanitize_model_specific(model, calling_function, ...)

# S3 method for glmmTMB sanitize_model_specific(model, vcov = TRUE, re.form, ...)

# S3 method for merMod sanitize_model_specific(model, re.form, vcov = TRUE, ...)

# S3 method for mblogit sanitize_model_specific(model, calling_function = "marginaleffects", ...)

# S3 method for mlogit sanitize_model_specific(model, calling_function = NULL, ...)

# S3 method for Learner sanitize_model_specific(model, calling_function, ...)

# S3 method for mmrm sanitize_model_specific(model, ...)

# S3 method for clm sanitize_model_specific(model, ...)

# S3 method for clmm2 sanitize_model_specific(model, ...)

# S3 method for plm sanitize_model_specific(model, ...)

# S3 method for rqs sanitize_model_specific(model, ...)

# S3 method for rms sanitize_model_specific(model, ...)

# S3 method for orm sanitize_model_specific(model, ...)

# S3 method for lrm sanitize_model_specific(model, ...)

# S3 method for ols sanitize_model_specific(model, ...)

# S3 method for svyolr sanitize_model_specific(model, calling_function = NULL, ...)

# S3 method for svyglm sanitize_model_specific(model, calling_function = NULL, ...)

# S3 method for coxph sanitize_model_specific(model, vcov, ...)

# S3 method for svy_vglm sanitize_model_specific(model, calling_function = NULL, ...)

Value

A warning, an error, or nothing

Arguments

model

Model object

...

Additional arguments are passed to the predict() method supplied by the modeling package.These arguments are particularly useful for mixed-effects or bayesian models (see the online vignettes on the marginaleffects website). Available arguments can vary from model to model, depending on the range of supported arguments by each modeling package. See the "Model-Specific Arguments" section of the ?slopes documentation for a non-exhaustive list of available arguments.

vcov

Type of uncertainty estimates to report (e.g., for robust standard errors). Acceptable values:

  • FALSE: Do not compute standard errors. This can speed up computation considerably.

  • TRUE: Unit-level standard errors using the default vcov(model) variance-covariance matrix.

  • String which indicates the kind of uncertainty estimates to return.

    • Heteroskedasticity-consistent: "HC", "HC0", "HC1", "HC2", "HC3", "HC4", "HC4m", "HC5". See ?sandwich::vcovHC

    • Heteroskedasticity and autocorrelation consistent: "HAC"

    • Unconditional: "unconditional" accounts for sampling variation in the empirical covariate distribution for averaged or aggregated predictions, comparisons, and slopes. Hypotheses applied directly to unit-level effects are rejected. Use vcovUnconditional(cluster = ~cluster) for one-way clustered unconditional inference.

    • Mixed-Models degrees of freedom: "satterthwaite", "kenward-roger"

    • Other: "NeweyWest", "KernHAC", "OPG". See the sandwich package documentation.

    • "rsample", "boot", "fwb", or "simulation": forward the result to inferences() using that method.

  • One-sided formula which indicates the name of cluster variables (e.g., ~unit_id). This formula is passed to the cluster argument of the sandwich::vcovCL function.

  • Square covariance matrix

  • Function which returns a covariance matrix (e.g., stats::vcov(model))