TrialSimulator 1.23.0
Updates
-
trial()now defaultsenrollertoStaggeredRecruiterand accepts no other enroller: any non-StaggeredRecruitervalue is rejected with an informative error. Theenrollerargument is retained for backward compatibility, so existing code that passesenroller = StaggeredRecruiterexplicitly is unaffected, and code that omits it now gets the default.
TrialSimulator 1.22.0
New Feature
-
StaggeredRecruiter()now supports recruitment pauses: a window withpiecewise_rate = 0enrolls no one while calendar time still advances, so accrual resumes at the window’send_time. Pauses may occur in the first window or span several consecutive windows (e.g., a safety hold, a site not yet activated, or a seasonal gap).
Updates
-
StaggeredRecruiter()enrollment times are now the deterministic inverse of the cumulative accrual intensity: the cumulative accrual capacity increases by window length ×piecewise_rateacross each window (no per-window truncation), so an integer-capacity window holds exactly that many patients. Single open-ended schedules and integer-capacity windows are unchanged; schedules with fractional per-window capacity now yield slightly different (more accurate) times. -
StaggeredRecruiter()input validation is stricter: the lastend_timemust beInfwith a positive rate (so the schedule can always supply the patients the engine requests, including the inflated count used for adaptive resizing); a positive rate too low to enroll even one patient (window length ×piecewise_rate< 1) is now an error pointing topiecewise_rate = 0; andnmust be a positive integer.
TrialSimulator 1.21.0
Bug Fix
-
GraphicalTesting$test()no longer errors withalpha_spent should be monotonically increasingwhen a hypothesis is first tested only at a later (or final) look. This happens when a hypothesis holds zero or very small allocated alpha at early looks and inherits alpha after another hypothesis is rejected: those looks yield a degenerate (flat, near-zero) reconstructed cumulative alpha-spent sequence. Such entries are now truncated and floored to a strictly increasing sequence before being passed to the group sequential boundary computation.
Unit Tests
- Add regression tests for the above fix (alpha inherited only at the final look; tiny-alpha early looks with degenerate spending boundaries), plus tests that re-including an already-rejected hypothesis at a later look is ignored safely and that
computeCumulativeAlphaSpenttreatsInfboundaries as zero increments.
TrialSimulator 1.20.0
New Feature
-
endpoint()now acceptstype = "baseline"for a non-tte endpoint observed at randomization (e.g., a baseline covariate, biomarker, or subgroup indicator). Its readout is0by definition and must be omitted fromreadout. For forward compatibility, a non-tte endpoint observed at randomization can still be defined the existing way withreadout = 0.Endpoints$new()continues to recognize only"tte"and"non-tte"; the conversion happens inendpoint().
TrialSimulator 1.19.1
Documentation
- Add the “Crossover at milestone” vignette demonstrating
crossover(). - Update the
regimen()/crossover()examples and help pages to use the naturalifelse(condition, new_value, original)idiom inhow()and to return only the switching patients inwhat(), rather than relying onNAto mark unchanged cells or non-switchers. The engine still acceptsNAfor backward compatibility.
TrialSimulator 1.19.0
New Feature
- Add
crossover()for milestone-triggered treatment crossover. Called inside a milestone’s action function, it lets patients still in the trial switch treatment at (or after) the milestone, altering only their post-switch endpoint values. Regimens are unified under one contract keyed off an earliest crossover time; the classic enrollment regimen added viaadd_regimen()is theT = 0case.
Updates
- A regimen’s
how()may now only modify post-switch outcomes: returning a value that differs from the original for an endpoint whose readout/event is at or beforeswitch_time(a pre-switch or already-observed outcome) raises an error. Guard suchhow()functions accordingly, e.g.os = ifelse(os > switch_time, new_os, os).
TrialSimulator 1.18.4
CRAN release: 2026-05-13
Bug Fix
- Re-export
Surv()andstrata()from thesurvivalpackage so that user-supplied formulas in action functions (e.g.Surv(os, os_event) ~ arm) work afterlibrary(TrialSimulator)alone, without requiringlibrary(survival)or thesurvival::prefix. This fixes errors in parallel runs (n_workers > 1) where each worker only attachesTrialSimulator(reported in #14).
TrialSimulator 1.18.0
New Feature
- Accelerate milestone trigger evaluation via C++ helpers (Rcpp) for
eventNumber()andenrollment()conditions. Wall-time reduction ranges from a few percent to ~20% depending on how condition-evaluation-heavy the design is, with no change to results. Setoptions(trialsimulator.use_cpp = FALSE)to fall back to the original R implementation.
TrialSimulator 1.17.0
New Feature
- Add
CorrelatedPfsAndOs2()to simulate correlated PFS and OS using a Gumbel copula while targeting marginal PFS/OS medians and Kendall’s tau between observed, uncensored PFS and OS times.
Updates
- Add a vignette for simulating correlated PFS and OS using the Gumbel copula method, alongside the existing illness-death model vignette.
- Skip an unnecessary
dplyr::filter()call inTrials$get_event_tables()when no filter expression is provided, reducing total simulation wall time by roughly 5-10% in trials with frequent milestone condition checks.
TrialSimulator 1.16.0
CRAN release: 2026-04-13
New Feature
- Add
n_switchescolumn to locked data returned byget_locked_data(), counting the number of treatment switches per patient within the data lock window. - Add
expandRegimen()to expand theregimen_trajectorycolumn in locked data into a long-format data frame with one row per regimen segment per patient.
TrialSimulator 1.15.0
Bug Fix
- Fix a bug in
regimen()to support both single or multiple switching.
TrialSimulator 1.14.0
New Feature
- Support multiple rounds of dynamic treatment switching through
regimen().
TrialSimulator 1.13.0
Bug Fix
- Fix a minor bug displaying incorrect event count when using
enrollment()to define milestone. This bug does not affect milestone triggering.
TrialSimulator 1.11.0
New Feature
- Add function
solvePiecewiseConstantExponentialDistribution()to compute event rates in time windows given survival probabilities at changepoints. - Add
qPiecewiseExponent(), the quantile function of piecewise exponential distribution. This function is useful to simulate time-to-event endpoint that is correlated to other endpoints using the copula method. For example, thesimdatapackage needs marginal quantile functions.
TrialSimulator 1.10.0
CRAN release: 2026-02-15
New Feature
- Support parallelization in
Controllers$run()through new argumentn_workers. The packagemiraiis used. Althoughmiraiadvocates the use of L’Ecuyer-CMRG streams to maintain independence between multiple streams, however,TrialSimulatorresets it to be Mersenne-Twister streams to force identical behavior betweenn_workers = 1andn_workers > 1. This enables debuggability and reproduciability under single-process mode by setting seed that causes issues under multi-process mode.
TrialSimulator 1.9.0
New Feature
- Support wrapper functions for adaptation, including
remove_arms(),add_arms(),update_sample_ratio(),set_duration(),resize()andupdate_generator(). - More informative message is prompted when error is throwed from an action function; milestone’s name is printed.
TrialSimulator 1.7.0
CRAN release: 2025-12-19
TrialSimulator 1.3.0
CRAN release: 2025-09-26
Major Updates
- Action function no longer needs argument
milestone_name. Now action function only requires argumenttrialand supports optional arguments. -
milestone()now support...to pass arguments to action functions. - Documents and vignettes are updated.
TrialSimulator 1.2.0
New Feature
-
enrollment()now supportsmin_treatment_durationto ensure minimum treatment duration received by patients at a milestone. With its default value 0, milestone is triggered when a specific number of patients are enrolled. - No longer print the return value of action function, thus
invisible(NULL)is no longer recommended as return value of action function.
TrialSimulator 0.97.0
Bug Fix
- Fix a bug in function
event_plot()for plot of cumulative events number when endpoint name is"ep". This is due to data masking indplyr. - Fix issues in unit tests caused by new dropout mechanisum.
- use Bonferroni method in unit test of
update_sample_ratio. This test is probably broken by randomness (it is okay).
TrialSimulator 0.93.0
New Feature
-
update_sample_ratio()now supports updating multiple arms simultaneously. When ratio is not a whole number,sample()is used to replace the permuted block algorithm to randomize patients to arms. This enable response-adaptive design. - Add a vignette of response-adaptive design using
update_sample_ratio().
TrialSimulator 0.91.0
TrialSimulator 0.90.0
TrialSimulator 0.82.0
New Feature
- The function
fitCoxphnow supportsformulato compute log hazard ratio or hazard ratio as main effect ofarm. It will detect whether arm’s main effect is specified in formula. It allows covariates and interaction between covariates and arm. However, only the main effect of arm is tested and returned. - Add unit tests for
fitCoxph.
TrialSimulator 0.68.0
Updates
- Rename trial event as milestone. This a major update. Relevant codes and documents are updated accordingly.
- Add executable examples for
controller()as per suggestion from CRAN team.
TrialSimulator 0.67.0
Updates
- Print event counts at trial events using
message()so that Shiny app can display it properly.
TrialSimulator 0.58.0
TrialSimulator 0.57.0
Updates
- Move vignette of comparison between
GraphicalTestingandgraphicalMCPto repository TrialSimulatorDocuments.
TrialSimulator 0.55.0
TrialSimulator 0.35.0
TrialSimulator 0.33.0
New Features
- Provide a default action function
do_nothing()if users have no intent to do anything at a triggered event. This function can be passed to the argumentactionwhen creating a new event, e.g.,Event$new(name = 'interim', trigger_condition = TriggerByCalendarTime, action = do_nothing, calendar_time = 64).