The function datasim_cont()
enables data simulation of a
platform trial with continuous endpoint and an arbitrary number of
treatment arms entering at different time points.
period_blocks
, default=2)Paper | Software |
N | n_total |
K | num_arms |
d | d |
n | n_arm |
η0 | mu0 |
θ | theta |
λ | lambda |
σ | sigma |
Np | N_peak |
The user specifies the number of treatment arms in the trial, the sample size per treatment arm (assumed equal) and the timing of adding arms in terms of patients recruited to the trial so far.
num_arms
Number of treatment arms in the trialn_arm
Sample size per arm (assumed equal)d
Vector with timings of adding new arms in terms of
number of patients recruited to the trial so far (of length
num_arms
)period_blocks
- number to multiply the number of active
arms with in order to get the block size per period (block size =
period_blocks
⋅ #active
arms)mu0
- response in the control arm. Default=0theta
- vector with treatment effects for each
treatment arm (of length num_arms
)lambda
- vector with strength of time trend in each arm
(of length num_arms+1
, as time trend in the control is also
allowed)sigma
- residual variancetrend
- indicates the time trend pattern (“linear”,
“stepwise” or “inv_u”)N_peak
- point at which the inverted-u time trend
switches direction in terms of overall sample sizefull
- Boolean. Indicates whether the full dataset
should be returned. Default=FALSE
Per default (using full=FALSE
), the function outputs a
dataframe with simulated trial data needed for the analysis. If the
parameter full
is set to TRUE
, the output is a
list containing an extended version of the dataframe (also including
lambdas and underlying responses) and all input parameters.
# Dataset with trial data only (default)
head(datasim_cont(num_arms = 3, n_arm = 100, d = c(0, 100, 250),
theta = rep(0.25, 3), lambda = rep(0.15, 4),
sigma = 1, trend = "linear"))
j response treatment period
1 1 -1.0724137 1 1
2 2 -0.3403155 0 1
3 3 0.4858809 1 1
4 4 -1.0343982 0 1
5 5 0.9232285 1 1
6 6 -0.5320063 0 1
# Full dataset
head(datasim_cont(num_arms = 3, n_arm = 100, d = c(0, 100, 250),
theta = rep(0.25, 3), lambda = rep(0.15, 4),
sigma = 1, trend = "linear", full = T)$Data)
j response treatment period means lambda0 lambda1 lambda2 lambda3
1 1 -0.1147964 0 1 0.0000000000 0.15 0.15 0.15 0.15
2 2 0.3948988 1 1 0.2503006012 0.15 0.15 0.15 0.15
3 3 0.3563252 1 1 0.2506012024 0.15 0.15 0.15 0.15
4 4 0.4250647 0 1 0.0009018036 0.15 0.15 0.15 0.15
5 5 -0.7197568 0 1 0.0012024048 0.15 0.15 0.15 0.15
6 6 -0.5435490 1 1 0.2515030060 0.15 0.15 0.15 0.15