View source: R/additional_functions_1-1.R
plot_subgroups | R Documentation |
A figure that shows the composition of the population under study though time
plot_subgroups( A, B, colors = "default", max_time = max(A$Tint), position = c("stack", "fill"), title = "" )
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. |
Robin Ristl, robin.ristl@meduniwien.ac.at, Nicolas Ballarini
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.
pop_pchaz
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'")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.