plot_subgroups {nph} | R Documentation |
Draw a population composition plot
Description
A figure that shows the composition of the population under study though time
Usage
plot_subgroups(
A,
B,
colors = "default",
max_time = max(A$Tint),
position = c("stack", "fill"),
title = ""
)
Arguments
A |
An object of class |
B |
An object of class |
colors |
Either a vector of length four with colors for A and B and subgroup 1 and 2, or "default". |
max_time |
the maximum value for the x-axis. |
position |
Either "stack" or "fill". By default (stack), the total population decreases through time. If position="fill", the size of the population is rescaled to show conditional percentages. |
title |
The text for the title. |
Author(s)
Robin Ristl, robin.ristl@meduniwien.ac.at, Nicolas Ballarini
References
Robin Ristl, Nicolas Ballarini, Heiko Götte, Armin Schüler, Martin Posch, Franz König. Delayed treatment effects, treatment switching and heterogeneous patient populations: How to design and analyze RCTs in oncology. Pharmaceutical statistics. 2021; 20(1):129-145.
See Also
Examples
A <- pop_pchaz(Tint = c(0, 90, 365),
lambdaMat1 = matrix(c(0.2, 0.1, 0.4, 0.1), 2, 2) / 365,
lambdaMat2 = matrix(c(0.5, 0.2, 0.6, 0.2), 2, 2) / 365,
lambdaProg = matrix(c(0.5, 0.5, 0.4, 0.4), 2, 2) / 365,
p = c(0.8, 0.2),
timezero = FALSE, discrete_approximation = TRUE)
B <- pop_pchaz(Tint = c(0, 90, 365),
lambdaMat1 = matrix(c(0.2, 0.1, 0.4, 0.1), 2, 2) / 365,
lambdaMat2 = matrix(c(0.5, 0.1, 0.6, 0.1), 2, 2) / 365,
lambdaProg = matrix(c(0.5, 0.5, 0.04, 0.04), 2, 2) / 365,
p = c(0.8, 0.2),
timezero = FALSE, discrete_approximation = TRUE)
plot_subgroups(A, B, title = "position='stack'")
plot_subgroups(A, B, position='fill', title = "position='fill'")