plot_status {adaptr} | R Documentation |
Plot statuses
Description
Plots the statuses over time of multiple simulated trials (overall or for one
or more specific arms). Requires the ggplot2
package installed.
Usage
plot_status(
object,
x_value = "look",
arm = NULL,
area = list(alpha = 0.5),
nrow = NULL,
ncol = NULL
)
## S3 method for class 'trial_results'
plot_status(
object,
x_value = "look",
arm = NULL,
area = list(alpha = 0.5),
nrow = NULL,
ncol = NULL
)
Arguments
object |
|
x_value |
single character string, determining whether the number of
adaptive analysis looks ( |
arm |
character vector containing one or more unique, valid |
area |
list of styling settings for the area as per |
nrow , ncol |
the number of rows and columns when plotting statuses for
multiple arms in the same plot (using faceting in |
Value
A ggplot2
plot object.
See Also
Examples
#### Only run examples if ggplot2 is installed ####
if (requireNamespace("ggplot2", quietly = TRUE)){
# Setup a trial specification
binom_trial <- setup_trial_binom(arms = c("A", "B", "C", "D"),
control = "A",
true_ys = c(0.20, 0.18, 0.22, 0.24),
data_looks = 1:20 * 100)
# Run multiple simulation with a fixed random base seed
res_mult <- run_trials(binom_trial, n_rep = 25, base_seed = 12345)
# Plot trial statuses at each look according to total allocations
plot_status(res_mult, x_value = "total n")
}
if (requireNamespace("ggplot2", quietly = TRUE)){
# Plot trial statuses for all arms
plot_status(res_mult, arm = NA)
}