Skip to contents

Different from RMST_sim_cal, It return a dataframe of p-value and rejection times of single-stage RMST test . It also counts the times of tau adjustment (adjusted tau is the minimax survival time of two groups) This function can be used to compare our rejection method with classical RMST difference test

Usage

RMST_sim_test(n, data_E, data_C, tau, sim_size, alpha, sided)

Arguments

n

Sample size in each arm

data_E

Survival data of experiment group generated by expo_gen_2stages

data_C

Survival data of control group generated by expo_gen_2stages

tau

Prespecified cut-off time for RMST(used for final stage)

sim_size

Simulation times

alpha

Stated type I error level

sided

"two_sided" for two-sided test, "greater" for one-sided superiority test

Value

A list with the following components:

test_result

A data frame with the following columns:

rejection

The proportion of simulations where the RMST test p-value is less than or equal to alpha.

tau adjustment

The proportion of simulations where tau adjustment occurred.

p_value

A numeric vector of the p-values for each simulation.

Examples

median_con <- 10 # month
lambda_H0 <- log(2)/median_con
lambda_H1 <- lambda_H0 * 0.67
sim_size <- 5000 
acc_time <- 24
cen_time <- 12
tau <- 24
n <- 100  
set.seed(2024)

data_C <- expo_gen_2stages(N = n * sim_size, acc_time = acc_time, 
                   lambda = lambda_H0, dist = 'exp', 
                   cen_time = cen_time,arm = 0, interim = 0)[ , c(4,5,1)]    
data_E_H0 <- expo_gen_2stages(N = n * sim_size, acc_time = acc_time, 
                   lambda = lambda_H0, dist = 'exp', 
                   cen_time = cen_time,arm = 1, interim = 0)[ , c(4,5,1)]                    
simple_rmst <- RMST_sim_test(data_C = data_C, data_E = data_E_H0, 
                   sim_size = sim_size, tau = tau, 
                   n = n, alpha = 0.05 ,sided = 'greater')
#> Error in makeCluster(n_cores): could not find function "makeCluster"

# print(simple_rmst$test_result)
# print(simple_rmst$p_value)