These templates are helpful when we are interested in the odds ratios between two groups, usually two treatment arms. We would like to assess how the odds ratio changes when we look at different subgroups, often defined by categorical biomarker variables, e.g.
We will use the cadrs data set from the random.cdisc.data package to create the response forest graph. We start by filtering the adrs data set for the Best Confirmed Overall Response by Investigator and patients with measurable disease at baseline (BMEASIFL == "Y"). We create a new variable for response information (we define response patients to include CR and PR patients), and binarize the ARM variable. We also fix a data artifact by setting the categorical biomarker variable BMRKR2 to an explicit <Missing> level for the non-biomarker evaluable population.
We also relabel the biomarker evaluable population flag variable BEP01FL and the categorical biomarker variable BMRKR2 to update the display label of these variables in the graph.
We calculate the response forest graph subgroup results with extract_rsp_subgroups() and then use the function tabulate_rsp_subgroups() to tabulate the required statistics estimates specified in vars.
---title: RFG1subtitle: Response Forest Graphs for Comparing Treatment Effects Across Subgroupscategories: [RFG]---------------------------------------------------------------------------::: panel-tabset{{< include setup.qmd >}}## PlotWe calculate the response forest graph subgroup results with `extract_rsp_subgroups()` and then use the function `tabulate_rsp_subgroups()` to tabulate the required statistics estimates specified in `vars`.```{r, fig.width = 15}df <- extract_rsp_subgroups( variables = list( rsp = "is_rsp", arm = "ARM_BIN", subgroups = c("BEP01FL", "BMRKR2") ), data = adrs, conf_level = 0.95)result <- basic_table() %>% tabulate_rsp_subgroups(df, vars = c("n_tot", "n", "n_rsp", "prop", "or", "ci"))```We can then produce the final forest plot using `g_forest()` function based on this `result` table.```{r, fig.width = 15}g_forest(result)```{{< include ../../misc/session_info.qmd >}}:::