Package: simtrial 1.0.2

Yujie Zhao

simtrial: Clinical Trial Simulation

Provides some basic routines for simulating a clinical trial. The primary intent is to provide some tools to generate trial simulations for trials with time to event outcomes. Piecewise exponential failure rates and piecewise constant enrollment rates are the underlying mechanism used to simulate a broad range of scenarios such as those presented in Lin et al. (2020) <doi:10.1080/19466315.2019.1697738>. However, the basic generation of data is done using pipes to allow maximum flexibility for users to meet different needs.

Authors:Keaven Anderson [aut], Yujie Zhao [aut, cre], John Blischak [aut], Nan Xiao [ctb], Yilong Zhang [aut], Jianxiao Yang [ctb], Lili Ling [ctb], Xintong Li [ctb], Ruixue Wang [ctb], Yi Cui [ctb], Ping Yang [ctb], Yalin Zhu [ctb], Heng Zhou [ctb], Amin Shirazi [ctb], Cole Manschot [ctb], Larry Leon [ctb], Merck & Co., Inc., Rahway, NJ, USA and its affiliates [cph]

simtrial_1.0.2.tar.gz
simtrial_1.0.2.zip(r-4.7)simtrial_1.0.2.zip(r-4.6)simtrial_1.0.2.zip(r-4.5)
simtrial_1.0.2.tgz(r-4.6-x86_64)simtrial_1.0.2.tgz(r-4.6-arm64)simtrial_1.0.2.tgz(r-4.5-x86_64)simtrial_1.0.2.tgz(r-4.5-arm64)
simtrial_1.0.2.tar.gz(r-4.7-arm64)simtrial_1.0.2.tar.gz(r-4.7-x86_64)simtrial_1.0.2.tar.gz(r-4.6-arm64)simtrial_1.0.2.tar.gz(r-4.6-x86_64)
simtrial_1.0.2.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
simtrial/json (API)

# Install 'simtrial' in R:
install.packages('simtrial', repos = c('https://merck.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/merck/simtrial/issues

Pkgdown/docs site:https://merck.github.io

Uses libs:
  • c++– GNU Standard C++ Library v3
Datasets:
  • ex1_delayed_effect - Time-to-event data example 1 for non-proportional hazards working group
  • ex2_delayed_effect - Time-to-event data example 2 for non-proportional hazards working group
  • ex3_cure_with_ph - Time-to-event data example 3 for non-proportional hazards working group
  • ex4_belly - Time-to-event data example 4 for non-proportional hazards working group
  • ex5_widening - Time-to-event data example 5 for non-proportional hazards working group
  • ex6_crossing - Time-to-event data example 6 for non-proportional hazards working group
  • mb_delayed_effect - Simulated survival dataset with delayed treatment effect

On CRAN:

Conda:

cpp

9.93 score 35 stars 1 packages 123 scripts 688 downloads 24 exports 16 dependencies

Last updated from:687749ba5c. Checks:13 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK298
linux-devel-x86_64OK310
source / vignettesOK296
linux-release-arm64OK265
linux-release-x86_64OK300
macos-release-arm64OK182
macos-release-x86_64OK593
macos-oldrel-arm64OK152
macos-oldrel-x86_64OK336
windows-develOK292
windows-releaseOK265
windows-oldrelOK300
wasm-releaseOK185

Exports:as_gtcounting_processcreate_cutcreate_testcut_data_by_datecut_data_by_eventearly_zerofhfit_pwexpget_analysis_dateget_cut_date_by_eventmaxcombombmilestonemultitestrandomize_by_fixed_blockrmstrpwexprpwexp_enrollsim_fixed_nsim_gs_nsim_pw_survto_sim_pw_survwlr

Dependencies:codetoolsdata.tabledigestdoFutureforeachfuturefuture.applyglobalsiteratorslatticelistenvMatrixmvtnormparallellyRcppsurvival

Simulate Fixed Designs with Ease via sim_fixed_n
Step 1: Define design parameters | Step 2: Run sim_fixed_n() | Step 3: Summarize simulations

Last update: 2025-06-11
Started: 2025-03-21

Simulate Group Sequential Designs with Ease via sim_gs_n
Step 1: Define design paramaters | Step 2: Run sim_gs_n() | Step 3: Summarize simulations | References

Last update: 2025-06-11
Started: 2025-03-21

Simulating time-to-event trials in parallel
Overview | Background | The sequential run | Setting up a parallel backend | Execution in parallel | A nested parallel example

Last update: 2025-04-03
Started: 2023-09-25

Custom Fixed Design Simulations: A Tutorial on Writing Code from the Ground Up
Step 1: Simulate time-to-event data | Scenario a) The simplest scenario | Scenario b) Differential dropout rates | Scenario c) Stratified designs | Scenario d) Multi-arm designs | Step 2: Cut data | Step 3: Run tests | Step 4: Perform the above single simulation repeatedly | Step 5: Summarize simulations | References

