Learn R Programming

marginaleffects (version 0.31.0)

refit: Refit a marginaleffects object with new data

Description

Refit a marginaleffects object with new data

Usage

refit(object, ...)

# S3 method for marginaleffects refit(object, data = NULL, newdata = NULL, vcov = NULL, ...)

# S3 method for predictions refit(object, data = NULL, newdata = NULL, vcov = NULL, ...)

# S3 method for comparisons refit(object, data = NULL, newdata = NULL, vcov = NULL, ...)

# S3 method for slopes refit(object, data = NULL, newdata = NULL, vcov = NULL, ...)

# S3 method for hypotheses refit(object, data = NULL, newdata = NULL, vcov = NULL, ...)

Value

A marginaleffects object

Arguments

object

A marginaleffects object (predictions, comparisons, or slopes)

...

Additional arguments passed to methods

data

Optional data frame to refit the underlying model

newdata

Optional data frame to re-evaluate the marginaleffects call

vcov

Optional logical or variance-covariance matrix specification to pass to the marginaleffects call

Details

If data is supplied, the underlying model is refitted using that data. If newdata is supplied, the marginaleffects call is re-evaluated with the new data. Both can be supplied together to refit the model and make predictions on new data.