Package: TrialSimulator 1.23.0

TrialSimulator: Clinical Trial Simulator

Simulate phase II and/or phase III clinical trials. It supports various types of endpoints and adaptive strategies. Tools for carrying out graphical testing procedure and combination test under group sequential design are also provided.

Authors:Han Zhang [cre, aut]

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

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

Bug tracker:https://github.com/zhangh12/trialsimulator/issues

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

Uses libs:
  • c++– GNU Standard C++ Library v3

On CRAN:

Conda:

cpp

7.81 score 7 stars 38 scripts 587 downloads 49 exports 46 dependencies

Last updated from:2b86fbb046. Checks:13 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK272
linux-devel-x86_64OK245
source / vignettesOK347
linux-release-arm64OK232
linux-release-x86_64OK224
macos-release-arm64OK206
macos-release-x86_64OK262
macos-oldrel-arm64OK194
macos-oldrel-x86_64OK336
windows-develOK184
windows-releaseOK195
windows-oldrelOK201
wasm-releaseOK186

Exports:add_armsarmArmscalendarTimecontrollerControllersCorrelatedPfsAndOs2CorrelatedPfsAndOs3CorrelatedPfsAndOs4crossoverdoNothingDynamicRNGFunctionendpointEndpointsenrollmenteventNumberexpandRegimenfitCoxphfitFarringtonManningfitLinearfitLogisticfitLogrankGraphicalTestingGroupSequentialTestlistenerListenersmilestoneMilestonesPiecewiseConstantExponentialRNGqPiecewiseExponentialrconstregimenRegimensremove_armsresizeset_durationsolveMixtureExponentialDistributionsolvePiecewiseConstantExponentialDistributionsolveThreeStateModelStaggeredRecruiterstratasummarizeDataFramesummarizeMilestoneTimeSurvtrialTrialsupdate_generatorupdate_sample_ratioweibullDropout

Dependencies:base64encclicpp11digestdplyremmeansestimabilityevaluatefarverfastmapgenericsggplot2gluegMCPLitegtablehighrhtmltoolsisobandknitrlabelinglatticelifecyclemagrittrMASSMatrixmvtnormnumDerivpillarpkgconfigR6RColorBrewerRcpprlangrpactrstudioapiS7scalessurvivaltibbletidyselectutf8vctrsviridisLitewithrxfunyaml

Define Non-Time-to-Event Endpoints
Define endpoints with random number generators | Baseline endpoints

Last update: 2026-06-15
Started: 2025-03-19

Crossover at a Milestone
Where crossover() is called | The earliest crossover time: delay and the opening time | How the eligible population is determined | How the package monitors the triplet's output | Developing the triplet | A worked example | Scenarios | Relationship to add_regimen() | Inspecting the switches

Last update: 2026-06-11
Started: 2026-06-11

Simulate Trials with Dynamic Treatment Switching
A Common Structure | Why regimen uses three functions? | The Role of what() | The Role of when() | The Role of how() | Implement Dynamic Treatment Switching | Example 1: Crossover after progression | Example 2: Crossover for non-responsers | Example 3: Crossover when condition deteriorates | Example 4: Crossover multiple times

Last update: 2026-06-11
Started: 2026-03-18

Simulate Correlated Progression-Free Survival and Overall Survival Using a Gumbel Copula
Model | $$\Pr(X > x, Y > y) | $$\Pr(P > t) | \Pr(X > t, Y > t) | \exp\left[-\left{(\lambda_X^\theta + \lambda_Y^\theta)t^\theta\right}^{1/\theta}\right] | Choosing the Copula Parameter | $$\tau(P,Y) | $$\tau(P,Y)-\tau(X,Y) | Example | Practical Guidance | Appendix: Kendall's Tau for Observed PFS and OS | $$S_{X,Y}(x,y) | \Pr(X>x, Y>y) | $$\Pr(A>a, B>b) | $$S_{P,Y}(Y,Y) | $$E | $$L_R(s) | \frac{1}{\theta}\int_0^\infty e^{-(1+s)r}(r+\theta-1),dr | $$\int_c^1L_R\left{\left(\frac{1-w}{d}\right)^{1/\theta}\right}dw | $$\frac{d}{dt}\left(\frac{t^\theta}{1+t}\right) | $$d\left[\frac{t^\theta}{1+t}\right]_0^1 | c\frac | 4E{S_{P,Y}(P,Y)}-1 | \frac | 1-\frac{1}{\theta}\left(\frac{\lambda_X^\theta}{\lambda_P^\theta}\right)

Last update: 2026-05-08
Started: 2026-04-23

Dose-Ranging Study
Simulation Settings | Define Placebo and High Dose Arms | Define a Trial | Define Milestones and Actions | Execute a Trial | Appendix: Code of Helper Function

Last update: 2026-04-26
Started: 2025-09-27

An Example of Fixed Design with Two Correlated Endpoints
Simulation Settings | Transition Hazards of PFS and OS | Define Treatment Arms | Define a Trial | Define Milestone and Action for Final Analysis

Last update: 2026-04-23
Started: 2025-08-05

An Example of Simulating a Trial with Adaptive Design
Simulation Settings | Define Three Arms | Define a Trial | Define Trial Milestones and Action Functions | Execute a Trial | Execute Trial Simulation

Last update: 2026-04-23
Started: 2024-11-27

