Calculate average adjusted predictions by taking the mean of all the
unit-level adjusted predictions computed by the predictions
function.
# S3 method for predictions
tidy(x, conf_level = 0.95, ...)
An object produced by the predictions
function.
numeric value between 0 and 1. Confidence level to use to build a confidence interval.
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.
A "tidy" data.frame
of summary statistics which conforms to the
broom
package specification.
mod <- lm(mpg ~ hp * wt + factor(gear), data = mtcars)
mfx <- predictions(mod)
tidy(mfx)
#> estimate std.error statistic p.value conf.low conf.high
#> 1: 20.09062 0.3837791 52.34945 0 19.33843 20.84282