Last update: 2025-03-25
Started: 2025-03-21

Note on potential discrepancies between simtrial and survdiff
Overview | Scenario definitions | A scenario that generates a discrepancy

Last update: 2025-03-13
Started: 2025-01-31

TTE simulation data manipulations
Overview | Results data table | Simulated trial dataset generation | Dataset manipulations for analysis | Flow for simulating group sequential: one scenario algorithm

Last update: 2024-08-08
Started: 2023-05-30

Using the Magirr-Burman weights for testing
Introduction | Simulating a delayed effect example | Generalizing the Magirr-Burman test | Freidlin and Korn strong null hypothesis example | References

Last update: 2024-08-08
Started: 2023-11-28

Restricted mean survival time (RMST)
Introduction | RMST vs. logrank | Estimation of RMST in a single arm at a single time point | $$\hat{S}(t_i) | \prod_{j=1}^{i}\left(1-\frac{d_{j}}{Y_{j}}\right)$$Based on the definition and formula above, $\text{RMST}(\tau)$ can be estimated by$$\widehat{\text{RMST}}(\tau) | \int_{0}^{\tau} \hat{S}(t) d t | The standard error of $\widehat | \widehat{\text{Var}}(\widehat{\text{RMST}}(\tau)) | \sqrt | \int_{t_i}^{\tau} \hat{S}(t) d t | Estimation of RMST differences in 2 arms at a single time point | References

Last update: 2024-07-23
Started: 2024-02-05

Approximating an arbitrary hazard function

Last update: 2024-05-07
Started: 2023-11-28

Basic tools for time-to-event trial simulation and testing
Overview | Randomization | Enrollment | Time-to-event and time-to-dropout | Generating a trial | Cutting data for analysis | Generating a counting process dataset | Logrank and weighted logrank testing | Simplification for 2-arm trials

Last update: 2024-05-07
Started: 2023-11-28

Computing p-values for Fleming-Harrington weighted logrank tests and the MaxCombo test
Introduction | Defining the test | Executing for a single dataset | Generating test statistics with sim_fixed_n() | Generating data with sim_pw_surv() | Using survival data in another format | Simulation | References

Last update: 2024-05-07
Started: 2024-04-11

Readme and manuals

Help Manual

Help pageTopics
Convert summary table to a gt objectas_gt as_gt.simtrial_gs_wlr
Process survival data into counting process formatcounting_process
Create a cutting functioncreate_cut
Create a cutting test functioncreate_test
Cut a dataset for analysis at a specified datecut_data_by_date
Cut a dataset for analysis at a specified event countcut_data_by_event
Zero early weighting functionearly_zero
Time-to-event data example 1 for non-proportional hazards working groupex1_delayed_effect
Time-to-event data example 2 for non-proportional hazards working groupex2_delayed_effect
Time-to-event data example 3 for non-proportional hazards working groupex3_cure_with_ph
Time-to-event data example 4 for non-proportional hazards working groupex4_belly
Time-to-event data example 5 for non-proportional hazards working groupex5_widening
Time-to-event data example 6 for non-proportional hazards working groupex6_crossing
Fleming-Harrington weighting functionfh
Piecewise exponential survival estimationfit_pwexp
Derive analysis date for interim/final analysis given multiple conditionsget_analysis_date
Get date at which an event count is reachedget_cut_date_by_event
MaxCombo testmaxcombo
Magirr and Burman weighting functionmb
Simulated survival dataset with delayed treatment effectmb_delayed_effect
Milestone test for two survival curvesmilestone
Perform multiple tests on trial data cuttingmultitest
Permuted fixed block randomizationrandomize_by_fixed_block
RMST difference of 2 armsrmst
The piecewise exponential distributionrpwexp
Generate piecewise exponential enrollmentrpwexp_enroll
Simulation of fixed sample size design for time-to-event endpointsim_fixed_n
Simulate group sequential designs with fixed sample sizesim_gs_n
Simulate a stratified time-to-event outcome randomized trialsim_pw_surv
Summary of group sequential simulations.summary.simtrial_gs_wlr
Convert enrollment and failure rates from 'sim_fixed_n()' to 'sim_pw_surv()' formatto_sim_pw_surv
Weighted logrank testwlr wlr.counting_process wlr.default wlr.tte_data