Version: | 1.0.0 |
Type: | Package |
Title: | The Maraca Plot: Visualizing Hierarchical Composite Endpoints |
License: | Apache License (≥ 2) |
Description: | Supports visual interpretation of hierarchical composite endpoints (HCEs). HCEs are complex constructs used as primary endpoints in clinical trials, combining outcomes of different types into ordinal endpoints, in which each patient contributes the most clinically important event (one and only one) to the analysis. See Karpefors M et al. (2022) <doi:10.1177/17407745221134949>. |
URL: | https://github.com/AstraZeneca/maraca |
BugReports: | https://github.com/AstraZeneca/maraca/issues |
Encoding: | UTF-8 |
LazyData: | true |
Depends: | R (≥ 3.5), hce (≥ 0.5), ggplot2 (≥ 3.3) |
Imports: | dplyr (≥ 1.0), tidyr (≥ 1.2), checkmate (≥ 2.1), patchwork(≥ 1.0.0), lifecycle |
RoxygenNote: | 7.3.2 |
Suggests: | knitr (≥ 1.39), here (≥ 1.0.1), lintr (≥ 3.0.0), withr (≥ 2.5.0), testthat (≥ 3.1), rmarkdown |
NeedsCompilation: | no |
VignetteBuilder: | knitr |
Packaged: | 2025-06-08 21:55:36 UTC; hidden |
Author: | Martin Karpefors |
Maintainer: | Monika Huhn <monika.huhn@astrazeneca.com> |
Repository: | CRAN |
Date/Publication: | 2025-06-08 22:30:02 UTC |
maraca package.
Description
Supports visual interpretation of hierarchical composite endpoints (HCEs). HCEs are complex constructs used as primary endpoints in clinical trials, combining outcomes of different types into ordinal endpoints, in which each patient contributes the most clinically important event (one and only one) to the analysis. See Karpefors M et al. (2022) doi:10.1177/17407745221134949.
Creates the maraca analysis object as an S3 object of class 'maraca'.
Usage
maraca(
data,
step_outcomes,
last_outcome,
arm_levels = c(active = "active", control = "control"),
column_names = c(outcome = "outcome", arm = "arm", value = "value"),
fixed_followup_days = NULL,
compute_win_odds = FALSE,
step_types = "tte",
last_type = "continuous",
lowerBetter = FALSE,
tte_outcomes = lifecycle::deprecated(),
continuous_outcome = lifecycle::deprecated()
)
## S3 method for class 'maraca'
print(x, ...)
Arguments
data |
A data frame with columns for the following information: - outcome column, containing the time-to-event and continuous labels - arm column, containing the arm a given row belongs to. - value column, containing the values. |
step_outcomes |
A vector of strings containing the outcome labels for all outcomes displayed as part of the step function on the left side of the plot. The order is kept for the plot. |
last_outcome |
A single string containing the last outcome label displayed on the right side of the plot. |
arm_levels |
A named vector of exactly two strings, mapping the values used for the active and control arms to the values used in the data. The names must be "active" and "control" in this order. Note that this parameter only need to be specified if you have labels different from "active" and "control". |
column_names |
A named vector to map the outcome, arm, value to the associated column names in the data. The vector names must match in order "outcome", "arm", and "value". Note that this parameter only need to be specified if you have column names different from the ones above. |
fixed_followup_days |
A mandatory specification of the fixed follow-up days in the study. Can be a single integer value for all tte-outcomes or a vector with one integer value per tte-outcome. |
compute_win_odds |
If TRUE compute the win odds, otherwise (default) don't compute them. |
step_types |
The type of each outcome in the step_outcomes vector. Can be a single string (if all outcomes of same type) or a vector of same length as step_outcomes. Possible values in the vector are "tte" (default) or "binary". |
last_type |
A single string giving the type of the last outcome. Possible values are "continuous" (default), "binary" or "multinomial". |
lowerBetter |
Flag for the final outcome variable, indicating if lower values are considered better/advantageous. This flag is need to make sure the win odds are calculated correctly. Default value is FALSE, meaning higher values are considered advantageous. |
tte_outcomes |
Deprecated and substituted by the more general 'step_outcomes'. A vector of strings containing the time-to-event outcome labels. The order is kept for the plot. |
continuous_outcome |
Deprecated and substituted by the more general 'last_outcome'. A single string containing the continuous outcome label. |
x |
an object of class maraca |
... |
further arguments passed to or from other methods. |
Value
An object of class 'maraca'. The object information must be considered private.
Author(s)
Maintainer: Monika Huhn monika.huhn@astrazeneca.com (ORCID)
Authors:
Martin Karpefors martin.karpefors@astrazeneca.com (ORCID)
Samvel B. Gasparyan samvel.gasparyan@astrazeneca.com (ORCID)
Other contributors:
Stefano Borini stefano.borini@astrazeneca.com [contributor]
See Also
Useful links:
Examples
data(hce_scenario_a)
hce_test <- 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"),
compute_win_odds = TRUE
)
Plotting components of win odds
Description
Generic function to create a plot showing the components used in calculating win odds (wins and ties) separately for each outcome. Implemented for objects of type 'maraca' and 'hce.
Usage
component_plot(x, ...)
## Default S3 method:
component_plot(x, ...)
## S3 method for class 'maraca'
component_plot(x, theme = "maraca", ...)
## S3 method for class 'hce'
component_plot(
x,
step_outcomes = NULL,
last_outcome = "C",
arm_levels = c(active = "A", control = "P"),
fixed_followup_days = NULL,
theme = "maraca",
lowerBetter = FALSE,
...
)
Arguments
x |
an object of S3 class 'maraca' or 'hce'. |
... |
not used |
theme |
Choose theme to style the plot. The default theme is "maraca". Options are "maraca", "color1", "color2" and none". For more details, check the vignette called "Maraca Plots - Plotting win odds". |
step_outcomes |
A vector of strings containing the outcome labels for all outcomes displayed as part of the step function on the left side of the plot. The order is kept for the plot. By default (when set to NULL) this is automatically updated by taking the non-continuous outcomes from the GROUP variable in alphabetical order. |
last_outcome |
A single string containing the last outcome label displayed on the right side of the plot. Default value "C". |
arm_levels |
A named vector of exactly two strings, mapping the values used for the active and control arms to the values used in the data. The names must be "active" and "control" in this order. Note that this parameter only need to be specified if you have labels different from "active" and "control". |
fixed_followup_days |
Not needed if HCE object contains information on fixed follow-up days in the study (column PADY or TTEfixed, depending on hce version). Otherwise, this argument must be specified. Note: If argument is specified and HCE object contains PADY or TTEfixed column, then fixed_followup_days argument is used. |
lowerBetter |
Flag for the final outcome variable, indicating if lower values are considered better/advantageous. This flag is need to make sure the win odds are calculated correctly. Default value is FALSE, meaning higher values are considered advantageous. |
Details
Note that for this plot, if applying to a maraca object, in the original maraca() function run the argument "compute_win_odds" has to be set to TRUE.
Check the vignette "Maraca Plots - Plotting win odds" for more details.
Value
Component plot as a ggplot2 object.
Examples
data(hce_scenario_a)
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"),
compute_win_odds = TRUE
)
component_plot(maraca_dat)
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 <- hce::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)
Plotting the cumulated components of win odds
Description
Generic function to create a plot showing the components used in calculating win odds (wins and ties) cumulated for all outcomes for a hierarchical endpoint. Implemented for objects of type 'maraca' and 'hce'.
Usage
cumulative_plot(x, ...)
dustin(x, ...)
dustin_plot(x, ...)
## Default S3 method:
cumulative_plot(x, ...)
## S3 method for class 'maraca'
cumulative_plot(
x,
theme = "maraca",
include = c("win odds", "win ratio"),
reverse = FALSE,
...
)
## S3 method for class 'hce'
cumulative_plot(
x,
step_outcomes = NULL,
last_outcome = "C",
arm_levels = c(active = "A", control = "P"),
fixed_followup_days = NULL,
theme = "maraca",
include = c("win odds", "win ratio"),
reverse = FALSE,
lowerBetter = FALSE,
...
)
Arguments
x |
an object of S3 class 'maraca' or 'hce'. |
... |
not used |
theme |
Choose theme to style the plot. The default theme is "maraca". Options are "maraca", "color1", "color2" and none". For more details, check the vignette called "Maraca Plots - Plotting win odds". |
include |
Vector or single string indicating which statistics to include in the right hand side plot. Acceptable values are "win odds" and/or "win ratio". Default is c("win odds", "win ratio"). |
reverse |
Flag indicating if the cumulated outcomes should be displayed in order from top to bottom (FALSE, the default) or in reverse (TRUE). |
step_outcomes |
A vector of strings containing the outcome labels for all outcomes displayed as part of the step function on the left side of the plot. The order is kept for the plot. By default (when set to NULL) this is automatically updated by taking the non-continuous outcomes from the GROUP variable in alphabetical order. |
last_outcome |
A single string containing the last outcome label displayed on the right side of the plot. Default value "C". |
arm_levels |
A named vector of exactly two strings, mapping the values used for the active and control arms to the values used in the data. The names must be "active" and "control" in this order. Note that this parameter only need to be specified if you have labels different from "active" and "control". |
fixed_followup_days |
Not needed if HCE object contains information on fixed follow-up days in the study (column PADY or TTEfixed, depending on hce version). Otherwise, this argument must be specified. Note: If argument is specified and HCE object contains PADY or TTEfixed column, then fixed_followup_days argument is used. |
lowerBetter |
Flag for the final outcome variable, indicating if lower values are considered better/advantageous. This flag is need to make sure the win odds are calculated correctly. Default value is FALSE, meaning higher values are considered advantageous. |
Details
Note that for this plot, if applying to a maraca object, in the original maraca() function run the argument "compute_win_odds" has to be set to TRUE.
Check the vignette "Maraca Plots - Plotting win odds" for more details.
Value
Cumulative plot as a patchwork list. Individual plots can be accessed like list items (plot[[1]] and plot[[2]]).
Examples
data(hce_scenario_a)
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"),
compute_win_odds = TRUE
)
cumulative_plot(maraca_dat)
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 <- hce::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)
cumulative_plot(hce_dat)
Example HCE scenario A.
Description
This is example data frame containing the example for scenario A.
Usage
data(hce_scenario_a)
Format
A data frame with 1000 rows.
- SUBJID
The patient identifier
- GROUP
Which type of outcome the row belongs to
- GROUPN
Not required for computation. The group as an arbitrary numerical value
- AVAL0
Contains both the time-to-event data for hard outcomes and the continuous data for the continuous outcome
- AVAL
Not required for computation. Create an ordered sequence of values where the AVAL0 value associated with the patient is offset by GROUPN
- TRTP
Treatment group
Example HCE scenario B.
Description
This is example data frame containing the example for scenario B.
Usage
data(hce_scenario_b)
Format
A data frame with 1000 rows.
- SUBJID
The patient identifier
- GROUP
Which type of outcome the row belongs to
- GROUPN
Not required for computation. The group as an arbitrary numerical value
- AVAL0
Contains both the time-to-event data for hard outcomes and the continuous data for the continuous outcome
- AVAL
Not required for computation. Create an ordered sequence of values where the AVAL0 value associated with the patient is offset by GROUPN
- TRTP
Treatment group
Example HCE scenario C.
Description
This is example data frame containing the example for scenario C.
Usage
data(hce_scenario_c)
Format
A data frame with 1000 rows.
- SUBJID
The patient identifier
- GROUP
Which type of outcome the row belongs to
- GROUPN
Not required for computation. The group as an arbitrary numerical value
- AVAL0
Contains both the time-to-event data for hard outcomes and the continuous data for the continuous outcome
- AVAL
Not required for computation. Create an ordered sequence of values where the AVAL0 value associated with the patient is offset by GROUPN
- TRTP
Treatment group
Example HCE scenario D.
Description
This is example data frame containing the example for scenario D.
Usage
data(hce_scenario_d)
Format
A data frame with 1000 rows.
- SUBJID
The patient identifier
- GROUP
Which type of outcome the row belongs to
- GROUPN
Not required for computation. The group as an arbitrary numerical value
- AVAL0
Contains both the time-to-event data for hard outcomes and the continuous data for the continuous outcome
- AVAL
Not required for computation. Create an ordered sequence of values where the AVAL0 value associated with the patient is offset by GROUPN
- TRTP
Treatment group
Example HCE scenario KCCQ3.
Description
This is example data frame containing the example for scenario KCCQ3.
Usage
data(hce_scenario_kccq3)
Format
A data frame with 5000 rows.
- SUBJID
The patient identifier
- GROUP
Which type of outcome the row belongs to
- GROUPN
Not required for computation. The group as an arbitrary numerical value
- AVAL0
Contains both the time-to-event data for hard outcomes and the continuous data for the continuous outcome
- AVAL
Not required for computation. Create an ordered sequence of values where the AVAL0 value associated with the patient is offset by GROUPN
- TRTP
Treatment group
- HFHT
Not needed
- SEED
Not needed
Mosaic plot
Description
Generic function to create a mosaic plot that compares outcomes between an active treatment group and a control group, highlighting areas of "Wins", "Losses" and "Ties" based on endpoint hierarchy.
Usage
mosaic_plot(x, ...)
## Default S3 method:
mosaic_plot(x, ...)
## S3 method for class 'maraca'
mosaic_plot(
x,
theme = "maraca",
highlight_ties = FALSE,
win_prob = FALSE,
diagonal_line = TRUE,
...
)
## S3 method for class 'hce'
mosaic_plot(
x,
step_outcomes = NULL,
last_outcome = "C",
arm_levels = c(active = "A", control = "P"),
fixed_followup_days = NULL,
theme = "maraca",
highlight_ties = FALSE,
win_prob = FALSE,
diagonal_line = TRUE,
lowerBetter = FALSE,
...
)
Arguments
x |
an object of S3 class 'maraca' or 'hce'. |
... |
not used |
theme |
Choose theme to style the plot. The default theme is "maraca". Options are "maraca", "color1", "color2" and "none". For more details, check the vignette called "Maraca Plots - Introduction to the Mosaic plot". |
highlight_ties |
Flag to indicate if component ties should be highlighted using lighter colors. Default value: FALSE |
win_prob |
Flag to indicate if winning probability should be shown within the plot. Note that in order to display the winning probability, you need to have set the "compute_win_odds" to TRUE when creating the maraca object. Default value: FALSE |
diagonal_line |
Flag to indicate if diagonal line showing an even Win/Loss split should be displayed. Default value: TRUE |
step_outcomes |
A vector of strings containing the outcome labels for all outcomes displayed as part of the step function on the left side of the plot. The order is kept for the plot. By default (when set to NULL) this is automatically updated by taking the non-continuous outcomes from the GROUP variable in alphabetical order. |
last_outcome |
A single string containing the last outcome label displayed on the right side of the plot. Default value "C". |
arm_levels |
A named vector of exactly two strings, mapping the values used for the active and control arms to the values used in the data. The names must be "active" and "control" in this order. Note that this parameter only need to be specified if you have labels different from "active" and "control". |
fixed_followup_days |
Not needed if HCE object contains information on fixed follow-up days in the study (column PADY or TTEfixed, depending on hce version). Otherwise, this argument must be specified. Note: If argument is specified and HCE object contains PADY or TTEfixed column, then fixed_followup_days argument is used. |
lowerBetter |
Flag for the final outcome variable, indicating if lower values are considered better/advantageous. This flag is need to make sure the win odds are calculated correctly. Default value is FALSE, meaning higher values are considered advantageous. |
Details
Implemented for objects of type 'maraca' and 'hce'.
Check the vignette "Maraca Plots - Introduction to the Mosaic plot" for more details.
Value
Mosaic plot as a ggplot2 object.
Examples
data(hce_scenario_a)
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"),
compute_win_odds = TRUE
)
mosaic_plot(maraca_dat)
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 <- hce::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)
mosaic_plot(hce_dat)
Generic function to plot the hce object using plot().
Description
Generic function to plot the hce object using plot().
Usage
## S3 method for class 'hce'
plot(
x,
step_outcomes = NULL,
last_outcome = "C",
arm_levels = c(active = "A", control = "P"),
continuous_grid_spacing_x = 10,
trans = c("identity", "log", "log10", "sqrt", "reverse")[1],
density_plot_type = c("default", "violin", "box", "scatter")[1],
vline_type = NULL,
fixed_followup_days = NULL,
compute_win_odds = FALSE,
step_types = "tte",
last_type = "continuous",
theme = "maraca",
lowerBetter = FALSE,
tte_outcomes = lifecycle::deprecated(),
continuous_outcome = lifecycle::deprecated(),
...
)
Arguments
x |
an object of S3 class 'hce'. |
step_outcomes |
A vector of strings containing the outcome labels for all outcomes displayed as part of the step function on the left side of the plot. The order is kept for the plot. By default (when set to NULL) this is automatically updated by taking the non-continuous outcomes from the GROUP variable in alphabetical order. |
last_outcome |
A single string containing the last outcome label displayed on the right side of the plot. Default value "C". |
arm_levels |
A named vector of exactly two strings, mapping the values used for the active and control arms to the values used in the data. The names must be "active" and "control" in this order. Note that this parameter only need to be specified if you have labels different from "active" and "control". |
continuous_grid_spacing_x |
The spacing of the x grid to use for the continuous section of the plot. |
trans |
the transformation to apply to the x-axis scale for the last outcome. Possible values are "identity", "log" (only for continuous endpoint), "log10" (only for continuous endpoint), "sqrt" (only for continuous endpoint) and "reverse". The default value is "identity". |
density_plot_type |
The type of plot to use to represent the density. Accepts "default", "violin", "box" and "scatter". |
vline_type |
what the vertical dashed line should represent. Accepts "median" (only for continuous last endpoint), "mean", "none" and NULL (default). By default (vline_type = NULL), vline_type will be set to "median" for a continuous last endpoint and to "mean" for a binary last endpoint. |
fixed_followup_days |
Not needed if HCE object contains information on fixed follow-up days in the study (column PADY or TTEfixed, depending on hce version). Otherwise, this argument must be specified to give the fixed follow-up days in the study. Can be a single integer value for all tte-outcomes or a vector with one integer value per tte-outcome. Note: If argument is specified and HCE object also contains PADY or TTEfixed column, then fixed_followup_days argument is used. |
compute_win_odds |
If TRUE compute the win odds, otherwise (default) don't compute them. |
step_types |
The type of each outcome in the step_outcomes vector. Can be a single string (if all outcomes of same type) or a vector of same length as step_outcomes. Possible values in the vector are "tte" (default) or "binary". |
last_type |
A single string giving the type of the last outcome. Possible values are "continuous" (default), "binary" or "multinomial". |
theme |
Choose theme to style the plot. The default theme is "maraca". Options are "maraca", "maraca_old", "color1", "color2" and none". For more details, check the vignette called "Maraca Plots - Themes and Styling". [companion vignette for package users](themes.html) |
lowerBetter |
Flag for the final outcome variable, indicating if lower values are considered better/advantageous. This flag is need to make sure the win odds are calculated correctly. Default value is FALSE, meaning higher values are considered advantageous. |
tte_outcomes |
Deprecated and substituted by the more general 'step_outcomes'. A vector of strings containing the time-to-event outcome labels. The order is kept for the plot. |
continuous_outcome |
Deprecated and substituted by the more general 'last_outcome'. A single string containing the continuous outcome label. |
... |
not used |
Value
Returns ggplot2 plot of the hce object.
Examples
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 <- hce::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)
plot(hce_dat)
plot(hce_dat, fixed_followup_days = 3 * 365)
Generic function to plot the maraca object using plot().
Description
Generic function to plot the maraca object using plot().
Usage
## S3 method for class 'maraca'
plot(
x,
continuous_grid_spacing_x = 10,
trans = c("identity", "log", "log10", "sqrt", "reverse")[1],
density_plot_type = c("default", "violin", "box", "scatter")[1],
vline_type = NULL,
theme = "maraca",
...
)
Arguments
x |
An object of S3 class 'maraca'. |
continuous_grid_spacing_x |
The spacing of the x grid to use for the continuous section of the plot. |
trans |
the transformation to apply to the x-axis scale for the last outcome. Possible values are "identity", "log" (only for continuous endpoint), "log10" (only for continuous endpoint), "sqrt" (only for continuous endpoint) and "reverse". The default value is "identity". |
density_plot_type |
The type of plot to use to represent the density. Accepts "default", "violin", "box" and "scatter". |
vline_type |
what the vertical dashed line should represent. Accepts "median" (only for continuous last endpoint), "mean", "none" and NULL (default). By default (vline_type = NULL), vline_type will be set to "median" for a continuous last endpoint and to "mean" for a binary last endpoint. |
theme |
Choose theme to style the plot. The default theme is "maraca". Options are "maraca", "maraca_old", "color1", "color2" and none". For more details, check the vignette called "Maraca Plots - Themes and Styling". |
... |
not used |
Value
Returns ggplot2 plot of the maraca object.
Examples
data(hce_scenario_a)
hce_test <- 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"),
compute_win_odds = TRUE
)
plot(hce_test)
Creates and returns the plot of the maraca data.
Description
Creates and returns the plot of the maraca data.
Usage
plot_maraca(
obj,
continuous_grid_spacing_x = NULL,
trans = c("identity", "log", "log10", "sqrt", "reverse")[1],
density_plot_type = c("default", "violin", "box", "scatter")[1],
vline_type = NULL,
theme = "maraca"
)
Arguments
obj |
an object of S3 class 'maraca' |
continuous_grid_spacing_x |
The spacing of the x grid to use for the continuous section of the plot. |
trans |
the transformation to apply to the x-axis scale for the last outcome. Possible values are "identity", "log" (only for continuous endpoint), "log10" (only for continuous endpoint), "sqrt" (only for continuous endpoint) and "reverse". The default value is "identity". |
density_plot_type |
which type of plot to display in the continuous part of the plot. Options are "default", "violin", "box", "scatter". |
vline_type |
what the vertical dashed line should represent. Accepts "median" (only for continuous last endpoint), "mean", "none" and NULL (default). By default (vline_type = NULL), vline_type will be set to "median" for a continuous last endpoint and to "mean" for a binary last endpoint. |
theme |
Choose theme to style the plot. The default theme is "maraca". Options are "maraca", "maraca_old", "color1", "color2" and none". For more details, check the vignette called "Maraca Plots - Themes and Styling". |
Value
a ggplot2 object of the data. This function will not render the plot immediately. You have to print() the returned object for it to be displayed.
Examples
data(hce_scenario_a)
hce_test <- 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"),
compute_win_odds = TRUE
)
plot <- plot_maraca(hce_test)
Generic function to generate validation data for the maraca plot object.
Description
This will produce the 4 validation datasets.
Usage
validate_maraca_plot(x, ...)
Arguments
x |
An object of S3 class 'maracaPlot'. |
... |
Not used. |
Value
Creates a list of datasets for validation purposes.
Examples
data(hce_scenario_a)
hce_test <- 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"),
compute_win_odds = TRUE
)
p <- plot(hce_test)
validate_maraca_plot(p)