
Create a Summary of Marginal Subgroup Treatment Effects
Source:R/summary_subgroup_effects.R
summary_subgroup_effects.RdThis function orchestrates calls to estimate_subgroup_effects to generate
a summary table for specific subgroups.
Usage
summary_subgroup_effects(
brms_fit,
trt_var = NULL,
response_type = NULL,
subgroup_vars = "auto",
conf = 0.95
)Arguments
- brms_fit
A
brmsfitobject. Fitted model object fromfit_brms_model()orrun_brms_analysis(). Must contain the necessary attributes for extracting treatment variable and response type information.- trt_var
A character string or
NULL. Treatment variable name (coded 0/1). IfNULL, automatically extracted from model attributes (set byfit_brms_model()). This should match the treatment variable used in model fitting.- response_type
A character string or
NULL. Outcome type, one of"binary","count","continuous", or"survival". IfNULL, automatically extracted from model attributes (set byfit_brms_model()). This determines the appropriate scale for summarizing effects.- subgroup_vars
A character vector or
"auto". Subgrouping variable names for which to generate summaries. Defaults to"auto", which automatically detects treatment interactions from all formula components (unshrunktermeffect,shprogeffect,shpredeffect). Cannot beNULL.- conf
A numeric scalar. Credible interval confidence level. Default is 0.95 (corresponding to 95% credible intervals). Example: use 0.90 for 90% credible intervals.
Value
subgroup_summary. S3 object containing:
estimatestibblewhere each row represents a subgroup, with columns forSubgroup,Median,CI_Lower, andCI_Upperfrom posterior distributionresponse_typecharacter(1)indicating outcome typeci_levelnumeric(1)credible interval level (default 0.95)trt_varcharacter(1)treatment variable name