Caption text stating the reference values of conditional effects
Source:R/conditional-effects.R
effects_reference_text.RdWrites the reference value of every term of a conditional_effects()
output as text for a figure caption, e.g. "depth 412 (peak of the depth
effect; Model A), 389 (Model B); geartype Shrimp (most common level); year
2025 (last level)". References that differ between models are listed per
model.
AI assistance
Written with Claude Opus 5.5 (Anthropic); reviewed in full by Claude Opus 5.5 (Anthropic), 2026-11-17.
Examples
# \donttest{
d <- subset(sebastes, year >= 2021 & cruiseseries %in% c("EcoS", "EggaN"))
mesh <- sdmTMB::make_mesh(d, c("X", "Y"), cutoff = 80)
m <- sdmTMB::sdmTMB(
density ~ s(depth, k = 5) + geartype,
data = d, mesh = mesh, family = sdmTMB::tweedie()
)
effects_reference_text(conditional_effects(m, se_fit = FALSE))
#> [1] "depth 371 (at the peak of its effect); geartype Shrimp (the most common level)"
# }