sanitize_model_specific: Method to raise model-specific warnings and errors

View source: R/sanity_model.R

sanitize_model_specificR Documentation

Method to raise model-specific warnings and errors

Description

Method to raise model-specific warnings and errors

Usage

sanitize_model_specific(model, ...)

## Default S3 method:
sanitize_model_specific(
  model,
  vcov = NULL,
  calling_function = "marginaleffects",
  ...
)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Value

A warning, an error, or nothing


marginaleffects documentation built on Sept. 3, 2026, 9:08 a.m.