sanity_model_specific: Method to raise model-specific warnings and errors

sanity_model_specific.betaregR Documentation

Method to raise model-specific warnings and errors

Description

Method to raise model-specific warnings and errors

Usage

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

sanity_model_specific(model, calling_function = "marginaleffects", ...)

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

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

## S3 method for class 'glmmTMB'
sanity_model_specific(
  model,
  vcov = NULL,
  calling_function = "marginaleffects",
  ...
)

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

## S3 method for class 'mlogit'
sanity_model_specific(model, newdata, ...)

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

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

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

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

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 ?marginaleffects 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"

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

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

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

newdata

NULL, data frame, string, or datagrid() call. Determines the predictor values for which to compute marginal effects.

  • NULL (default): Unit-level marginal effects for each observed value in the original dataset.

  • data frame: Unit-level marginal effects for each row of the newdata data frame.

  • string:

    • "mean": Marginal Effects at the Mean. Marginal effects when each predictor is held at its mean or mode.

    • "median": Marginal Effects at the Median. Marginal effects when each predictor is held at its median or mode.

    • "marginalmeans": Marginal Effects at Marginal Means. See Details section below.

    • "tukey": Marginal Effects at Tukey's 5 numbers.

    • "grid": Marginal Effects on a grid of representative numbers (Tukey's 5 numbers and unique values of categorical predictors).

  • datagrid() call to specify a custom grid of regressors. For example:

    • newdata = datagrid(cyl = c(4, 6)): cyl variable equal to 4 and 6 and other regressors fixed at their means or modes.

    • See the Examples section and the datagrid() documentation.

Value

A warning, an error, or nothing


marginaleffects documentation built on Nov. 24, 2022, 1:06 a.m.