Learn R Programming

marginaleffects (version 0.4.1)

tidy.comparisons: Tidy a comparisons object

Description

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

Usage

# S3 method for comparisons
tidy(x, conf.int = TRUE, conf.level = 0.95, ...)

Arguments

x

An object produced by the comparisons function.

conf.int

Logical indicating whether or not to include a confidence interval.

conf.level

The confidence level to use for the confidence interval if conf.int=TRUE. Must be strictly greater than 0 and less than 1. Defaults to 0.95, which corresponds to a 95 percent confidence interval.

...

Additional arguments are passed to the predict() method used to compute adjusted predictions. 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 document for a non-exhaustive list of available arguments.

Value

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

Examples

Run this code
# NOT RUN {
mod <- lm(mpg ~ factor(gear), data = mtcars)
contr <- comparisons(mod, contrast_factor = "sequential")
tidy(contr)
# }

Run the code above in your browser using DataLab