View source: R/tidy.comparisons.R
tidy.comparisons | R Documentation |
comparisons
objectCalculate average contrasts by taking the mean of all the
unit-level contrasts computed by the predictions
function.
## S3 method for class 'comparisons' tidy(x, conf_level = NULL, transform_avg = NULL, ...)
x |
An object produced by the |
conf_level |
numeric value between 0 and 1. Confidence level to use to build a confidence interval. The default |
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 |
To compute standard errors around the average marginaleffects, we begin by applying the mean function to each column of the Jacobian. Then, we use this matrix 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
calculate the mean and the quantile
function to the results of Step 1 to
obtain the Average Marginal Effect and its associated interval.
A "tidy" data.frame
of summary statistics which conforms to the
broom
package specification.
Other summary:
glance.marginaleffects()
,
reexports
,
summary.comparisons()
,
summary.marginaleffects()
,
summary.marginalmeans()
,
summary.predictions()
,
tidy.deltamethod()
,
tidy.marginaleffects()
,
tidy.marginalmeans()
,
tidy.predictions()
mod <- lm(mpg ~ factor(gear), data = mtcars) contr <- comparisons(mod, variables = list(gear = "sequential")) tidy(contr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.