Learn R Programming

marginaleffects (version 0.8.1)

tidy.predictions: Tidy a predictions object

Description

Calculate average adjusted predictions by taking the mean of all the unit-level adjusted predictions computed by the predictions function.

Usage

# S3 method for predictions
tidy(x, conf_level = NULL, transform_avg = NULL, ...)

Value

A "tidy" data.frame of summary statistics which conforms to the broom package specification.

Arguments

x

An object produced by the predictions function.

conf_level

numeric value between 0 and 1. Confidence level to use to build a confidence interval. The default NULL uses the conf_level value used in the original call to predictions().

transform_avg

A function applied to the estimates and confidence intervals after the unit-level estimates have been averaged.

...

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.

See Also

Other summary: glance.marginaleffects(), reexports, summary.comparisons(), summary.marginaleffects(), summary.marginalmeans(), summary.predictions(), tidy.comparisons(), tidy.deltamethod(), tidy.marginaleffects(), tidy.marginalmeans()

Examples

Run this code
mod <- lm(mpg ~ hp * wt + factor(gear), data = mtcars)
mfx <- predictions(mod)
tidy(mfx)

Run the code above in your browser using DataLab