View source: R/plot_sg_glm_outcomes.R
| plot_sg_glm_outcomes | R Documentation |
Creates a publication-ready visualization of identified subgroup outcomes
for binary or continuous endpoints. This is the GLM counterpart to
plot_sg_weighted_km for survival endpoints.
plot_sg_glm_outcomes(
fs.est,
fs_bc = NULL,
outcome.name,
treat.name,
offset.name = NULL,
effect_measure = NULL,
outcome_type = NULL,
adjust_covariates = NULL,
sg0_name = "Questionable",
sg1_name = "Recommend",
E.name = "Treatment",
C.name = "Control",
bar_colors = c("steelblue", "coral"),
show_effect = TRUE,
show_bc = TRUE,
show_itt = TRUE,
conf.level = 0.95,
title = NULL,
subtitle = NULL,
verbose = FALSE
)
## S3 method for class 'fs_binary_plot'
print(x, ...)
## S3 method for class 'fs_binary_plot'
plot(x, ...)
fs.est |
A forestsearch object containing |
fs_bc |
Optional. Bootstrap results from
|
outcome.name |
Character. Name of outcome column. |
treat.name |
Character. Name of treatment column. |
offset.name |
Character or |
effect_measure |
Character or |
outcome_type |
Character or |
adjust_covariates |
This option is implemented but has not been
tested against the manuscript analyses or the simulation studies of
León and Anderson (2026a, 2026b), which use the unadjusted
treatment-only fits.
Character vector or |
sg0_name |
Character. Label for H subgroup (treat.recommend == 0).
Default: |
sg1_name |
Character. Label for Hc subgroup (treat.recommend == 1).
Default: |
E.name |
Character. Label for experimental/treatment arm.
Default: |
C.name |
Character. Label for control arm.
Default: |
bar_colors |
Character vector of length 2. Colors for control and
treatment bars. Default: |
show_effect |
Logical. Annotate with effect estimate. Default
|
show_bc |
Logical. Annotate with bias-corrected estimate when
|
show_itt |
Logical. Include an ITT (full population) panel.
Default |
conf.level |
Numeric. Confidence level for intervals.
Default |
title |
Character or |
subtitle |
Character or |
verbose |
Logical. Print diagnostic messages. Default |
x |
An fs_binary_plot object. |
... |
Additional arguments (unused). |
For binary outcomes, displays grouped bar charts of event rates by treatment arm within each subgroup. For continuous outcomes, displays point-and-errorbar charts of means (+/- SE) by treatment arm. Both are annotated with the effect estimate and optional bias-corrected estimate from the bootstrap.
The effect annotation follows the fit's orientation: its estimator is
built with the fit's stored adverse_outcome
(fs.est$args_call_all$adverse_outcome) or, when none is stored,
with forestsearch's rule (TRUE for binary and count
outcomes, FALSE otherwise), so it is on the scale of the fit's
own estimates, sign included. The plotted per-arm rates or means (and
the returned data) are the raw outcome and do not follow it. So
for an unadjusted fit where a lower outcome is adverse
(adverse_outcome = FALSE, the default for continuous outcomes)
the annotated effect and the treated-minus-control difference of the
plotted values have opposite signs (for OR and RR, the log of the
effect): an MD annotation is the control mean minus the treated mean.
Count outcomes and the rate measures (IRR, IRD) are not reoriented (see
make_effect_estimator).
A list of class "fs_binary_plot" containing:
A ggplot2 object.
Data frame of per-arm summaries used for the plot.
Data frame of effect estimates per subgroup.
Character. Subgroup definition label.
Character. Auto-generated figure note.
## Not run:
fs <- forestsearch(df, outcome_type = "binary", effect_measure = "OR",
...)
result <- plot_sg_glm_outcomes(fs, outcome.name = "status",
treat.name = "hormon")
print(result)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.