Usage
groupedforest(
data,
time_var,
event_var,
treatment_var,
grouping_var,
covariates,
reference_treatment = "",
plot_title = "Grouped Hazard Forest Plot",
show_overall = TRUE,
show_statistics = TRUE,
confidence_level = 0.95,
sort_by_hr = FALSE,
show_counts = TRUE,
plot_theme = "clinical",
hr_range = "auto",
custom_hr_min = 0.1,
custom_hr_max = 10,
interaction_test = FALSE,
export_data = FALSE
)
Arguments
- data
The data as a data frame containing survival variables.
- time_var
Numeric variable representing follow-up time until the event or last observation.
- event_var
Variable indicating whether the event occurred (1) or was censored (0).
- treatment_var
Treatment variable (e.g., treatment vs control). This will be the primary variable for which hazard ratios are calculated within each subgroup.
- grouping_var
Variable defining subgroups/variants for separate Cox regression analyses. Each level will have its own hazard ratio calculation.
- covariates
Optional covariates to include in the Cox regression models for adjustment.
- reference_treatment
Specify the reference level for treatment variable. If empty, will use the first level.
- plot_title
Custom title for the forest plot.
- show_overall
If TRUE, includes an overall analysis (all groups combined) in the forest plot.
- show_statistics
If TRUE, displays a detailed statistics table with hazard ratios, confidence intervals, and p-values.
- confidence_level
Confidence level for confidence intervals (e.g., 0.95 for 95\
sort_by_hrIf TRUE, sorts subgroups by hazard ratio magnitude in the forest plot.
show_countsIf TRUE, displays sample sizes for each subgroup in the forest plot.
plot_themeVisual theme for the forest plot.
hr_rangeRange for displaying hazard ratios on the x-axis.
custom_hr_minCustom minimum hazard ratio for x-axis (when HR Range = Custom).
custom_hr_maxCustom maximum hazard ratio for x-axis (when HR Range = Custom).
interaction_testIf TRUE, performs a test for interaction between treatment and grouping variable.
export_dataIf TRUE, makes forest plot data available for export.
A results object containing:
results$todo | a html | ||||
results$forest_plot | an image | ||||
results$statistics_table | a html | ||||
results$overall_stats | a html | ||||
results$interaction_test | a html | ||||
results$sample_sizes | a html | ||||
results$interpretation | a html |