Define and Summarize Arms in Clinical Trials
Define Arm with Mulitple Sets of Endpoints | Add Inclusion Criteria for the Arm | Simulate Data Explicitly (Not Recommended)

Last update: 2026-04-23
Started: 2025-07-09

Simulate Correlated Progression-Free Survival and Overall Survival as Endpoints Under Illness-Death Model
Reparameterization | Example | Further Discussion

Last update: 2026-04-23
Started: 2026-04-23

Crossover Design with Wash-out Periods
Simulation Settings | Define Endpoints in Four Arms | Define a Trial | Define Milestone and Action | Execute a Trial

Last update: 2026-03-30
Started: 2026-03-16

Designs with Response-Adaptive Randomization
Simulation Settings | Define Data Generator of fev1 | Define fev1 Endpoints for Each Arm | Define a Trial | Define Milestones and Associated Actions | Execute a Trial | Appendix: Codes of Helper Functions

Last update: 2026-03-29
Started: 2025-08-09

Specify Actions to Execute at Trial Milestones
Define Trial Milestones | Custom Action Functions | Perform statistical analyses on data snapshot | Save intermediate results | Example 1: saving hazard ratio and p-value | Example 2: passing complex objects between milestones | Example 3: defining auxiliary information before the trial runs | Alter a trial via adaptation

Last update: 2025-11-15
Started: 2025-07-28

Define Longitudinal Endpoints
Example: Simulating Longitudinal Blood Pressure Endpoints | Defining Endpoints for an Arm | Defining Endpoints for Another Arm | Creating Treatment Arms and Adding Endpoints

Last update: 2025-09-27
Started: 2025-06-07

Condition System for Triggering Milestones in a Trial
A trial has been running for 6 months | At least 520 patients have been enrolled | At least 400 patients have been enrolled, and each has received a minimum of 3 weeks of treatment | At least 340 PFS events are observed | Other examples

Last update: 2025-09-17
Started: 2025-03-21

Define Time-to-Event Endpoints
Define a univariate endpoint with random number generators from stats | Define a univariate endpoint with custom random number generators | Define multiple endpoints | An example of a custom random number generator for correlated endpoints

Last update: 2025-09-17
Started: 2025-03-16

Wrapper Functions of Common Statistical Methods in TrialSimulator
Example | Analyze Time-to-Event Endpoint | Analyze Continuous Endpoint | Analyze Binary Endpoint

Last update: 2025-08-05
Started: 2025-08-05

Readme and manuals

Help Manual

Help pageTopics
Adding One or More Arms to a Trialadd_arms
Define an Armarm
Class of ArmArms
Triggering Condition by Calendar TimecalendarTime
Define a Controllercontroller
Class of ControllerControllers
Generate Correlated PFS and OS Using Gumbel CopulaCorrelatedPfsAndOs2
Generate Correlated PFS and OS Using the Three-States Illness-Death ModelCorrelatedPfsAndOs3
Generate Correlated PFS, OS and Objective ResponseCorrelatedPfsAndOs4
Crossover at a Milestonecrossover
An Action Function that Does NothingdoNothing
A wrapper of random number generator.DynamicRNGFunction
Define Endpointsendpoint
Class of EndpointEndpoints
Triggering Condition by Number of Randomized Patientsenrollment
Triggering Condition by Number of Events or Non-missing Observations of an EndpointeventNumber
Expand regimen trajectory into long formatexpandRegimen
Fit Cox Proportional Hazard Ratio modelfitCoxph
Farrington-Manning test for rate differencefitFarringtonManning
Fit linear regression modelfitLinear
Fit logistic regression modelfitLogistic
Carry out log rank testfitLogrank
Get simulation output in the vignette adaptiveDesign.RmdgetAdaptiveDesignOutput
Get simulation output in the vignette doseRanging.RmdgetDoseRangingOutput
Get simulation output in the vignette fixedDesign.RmdgetFixedDesignOutput
Class of GraphicalTestingGraphicalTesting
Class of GroupSequentialTestGroupSequentialTest
Define a Listenerlistener
Class of ListenerListeners
Define a Milestonemilestone
Class of MilestonesMilestones
Generate Time-to-Event Endpoint from Piecewise Constant Exponential DistributionPiecewiseConstantExponentialRNG
Plot Triggering Time of Milestones in Simulated Trialsplot.milestone_time_summary
Plot result of three-state illness-death modelplot.three_state_model
Quantile Function of Piecewise Exponential DistributionqPiecewiseExponential
Generate Constant Variablerconst
Define a Regimenregimen
Class of RegimensRegimens
Removing One or More Arms From a Trialremove_arms
Resizing a Trialresize
Extending Duration of a Trialset_duration
Solve Parameters in a Mixture Exponential DistributionsolveMixtureExponentialDistribution
Compute Constant Rates of Piecewise Exponential DistributionsolvePiecewiseConstantExponentialDistribution
Solve Parameters in a Three-State Illness-death ModelsolveThreeStateModel
Generate Enrollment Time from Piecewise Constant Uniform DistributionStaggeredRecruiter
Summarize A Data FramesummarizeDataFrame
Summary of Milestone Time from Simulated TrialssummarizeMilestoneTime
Define a Trialtrial
Class of TrialTrials
Updating Data Generators of One or More Endpoints in an Armupdate_generator
Updating Sampling Ratios of Existing Arms in a Trialupdate_sample_ratio
Calculate Parameters of Weibull Distribution as a Dropout MethodweibullDropout