datasim_bin {NCC}R Documentation

Simulate binary data from a platform trial with a shared control arm and a given number of experimental treatment arms entering at given time points

Description

This function simulates data from a platform trial with a given number of experimental treatment arms entering at given time points and a shared control arm. The primary endpoint is a binary endpoint. The user specifies the timing of adding arms in terms of patients recruited to the trial so far and the sample size per experimental treatment arm.

Usage

datasim_bin(
  num_arms,
  n_arm,
  d,
  period_blocks = 2,
  p0,
  OR,
  lambda,
  trend,
  N_peak,
  n_wave,
  full = FALSE,
  check = TRUE
)

Arguments

num_arms

Integer. Number of experimental treatment arms in the trial.

n_arm

Integer. Sample size per experimental treatment arm (assumed equal).

d

Integer vector with timings of adding new arms in terms of number of patients recruited to the trial so far. The first entry must be 0, so that the trial starts with at least one experimental treatment arm, and the entries must be non-decreasing. The vector length equals num_arms.

period_blocks

Integer. Number to define the size of the blocks for the block randomization. The block size in each period equals period_blockstimes the number of active arms in the period (see Details). Default=2.

p0

Double. Response probability in the control arm.

OR

Double vector with treatment effects in terms of odds ratios for each experimental treatment arm compared to control. The elements of the vector (odds ratios) are ordered by the entry time of the experimental treatment arms (e.g., the first entry in the vector corresponds to the odds ratio of the first experimental treatment arm). The vector length equals num_arms.

lambda

Double vector with strength of time trend in each arm ordered by the entry time of the arms (e.g., the first entry in the vector corresponds to the time trend in the control arm, second entry to the time trend in the first experimental treatment arm). The vector length equals num_arms+1, as time trend in the control is also allowed.

trend

String indicating the time trend pattern ("linear", "linear_2, "stepwise", "stepwise_2", "inv_u" or "seasonal"). See Details for more information.

N_peak

Integer. Timepoint at which the inverted-u time trend switches direction in terms of overall sample size (i.e. after how many recruited participants the trend direction switches).

n_wave

Integer. Number of cycles (waves) should the seasonal trend have.

full

Logical. Indicates whether the output should be in form of a data frame with variables needed for the analysis only (FALSE) or in form of a list containing more information (TRUE). Default=FALSE.

check

Logical. Indicates whether the input parameters should be checked by the function. Default=TRUE, unless the function is called by a simulation function, where the default is FALSE.

Details

Design assumptions:

Data generation:

The binary response y_j for patient j is generated according to:

g(E(y_j)) = \eta_0 + \sum_{k=1}^K \cdot I(k_j=k) + f(j)

where g(\cdot) is the logit link function, and \eta_0 (logit function of parameter p0) and \theta_k (log of the parameter OR) are the log odds in the control arm and the log odds ratio of treatment k. K is the total number of treatment arms in the trial (parameter num_arms) and k_j is an indicator of the treatment arm patient j is allocated to.

The function f(j) denotes the time trend, whose strength is indicated by \lambda_{k_j} (parameter lambda) and which can have the following patterns (parameter trend):

Trials with no time trend can be simulated too, by setting all elements of the vector lambda to zero and choosing an arbitrary pattern.

Value

Data frame: simulated trial data (if full=FALSE, i.e. default) with the following columns:

or List (if full=TRUE) containing the following elements:

Author(s)

Pavla Krotka, Marta Bofill Roig

Examples


head(datasim_bin(num_arms = 3, n_arm = 100, d = c(0, 100, 250),
p0 = 0.7, OR = rep(1.8, 3), lambda = rep(0.15, 4), trend="stepwise"))



[Package NCC version 1.0 Index]