Adds the summary layer: a text/label annotation placed in whichever
corner of the base panel is furthest from the observed data, computed
from the raw (exposure, response) coordinates of the data.
Usage
er_plot_add_summary(
object,
model = NULL,
keep_strata = NULL,
style = NULL,
conf_level = 0.95,
summary_args = list(),
...
)Arguments
- object
Partially constructed plot (has S3 class
er_plot).- model
A fitted exposure-response model, or
NULL(the default). Only needed for builder styles (e.g.er_style_summary_pvalue()) that produced model-based summaries; a purely descriptive builder (e.g.er_style_summary_n()) ignores it.- keep_strata
Logical, indicating whether this layer should be split by the plot's stratification variable; defaults to
TRUEifstratify_bywas set iner_plot(),FALSEotherwise.- style
Function drawing the summary annotation, defaulting to
er_style_summary_pvalue().- conf_level
Confidence level forwarded to
er_summary()(used, e.g., for theconf_low/conf_highcolumns of itscoefficientsresult – see?er_model_interface). Ignored whenmodelisNULL.- summary_args
A named list of additional arguments forwarded to
er_summary(), distinct from...the same wayer_plot_add_model()'spredict_argsis distinct from its own...– see "Details" there.- ...
Additional named arguments forwarded, unchanged, to
stylewhen it's called at build time; seeer_style()'s "Passing extra arguments to a builder" section. Must be named.
Examples
if (requireNamespace("erglm", quietly = TRUE)) {
library(erglm)
mod <- erglm_model(ae1 ~ aucss, erglm_data, family = binomial())
erglm_data |>
er_plot(aucss, ae1) |>
er_plot_add_model(mod) |>
er_plot_add_summary(model = mod) |>
plot()
# a purely descriptive annotation, with no model at all
erglm_data |>
er_plot(aucss, ae1) |>
er_plot_add_summary(style = er_style_summary_n) |>
plot()
}