View source: R/get_marginalmeans.R
get_marginalcontrasts | R Documentation |
The get_marginalmeans()
function is a wrapper to facilitate the usage of
marginaleffects::avg_predictions()
and marginaleffects::avg_slopes()
,
providing a somewhat simpler and intuitive API to find the specifications and
variables of interest. It is meanly made to for the developers to facilitate
the organization and debugging, and end-users should rather use the
estimate_*()
series of functions.
get_marginalcontrasts(model, by = NULL, ci = 0.95, method = "pairwise", ...)
model_marginalcontrasts(model, by = NULL, ci = 0.95, method = "pairwise", ...)
get_marginaleffects(model, trend = NULL, by = NULL, ...)
get_marginalmeans(model, by = "auto", transform = NULL, ci = 0.95, ...)
model_marginalmeans(model, by = "auto", transform = NULL, ci = 0.95, ...)
model |
A statistical model. |
by |
The predictor variable(s) at which to evaluate the desired effect / mean / contrasts. Other predictors of the model that are not included here will be collapsed and "averaged" over (the effect will be estimated across them). |
ci |
Level for confidence intervals. |
method |
Contrast method. |
... |
Other arguments passed, for instance, to |
trend |
A character indicating the name of the variable for which to compute the slopes. |
transform |
Can be used to easily modulate the |
model <- lm(Sepal.Width ~ Species * Petal.Length, data = iris)
get_marginaleffects(model, trend = "Petal.Length", by = "Species")
get_marginaleffects(model, trend = "Petal.Length", by = "Petal.Length")
get_marginaleffects(model, trend = "Petal.Length", by = c("Species", "Petal.Length"))
model <- lm(Sepal.Length ~ Species + Petal.Width, data = iris)
# By default, 'by' is set to "Species"
get_marginalmeans(model)
# Overall mean (close to 'mean(iris$Sepal.Length)')
get_marginalmeans(model, by = NULL)
# One can estimate marginal means at several values of a 'modulate' variable
get_marginalmeans(model, by = "Petal.Width", length = 3)
# Interactions
model <- lm(Sepal.Width ~ Species * Petal.Length, data = iris)
get_marginalmeans(model)
get_marginalmeans(model, by = c("Species", "Petal.Length"), length = 2)
get_marginalmeans(model, by = c("Species", "Petal.Length = c(1, 3, 5)"), length = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.