View source: R/marginal_tidiers.R
tidy_margins | R Documentation |
margins::margins()
tidy_margins(x, conf.int = TRUE, conf.level = 0.95, ...)
x |
(a model object, e.g. |
conf.int |
( |
conf.level |
( |
... |
Additional parameters passed to |
The margins
package is no longer under active development and may be
removed from CRAN sooner or later. It is advised to use the marginaleffects
package instead, offering more functionalities. You could have a look at the
article
dedicated to marginal estimates with broom.helpers
. tidy_avg_slopes()
could be used as an alternative.
Use margins::margins()
to estimate average marginal effects (AME) and
return a tibble tidied in a way that it could be used by broom.helpers
functions. See margins::margins()
for a list of supported models.
By default, margins::margins()
estimate average marginal effects (AME): an
effect is computed for each observed value in the original dataset before
being averaged.
For more information, see vignette("marginal_tidiers", "broom.helpers")
.
When applying margins::margins()
, custom contrasts are ignored.
Treatment contrasts (stats::contr.treatment()
) are applied to all
categorical variables. Interactions are also ignored.
margins::margins()
Other marginal_tieders:
tidy_all_effects()
,
tidy_avg_comparisons()
,
tidy_avg_slopes()
,
tidy_ggpredict()
,
tidy_marginal_contrasts()
,
tidy_marginal_means()
,
tidy_marginal_predictions()
df <- Titanic |>
dplyr::as_tibble() |>
tidyr::uncount(n) |>
dplyr::mutate(Survived = factor(Survived, c("No", "Yes")))
mod <- glm(
Survived ~ Class + Age + Sex,
data = df, family = binomial
)
tidy_margins(mod)
tidy_plus_plus(mod, tidy_fun = tidy_margins)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.