Maraca Plots - Plotting win odds

Monika Huhn

10/10/2023

Component plot

The maraca package also contains an additional plot called "component_plot". This one allows to plot the different components that make up the win odds calculation. More specifically, for each outcome, the plot shows how often patients in each treatment arm “won” against the other arm. For the time-to-event endpoints, this means counting how many patients of the other arm had no event prior. For the continuous outcome this means counting how many patients had a lower value. The results are separated for each outcome (non-cumulative) and also include ties (patients from 2 treatment arms having same outcome at the same time/same continuous outcome value).

Let us first read in some data.

library(maraca)

data(hce_scenario_a)

In order to use the component_plot, we have to first create a maraca object. Important here is to set the argument compute_win_odds = TRUE, so that the necessary calculations are included.

maraca_dat <- maraca(
  data = hce_scenario_a,
  tte_outcomes = c("Outcome I", "Outcome II", "Outcome III", "Outcome IV"),
  continuous_outcome = "Continuous outcome",
  fixed_followup_days = 3 * 365,
  column_names = c(outcome = "GROUP", arm = "TRTP", value = "AVAL0"),
  arm_levels = c(active = "Active", control = "Control"),
  # Make sure to calculate the win odds
  compute_win_odds = TRUE
)

Now we can just plot the object using the component_plot() function.

component_plot(maraca_dat)

It is also possible to use the component_plot() function directly on an hce object (created using the hce package).

library(hce)

Rates_A <- c(1.72, 1.74, 0.58, 1.5, 1)
Rates_P <- c(2.47, 2.24, 2.9, 4, 6)

hce_dat <- simHCE(n = 2500, TTE_A = Rates_A, TTE_P = Rates_P,
                  CM_A = -3, CM_P = -6, CSD_A = 16, CSD_P = 15, fixedfy = 3,
                  seed = 31337)

component_plot(hce_dat)

Styling

The resulting plot is a normal ggplot2 object that can be styled accordingly. There are also different themes available to style the plot.

The default style is called theme = "maraca".

component_plot(maraca_dat, theme = "maraca")

There are 2 different themes with different color schemes, theme = "color1" and theme = "color2".

component_plot(maraca_dat, theme = "color1")

component_plot(maraca_dat, theme = "color2")

There is also a theme without any styling theme = "none".

component_plot(maraca_dat, theme = "none")