group_slopes() returns the slope of a continuous predictor stratified by
one or more factors (or by values of another continuous predictor),
delegating to emmeans::emtrends(). Each row is one stratum with a
point estimate, standard error, 95% confidence band, and an
excludes_zero indicator.
Use this alongside parameter_interpretation() for any fit with a
continuous-by-categorical interaction (or continuous-by-continuous): the
coefficient table reports contrast slopes (differences from the reference
group's slope); group_slopes() reports each group's slope directly.
Not supported on bivariate Gaussian (biv_gaussian) fits — see
group_means() for the same limitation and the recommended
alternatives.
Usage
group_slopes(
x,
continuous,
at = NULL,
scale = c("response", "link"),
ci_method = NULL,
...
)Arguments
- x
A
symbolized_modelwhose underlying fit is retained onx$metadata$fit.- continuous
Name of the continuous predictor whose slope is wanted.
- at
How to stratify. Three accepted shapes:
NULL(default): use every factor in the model that interacts withcontinuous(determined fromx$terms).A character vector of factor names: stratify by those factors' levels.
A named list (e.g.
list(z = c(-1, 0, 1))): for continuous-by- continuous interactions, get the slope at those values ofz.
- scale
One of
"response"(default) or"link". A slope is the derivative of the linear predictor with respect to the continuous predictor, whichemmeans::emtrends()reports on the link scale regardless ofscale– so forgroup_slopes()the two scales coincide (unlikegroup_means(), where the response scale back-transforms). The argument is accepted and recorded on thescalecolumn for consistency with the rest of the family; to read an effect on the response scale, compare group means withgroup_means()instead.- ci_method
Confidence-interval method. Defaults to
x$metadata$ci_method. Seegroup_means()for details.- ...
Reserved for future use.
Value
A tibble (S3 class symbolizer_group_slopes) with one row per
stratum. Columns: predictor, level_combo, one column per stratifying
variable, estimate, std_error, confint_low, confint_high,
excludes_zero, ci_method, scale.
See also
Other marginal estimates:
group_contrasts(),
group_means()