## S3 method for class 'marginaleffects' tidy(x, conf_level = NULL, ...)
An object produced by the
numeric value between 0 and 1. Confidence level to use to build a confidence interval. The default
Additional arguments are passed to the
tidy function calculates average marginal effects by taking the mean
of all the unit-level marginal effects computed by the
The standard error of the average marginal effects is obtained by taking the mean of each column of the Jacobian. . Then, we use this "Jacobian at the mean" in the Delta method to obtained standard errors.
In Bayesian models (e.g.,
brms), we compute Average Marginal
Effects by applying the mean function twice. First, we apply it to all
marginal effects for each posterior draw, thereby estimating one Average (or
Median) Marginal Effect per iteration of the MCMC chain. Second, we take
quantile function to the results of Step 1 to obtain the
Average (or Median) Marginal Effect and its associated interval.
data.frame of summary statistics which conforms to the
broom package specification.
mod <- lm(mpg ~ hp * wt + factor(gear), data = mtcars) mfx <- marginaleffects(mod) # average marginal effects tidy(mfx)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.