Learn R Programming

gestate (version 1.3.2)

analyse_sim: Analyse simulations of time-to-event data using arbitrary event, censoring and recruitment distributions.

Description

Function for analysing simulated time-to-event trial data produced by simulate_trials. Automatically reads in format from simulate_trials. Performs log rank test and Cox regression analysis by default, but can also/instead choose RMST and/or landmark analyses. Option is available to perform stratified analysis using the "stratum" argument. If a stratum is specified, it will be included as a covariate in Cox and RMST analysis, and as a stratum in a stratified log-rank test and an inverse-precision-weighted landmark test. Analysis is typically the slowest part of simulation, so parallel processing using the doParallel package is built in, enabled using the "parallel" argument. Use of parallel processing recommended for >10000 simulations. Ensure that the number of cores specified does not exceed number of threads provided by hardware.

Usage

analyse_sim(data, LR = TRUE, RMST = NULL, landmark = NULL,
  stratum = "", parallel_cores = 1)

Arguments

data

Output file from simulate_trials. Only simulate_trials output is supported, in either "list" or "matrix" format.

LR

Requests log-rank test and Cox regression. Default=TRUE

RMST

Requests Restricted Mean Survival Time analysis with specified (positive integer) restriction time, leave NULL for no analysis. This uses the survRM2 package. Default=NULL (no RMST analysis).

landmark

Requests Landmark analysis at specified (positive integer) time, leave NULL for no analysis. Default=NULL (no landmark analysis).

stratum

Specify name of column of a stratification factor and turn on stratified (LR/LM) and covariate-adjusted (Cox/RMST) analysis. By default, "", and no stratification.

parallel_cores

Positive integer specifying number of cores to use. If 1 specified then no parallel processing. Default=1 (no parallel processing).

Value

Returns a table with one row per simulation. Table contains the following columns:

  • "HR" Cox Hazard Ratio (LR/Cox analysis only)

  • "LogHR" Cox Log Hazard Ratio (LR/Cox analysis only)

  • "LogHR_SE" Cox Standard Error of log Hazard Ratio (LR/Cox analysis only)

  • "HR_Z" Cox Z-Score (LR/Cox analysis only)

  • "HR_P" 1-sided Cox p-value (LR/Cox analysis only)

  • "LR_Z" Log-Rank Test Z-Score (LR/Cox analysis only)

  • "LR_P" 1-sided Log-Rank Test p-value (LR/Cox analysis only)

  • "Events_Active" Events in Active arm (LR/Cox analysis only)

  • "Events_Control" Events in Control arm (LR/Cox analysis only)

  • "RMST_Time" RMST restriction time (RMST analysis only)

  • "RMST_Active" RMST for Active arm (RMST analysis only)

  • "RMST_Active_SE" RMST Standard Error for Active arm (RMST analysis only)

  • "RMST_Control" RMST for Control arm (RMST analysis only)

  • "RMST_Control_SE" RMST Standard Error for Control arm (RMST analysis only)

  • "RMST_Delta" RMST difference between arms active-control (RMST analysis only)

  • "RMST_Delta_SE" RMST difference between arms Standard Error (RMST analysis only)

  • "RMST_Z" Z-score for RMST (RMST analysis only)

  • "RMST_P" 1-sided RMST p-value (RMST analysis only)

  • "LM_Time" Landmark time, i.e. time of survival function comparison (Landmark analysis only)

  • "LM_Active" Survival function for active arm at landmark time (Landmark analysis only)

  • "LM_Active_SE" Greenwood standard error for active arm at landmark time (Landmark analysis only)

  • "LM_Control" Survival function for control arm at landmark time (Landmark analysis only)

  • "LM_Control_SE" Greenwood standard error for control arm at landmark time (Landmark analysis only)

  • "LM_Delta" Survival function difference between arms active-control at landmark time (Landmark analysis only)

  • "LM_Delta_SE" Greenwood standard error for difference between arms at landmark time (Landmark analysis only)

  • "LM_Z" Z-score for landmark analysis (Landmark analysis only)

  • "LM_P" 1-sided landmark analysis p-value (Landmark analysis only)

Examples

Run this code
# NOT RUN {
example_sim <- simulate_trials(active_ecurve=Weibull(250,0.8),control_ecurve=Weibull(100,1),
rcurve=LinearR(12,100,100), assess=20,iterations=2,seed=12345,detailed_output=TRUE)

example_analysis1 <- analyse_sim(example_sim)
example_analysis2 <- analyse_sim(data=example_sim,RMST=15,landmark=15)

example_strat_sim <- simulate_trials_strata(stratum_probs=c(0.5,0.5),
active_ecurve=c(Weibull(250,0.8),Weibull(100,1)), control_ecurve=Weibull(100,1),
rcurve=LinearR(12,100,100),assess=20,iterations=2,seed=12345)

example_strat_analysis <- analyse_sim(data=example_strat_sim,RMST=15,landmark=15,stratum="Stratum")
# }

Run the code above in your browser using DataLab