Skip to contents

Simulate data from a single two-arm trial with an exponentially distributed time-to-event endpoint and no predictor of the intercurrent event

Usage

sim_dat_one_trial_exp_nocovar(
  n,
  nt,
  prob_ice,
  fu_max,
  prop_cens = 0,
  T0T_rate,
  T0N_rate,
  T1T_rate,
  T1N_rate
)

Arguments

n

Positive integer value, number of subjects in the trial.

nt

Positive integer value, number of treated subjects.

prob_ice

Numeric value on the interval \((0,1)\), probability of the intercurrent event of interest (i.e. the event that determines the principal stratum membership).

fu_max

Positive integer value, maximum follow-up time in days (administrative censoring assumed afterwards).

prop_cens

Numeric value on the interval \([0,1)\), proportion of uniformly censored patients (default is 0).

T0T_rate

Positive numeric value, monthly event rate in control subjects that would develop the intercurrent event if treated.

T0N_rate

Positive numeric value, monthly event rate in control subjects that never develop the intercurrent event.

T1T_rate

Positive numeric value, monthly event rate in treated subjects that develop the intercurrent event.

T1N_rate

Positive numeric value, monthly event rate in treated subjects that never develop the intercurrent event.

Value

A tibble()containing the trial data for analysis.

Examples

d_params_nocovar <- list(
  n = 500L,
  nt = 250L,
  prob_ice = 0.5,
  fu_max = 336L,
  prop_cens = 0.15,
  T0T_rate = 0.2,
  T0N_rate = 0.2,
  T1T_rate = 0.15,
  T1N_rate = 0.1
)
dat_single_trial <- sim_dat_one_trial_exp_nocovar(
  n = d_params_nocovar[["n"]], 
  nt = d_params_nocovar[["nt"]],
  prob_ice = d_params_nocovar[["prob_ice"]],
  fu_max = d_params_nocovar[["fu_max"]],
  prop_cens = d_params_nocovar[["prop_cens"]],  
  T0T_rate = d_params_nocovar[["T0T_rate"]],
  T0N_rate = d_params_nocovar[["T0N_rate"]],
  T1T_rate = d_params_nocovar[["T1T_rate"]],
  T1N_rate = d_params_nocovar[["T1N_rate"]] 
)
dim(dat_single_trial)
head(dat_single_trial)