model_get_pairwise_contrasts {broom.helpers} | R Documentation |
Get pairwise comparison of the levels of a categorical variable
Description
It is computed with emmeans::emmeans()
.
Usage
model_get_pairwise_contrasts(
model,
variables,
pairwise_reverse = TRUE,
contrasts_adjust = NULL,
conf.level = 0.95,
emmeans_args = list()
)
Arguments
model |
a model object |
variables |
names of variables to add pairwise contrasts |
pairwise_reverse |
determines whether to use |
contrasts_adjust |
optional adjustment method when computing contrasts,
see |
conf.level |
level of confidence for confidence intervals |
emmeans_args |
list of additional parameter to pass to
|
Details
For pscl::zeroinfl()
and pscl::hurdle()
models, pairwise contrasts are
computed separately for each component, using mode = "count"
and
mode = "zero"
(see documentation of emmeans
) and a component column
is added to the results. This support is still experimental.
See Also
Other model_helpers:
model_compute_terms_contributions()
,
model_get_assign()
,
model_get_coefficients_type()
,
model_get_contrasts()
,
model_get_model()
,
model_get_model_frame()
,
model_get_model_matrix()
,
model_get_n()
,
model_get_nlevels()
,
model_get_offset()
,
model_get_response()
,
model_get_response_variable()
,
model_get_terms()
,
model_get_weights()
,
model_get_xlevels()
,
model_identify_variables()
,
model_list_contrasts()
,
model_list_higher_order_variables()
,
model_list_terms_levels()
,
model_list_variables()
Examples
if (.assert_package("emmeans", boolean = TRUE)) {
mod <- lm(Sepal.Length ~ Species, data = iris)
mod %>% model_get_pairwise_contrasts(variables = "Species")
mod %>%
model_get_pairwise_contrasts(
variables = "Species",
contrasts_adjust = "none"
)
}