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 more prioritized
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.
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,
step_outcomes = c("Outcome I", "Outcome II", "Outcome III", "Outcome IV"),
last_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.
It is also possible to use the component_plot()
function
directly on an hce
object (created using the hce package).
Furthermore, there is a plot called "cumulative_plot"
.
Similar to the component_plot
, this plot shows the
different HCE components that make up the win odds calculation.
Different to the component plot, this plot provides insight into the
contributed effect for each of the components as they are added in
sequence (from top to bottom). Additionally, there is also a right-hand
panel that shows a forest plot with the win odds and win ratio
corresponding to the same cumulative sequence. To understand the
contribution from each outcome, we artificially set all the less
prioritized outcomes as ties and calculate the win odds/ratio. Thus, for
each added outcome there will be less ties.
As before, in order to use the cumulative_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,
step_outcomes = c("Outcome I", "Outcome II", "Outcome III", "Outcome IV"),
last_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
cumulative_plot()
function.
It is also possible to use the cumulative_plot()
function directly on an hce
object (created using the hce package).
The user can also choose to only display one of the statistics (win
odds or win ratio) by specifying so in the include
parameter.
The y-axis can easily be reversed using the reverse
parameter.
The resulting plot for the component_plot()
functions is
a normal ggplot2 object that can be styled accordingly.
component_plot(maraca_dat) +
ggplot2::scale_fill_manual(values = c("seagreen", "red", "grey"), name = NULL)
Note that the cumulative_plot()
function is using the
patchwork package to combine 2 ggplot2 objects - the bar plot and the
forest plot that together make up the cumulative_plot()
.
They can be accessed as list items and styled accordingly.
p <- cumulative_plot(maraca_dat)
# Accessing the first ggplot2 object and adding styling (bar plot)
p[[1]] <- p[[1]] +
ggplot2::scale_fill_manual(values = c("seagreen", "red", "grey"), name = NULL)
p
For the users convenience, there are also different themes available to style the plot.
The default style is called theme = "maraca"
.
There are 2 different themes with different color schemes,
theme = "color1"
and theme = "color2"
.
There is also a theme without any styling theme = "none"
that can be used as a base when the user wants to style the plot
themselves.