TrialSimulator 1.39.0
CRAN release: 2026-10-09
Bug fixes
-
fitLinear()andfitLogistic()(exceptscale = 'coefficient') no longer fail with “We are unable to reconstruct the data” when the right-hand side offormulatransforms a covariate, e.g.,log(x). The fitted rows are now passed toemmeansdirectly, so it no longer re-evaluates the model call, where the analysis data are not visible. The same re-evaluation caused a test failure on R-devel for Windows.
TrialSimulator 1.38.2
Updates
- New vignette An Example of Simulating a Trial with Adaptive Enrichment Design: a two-stage design with a biomarker-defined subgroup, where conditional power at an interim drives a five-zone decision (futility, unfavorable, enrichment, promising with sample size and event number reassessment, favorable), the two stages are combined by the inverse normal method, and the full-population and subgroup hypotheses are tested by a closed test with Simes’ test. Operating characteristics from 10000 replicates under the alternative and under the global null are stored in the package.
-
event_plot()now shows the trial as observed, i.e., cumulative counts up to the time of the last triggered milestone. Since 1.36.0 trial data hold the full generated follow-up of every patient, so without this cut the plot extended to the last generated event, far beyond the end of the trial.
TrialSimulator 1.38.0
Breaking changes
- Custom data (
save_custom_data(),get(),bind()) is now strictly replicate-local: entries saved in an action function no longer leak into the next replicate, and data saved beforerun()does not reach the replicates. Afterrun(), the last replicate’s custom data remains available for inspection. -
save_custom_data()rejects aNULLvalue and requiresnameto be a non-empty character of length 1.
New features
-
trial()gains a read-onlyglobal_dataargument: a named list of, e.g., design parameters or template objects of testing procedures, available in every replicate throughtrial$get_global_data(name). R6 objects anddata.tables are copied at registration and on every read, so registered entries can never be modified; seevignette('actionFunctions'). -
controller$run()refuses to start on a trial that has already been run and points toreset(), instead of failing at the first milestone with a misleading error.
TrialSimulator 1.37.0
Breaking changes
-
additional_followupno longer has a default instop_followup(),Trials$stop_followup(),remove_arms()andTrials$remove_arms(). Existing calls must state it:additional_followup = 0reproduces the previous behavior. Whether follow-up stops at the milestone or continues is a design decision that should be visible in the action function.
Updates
-
remove_arms()andTrials$remove_arms()gainadditional_followup(thanks, @gravesti, #21); 0 is the previous behavior. Patients of the removed arms are followed for that much longer after the milestone, or for the rest of the trial withInf, e.g., to collect overall survival of a dose that stops enrolling. One value is shared by all arms removed in a call; call once per arm for different values. Events of a removed arm within its follow-up are counted by a later milestone only if the arm is listed inarmsof its triggering condition;arms = NULLnever counts removed arms.
Bug fixes
-
trial(duration = ...)is now an error stating that the argument was removed in 1.36.0. Previouslydurationfell into...and was forwarded to the enroller and dropout generators, which ignore it, so a script written for an earlier version kept running with its follow-up no longer capped and nothing said so. - The
armsargument ofeventNumber()andenrollment()is now validated once, at the entry shared by the C++ and R implementations of the lock-time search, so both behave the same. A name that has never been an arm of the trial is an error; previously the default C++ path dropped it silently, so a misspelled arm only delayed the milestone. The set of known arms is every arm ever added in the current replicate, so an arm added and then removed within the trial is accepted; the R path previously checked against the current arms and the arms present whenrun()started, and rejected such an arm. - An arm listed in
armsthat has been removed byremove_arms()before the milestone is evaluated now raises a warning unless the trial is silent (silent = TRUEintrial()orrun()). Its patients are still counted as specified. Usearms = NULLto count on the arms in the trial only.
Documentation
-
?remove_armsnow states what removing an arm does (no further randomization, out of the set of arms of the trial, data censored at removal but kept in locked data) and documents the three patterns for counting at later milestones after a data-driven removal:arms = NULLfor the arms still in the trial, listing every arm of the design to include removed ones, andupdate_milestone()in the same action function for a subset that depends on which arm was removed. Examples show each pattern. - The adaptive design vignette explains why the final analysis lists all three arms in
enrollment(): after dose selection,arms = NULLwould count on the remaining arms only and the total sample size could never be reached. - The
trial()examples of?controllerand?summarizeMilestoneTimeno longer passduration.
TrialSimulator 1.36.0
Breaking changes
-
durationis removed fromtrial(). A trial no longer has a pre-specified duration: it ends when its last milestone is triggered, and the timing of a milestone is determined by its triggering condition. Users of event-driven designs no longer need to guess a “sufficiently large” cap whose unit depends on the design. Existing code must drop the argument. For a trial whose milestones were all reachable within the oldduration, results are unchanged for a given seed; a trial whose calendar-time milestone lay beyond the olddurationnow gets the full follow-up it was designed for instead of follow-up silently truncated atduration. -
set_duration()andTrials$set_duration()are removed. The design it served, extending a trial at an unblinded interim while patients enrolled by the interim keep their originally planned follow-up, is expressed within the action function of the interim astrial$stop_followup(additional_followup = planned_end - trial$get_current_time())for the freeze, andtrial$update_milestone('final', when = ...)for the new timing of the final analysis. The freeze pointplanned_endis the calendar time in the original triggering condition of the final analysis, which the user knows by design. Unlikeset_duration(), this recipe does not re-randomize and regenerate patients not yet enrolled at the interim, so the random number stream is no longer advanced by the adaptation; the two are equivalent in distribution. - Internal:
Trials$censor_trial_data()no longer has a default forcensor_at, the calendar time of administrative censoring; passcensor_at = Infto apply dropout censoring only, without administrative censoring.
Updates
- Trial data are no longer administratively censored at a trial-level horizon when patients are generated. Administrative censoring happens only at data locks (
lock_data()) and through adaptations (stop_followup(),remove_arms()).event_plot()extends its x axis to the time of the last triggered milestone.
TrialSimulator 1.35.8
CRAN release: 2026-09-04
Performance
-
fitLogrank()is faster. It now computes the (stratified) log rank statistic directly fromsurvival::survdiff()as observed-minus-expected events over its standard error, instead of fitting two Cox models per treatment arm (one for the sign of the effect and one withties = "exact"for the score test). Its magnitude agrees with the previous exact-score statistic up to floating point rounding, while its sign now consistently follows the treatment log-rank score; with tied event times this can correct the previous sign when the Efron Cox coefficient pointed in the opposite direction.infoand thetidy = FALSEcolumns are unchanged. When the statistic is undefined because its variance is zero (e.g., no event in the subset), a warning is issued and a simulation placeholderz = 0with the correspondingp = 0.5is returned instead of an error. On a three-arm dose-selection design with log rank tests at two milestones this removes roughly 40% of the per-replicate time, and roughly a third on an enrichment design driven by conditional power.
TrialSimulator 1.35.7
Performance
- Data locking is faster for trials with a regimen. The truncation of
regimen_trajectoryto the switches that have happened by the lock time, and then_switchescount, are now computed for all switching patients at once (onestrsplit()plustabulate()), instead of a per-patientmapply()followed by a per-patient regular expression. Both columns are unchanged for names without the reserved characters below; on a 1000-patient three-arm design with crossover this removes roughly 14% of the per-replicate time.
Updates
-
'@'and';'are now reserved characters of theregimen_trajectoryencoding:arm()rejects a name containing either, whether or not the trial uses a regimen (e.g.,arm(name = 'dose@5mg')used to be accepted and now is an error), andwhat()of a regimen or ofcrossover()must not return anew_treatmentcontaining either. Previously such names silently corrupted the trajectory andn_switches. Data locking also asserts that every trajectory with a switch parses cleanly and keeps its initial segment.
TrialSimulator 1.35.6
Performance
- New argument
tidyincontroller$run()(defaultFALSE). Withtidy = TRUE, the per-arm event count table (output columnn_events_<milestone>_<arms>) is not saved at milestones; per-endpoint totals and milestone times are still saved, and the table remains available in the attributes of locked data, soevent_plot()is unaffected. Saving that table is the most expensive part of the standard outputs: skipping it removes roughly 15% of the per-replicate time on a small two-arm design with trivial actions (on top of 1.35.5) and about 3% on a three-arm dose-selection design with log-rank tests at milestones. Unliketidyinget_output(), which removes columns after the fact, this avoids the cost entirely.
TrialSimulator 1.35.5
Performance
-
controller$run()collects the output of each replicate in a list and row-binds once at the end, instead of callingbind_rows()after every replicate (a fixed cost of roughly 1 ms per call). The same applies to the parallel path. Outputs are unchanged, including the partial output kept when a replicate fails. Removes roughly 10% of the per-replicate time on a small two-arm design with trivial actions and 3-5% on heavier designs.
TrialSimulator 1.35.4
Performance
- Patient enrollment is faster for trials without stratification factors (the common case). Internally,
enroll_patients()now assembles the patient data of each arm directly from one generated pool, skipping the per-stratum bookkeeping (table(),merge(),split(),bind_rows()) that stratified randomization requires. Generator and dropout functions are called in exactly the same order and with the same sizes as before, so the random number stream and therefore all results are unchanged for a given seed (a regression test pins the patient data of a fixed-seed trial to reference values). On a small two-arm design with trivial actions this removes roughly 19% of the per-replicate time; the relative gain shrinks as the statistical work per milestone grows.
TrialSimulator 1.35.3
Performance
- Patient generation is faster for arms with inclusion criteria (subset conditions in
arm(name, ...)). The criteria are now applied as a logical row mask with the semantics ofdplyr::filter()(conditions combined with&, rows withNAdropped,.data/.envpronouns supported), instead of callingdplyr::filter()in every round of the rejection-sampling loop. The mask evaluation is shared with the lock-time fast path of 1.35.2 (internalfilter_conditions_mask()). The human-readable criteria string used in error messages is also built once, when the arm is created, instead of on every generator call (deparsing quosures is not free). Results are unchanged; on a 1000-patient three-arm design withpfs <= osas inclusion criterion this removes roughly 9% of the per-replicate time.
TrialSimulator 1.35.2
Performance
- Milestone conditions with subset conditions, e.g.,
eventNumber(endpoint = 'pfs', n = 40, patient_id <= 70)orenrollment(n = 100, biomarker == 1), now take the C++ lock-time fast path. The subset conditions are reduced to a logical row mask with the semantics ofdplyr::filter()(conditions combined with&, rows withNAdropped,.data/.envpronouns supported) and the existing C++ helpers are applied to the subset, instead of building per-endpoint event tables withdplyrfor every endpoint in the trial. Results are unchanged; the pure-R path remains available throughoptions(trialsimulator.use_cpp = FALSE). On an enrichment design whose milestones are all subgroup-filtered this removes roughly 11% of the per-replicate time.
TrialSimulator 1.35.1
Performance
- Data locking is faster for trials with a regimen. The
n_switchescolumn of locked data is now computed on the subset of patients who switched treatment, instead of running a regular expression over theregimen_trajectoryof every enrolled patient at every milestone. Results are unchanged; for a 1000-patient three-arm design with crossover this removes roughly 9% of the per-replicate time.
TrialSimulator 1.35.0
Updates
- The trial now takes ownership of registered objects by capturing independent deep copies.
trial$add_arms()deep-clones every arm it registers, andtrial$add_regimen()deep-clones the regimen. Consequently, changes made to the caller’s arm or regimen objects after registration no longer affect the trial, and adaptations within the trial (e.g.,trial$update_generator(),trial$crossover()) no longer modify the caller’s objects, so those objects can be safely reused, e.g., to build another trial. Complete the configuration of an arm before registering it; after registration, change it only through the trial’s adaptation methods. The copy covers the arm, endpoint, and regimen objects themselves; a mutable environment or R6 object captured by a user-supplied function (generator, action,what/when/how) is shared by design of R closures and is not isolated. -
trial$add_arms()registration is now transactional: all incoming arms are validated (including endpoint-set consistency and re-use of the name of a previously removed arm) before any of them is installed, so a failing batch no longer leaves the trial partially modified. Re-adding an arm under the name of a removed arm is rejected explicitly; previously it failed halfway with the trial left partially modified. -
controller$run()now restores the listener’s milestones to their as-designed state before the first replicate. Previously, reusing a listener from an earlier controller in the same session left its milestones in a triggered state, silently suppressing them in the new run.
TrialSimulator 1.34.1
Bug fixes
- Generator updates no longer leak across simulation replicates. Previously, the arms snapshot taken at the beginning of
controller$run()shared its endpoint objects with the live arms, so atrial$update_generator()call in one replicate silently altered the data-generating process of all later replicates, and a failing replicate could not be reproduced from the seed reported in its error message. The snapshot now deep-clones endpoints, and every replicate starts from freshly cloned, as-designed arms.
Updates
-
trial$update_generator()now acceptsendpoint_namein any order. Endpoint names registered together in oneendpoint()call are matched as a set, so, e.g.,c('pfs', 'biomarker')andc('biomarker', 'pfs')are equivalent. Previously the names had to be given in registration order, and a reordered vector was rejected with a misleading error message. In addition, whenendpoint_namecovers only part of a registration, or mixes names from different registrations, the error message now spells out the exactendpoint_namevector(s) to use.
TrialSimulator 1.34.0
New features
- New method
trial$eventNumberReestimationFromConditionalPower()re-estimates the number of events at the final analysis for every treatment-vs-placebo comparison of a time-to-event endpoint: the smallest whole number of events, greater than the number observed at a triggered interim milestone, at which the conditional power oftrial$conditionalPower()reaches a target. Conditional power can be evaluated at the interim trend or at a user-specified hazard ratio, and a practical cap can be imposed throughD_cap. When no solution exists in the requested range,Dandachieved_cpareNAandtarget_reachedisFALSE. The search is exact even when conditional power is not monotone in the event number.
Updates
- Executable examples are added to the documentation of
trial$conditionalPower()and the new method. - A new vignette, “Conditional Power and Event-Number Reassessment”, describes the canonical conditional-power calculation, effect assumptions, alternative directions, nonmonotone event-number search, practical caps, and promising-zone usage in detail, including a complete action-based simulation program and precomputed operating-characteristic summaries.
TrialSimulator 1.33.0
New features
- New method
trial$conditionalPower()computes conditional power at a triggered interim milestone for every treatment-vs-placebo comparison of a time-to-event endpoint, under a group sequential design with one interim and one final analysis. It pulls the milestone’s locked data automatically and callsfitLogrank()internally to obtain the observed z statistic and number of events of each comparison. Conditional power can be evaluated at the interim trend (default), under the null, or at a user-specified hazard ratio, which is converted internally using the allocation ratio in effect at the milestone. Itsalphaargument is the one-sided nominal significance level corresponding to the planned final critical boundary, not the total design alpha or alpha spent at the final look. The calculation assumes the trial continues as designed (constant allocation ratio of the compared arms, planned final statistic and boundary); it is users’ responsibility to call it only when legitimate, e.g., not after the allocation ratio of the compared arms was adapted, asTrialSimulatordoes not verify this. Results are validated againstrpactandgsDesignin unit tests.
TrialSimulator 1.31.0
Updates
-
controller$run()can no longer be called twice withoutreset()in between. Previously, a secondrun()silently continued the already-executed trial (all milestones already triggered, snapshots partially overwritten) instead of starting a new simulation. To define a milestone whose triggering condition or action depends on interim results, register it upfront and revise it within an action function throughupdate_milestone(). - A milestone that would lock data at a time earlier than the current trial time now raises an informative error before any trial state is modified, naming both milestones involved and the seed to debug with. Previously the violation was caught by
save_milestone_time()only after the trial clock had been moved backwards and the locked snapshot stored; that check remains as an internal assertion, andset_current_time()gains a backstop against backward clock moves. -
listener$add_milestones()now raises an error when a milestone with the same name is already registered. Previously it warned and silently over-wrote the registered milestone. To modify a not-yet-triggered milestone within an action function, useupdate_milestone().
TrialSimulator 1.30.1
Updates
- Continue minimizing the public API of R6 classes:
Arms$get_number_endpoints(),Endpoints$get_readout()andEndpoints$get_type()are now private. The machinery methods ofArms(get_name(),get_endpoints_name(),has_endpoint()andupdate_endpoint_generator()) and ofEndpoints(get_uid()andupdate_generator()), which stay public only because trials and arms invoke them, now carry a bold warning that users should not call them directly. - Polish class documentation: user-facing methods of
Controllers,ArmsandEndpointsnow come with brief usage notes in the class description; exploratory methods (test_generator(),get_generator()andget_name()ofEndpoints;generate_data()andget_endpoints()ofArms) are documented as helpful for understanding the classes but not needed in formal simulation.
TrialSimulator 1.30.0
Updates
- Continue minimizing the public API of R6 classes:
Controllers$get_trial(),Controllers$get_listener(),Controllers$mute(),Milestones$execute_action(),Milestones$get_type(),Milestones$get_trigger_condition(),Milestones$get_action(),Regimens$get_number_time_selector()andRegimens$get_number_data_modifier()are now private. They were used only internally by their own classes. - The remaining public methods of
Milestonesand all public methods ofRegimensare invoked on their objects by other components of the package (listeners and trials) and stay public only for that reason; they now carry a bold warning that users should not call them directly, in the same style as theTrialsandListenersclasses.
TrialSimulator 1.29.0
Updates
- Minimize the public API of the
Listenersclass:get_milestones()is now private. The machinery methodsmonitor(),mute()andreset(), which stay public only because the controller invokes them, now carry a bold warning that users should not call them directly, in the same style as theTrialsclass.
TrialSimulator 1.28.0
New Feature
- New adaptation method
trial$update_milestone()(wrapperupdate_milestone()): update the triggering condition and/or the action of a not-yet-triggered milestone from within an action function. The update takes effect right after the current action function returns, and the as-designed milestone is restored between simulation replicates.
TrialSimulator 1.27.0
Updates
- Minimize the public API of the
Trialsclass: 38 methods used only internally are now private (includingcensor_trial_data(),roll_back(),enroll_patients(),get_trial_data()andindependentIncrement()), leaving 34 public members whose definitions and documentation are reorganized into sections: adaptation methods, methods callable within action functions (data access and manipulation, trial status queries, statistical testing), trial setup (add_regimen(), which must not be called within action functions), and internal machinery. Machinery methods that stay public only because other components of the package invoke them now carry a bold warning that users should not call them directly. -
make_snapshot()distinguishes private methods from data fields viabindingIsLocked()(R6 locks the binding of every member defined as a function) instead of a hardcoded name list, so snapshot/reset stay correct as methods are added.
TrialSimulator 1.26.2
Updates
- Replace deprecated
.data$in tidyselect contexts (rename()/select()in the correlated PFS/OS generators,PiecewiseConstantExponentialRNG(), and endpoint naming) with string literals, eliminating the tidyselect deprecation warnings that flooded test output..data$remains in data-masking contexts (filter(),mutate(),aes()), where it is still the recommended idiom;R CMD checkstays clean. -
set_dropout()documentation no longer claims adaptive use: dropout times are generated at enrollment, so updating the generator within an action function would not apply to enrolled patients. - Ignore the knitr vignette cache in
.gitignoreand exclude.DS_Storefrom the build via.Rbuildignore. - Fix the remaining test-time warnings:
event_plot()now selects the endpoint column viaall_of()(tidyselect external-vector deprecation), andplot.three_state_model()zooms withcoord_cartesian()instead ofxlim(), so the dashed guide segments anchored at the axes are clipped and rendered rather than dropped with a ggplot2 warning. - Fix the root cause of a stray
Rplots.pdfappearing after test runs:summarizeDataFrame()restoredpar()settings viaon.exit()after itspng()device was already closed, which implicitly opened the default device.par()settings are local to the device and need no restore.
TrialSimulator 1.26.1
Bug Fix
-
make_snapshot()silently droppedNULL-valued private fields from the snapshot (assigningNULLwith[[<-deletes a list entry);reset()’s explicit re-null list masked this for existing fields. The snapshot now preservesNULLfields, so any future field is restored across simulation replicates by construction. - Fix an error message in
dunnettTest()that referenced an undefined variable. - Fix a summary line in the
doseRangingvignette that compared a string literal instead of thedecisioncolumn.
Updates
- Regenerate the precomputed outputs of the
doseRangingandfixedDesignvignettes under the 1.25.2 enrollment convention; thefixedDesignoutput now contains the 1,000 replicates its code states (previously 100). - Add an
R CMD checkGitHub Actions workflow (macOS/Windows/Ubuntu; R release/devel/oldrel). - Add
\valuesections to exported help topics, a grouped reference index for the pkgdown site, and mention the newest adaptations in theactionFunctionsvignette introduction. - Remove the unused
graphicalMCPentry fromSuggests.
TrialSimulator 1.26.0
New Feature
- New adaptation method
trial$update_accrual_rate()(wrapperupdate_accrual_rate()): update the accrual rate of the recruitment curve at a milestone, e.g., to revise recruitment after dose selection or enrichment, or to pause it for a period after an interim decision.end_timeof the newaccrual_rateis measured from the milestone; patients not yet enrolled (and the enrollment reserves used byresize()) are re-planned and re-randomized under the new schedule, while enrolled patients are left unchanged. Like other adaptations, it must be called within an action function, after a milestone has been triggered.
TrialSimulator 1.25.2
Updates
-
StaggeredRecruiter()now enrolls patientkwhen the planned cumulative accrual reachesk(previouslyk - 1): under a constant raterthen-th patient enrolls exactly atn / r, so a milestone triggered byenrollment(n)occurs exactly at the planned accrual time. The first patient enrolls at1 / piecewise_rateinstead of time 0, and all enrollment times shift by one inter-arrival accordingly; simulation results under a fixed seed differ slightly from 1.25.1. The precomputed output of theadaptiveDesignvignette is regenerated under the new convention.
TrialSimulator 1.25.1
Bug Fix
- Fix an infinite loop in patient enrollment when fractional sample ratios are combined with stratification factors: the pool labels now match the unstratified randomization queue in that case.
Updates
- Warn when fractional sample ratios are used in a trial with stratification factors: stratified randomization is not supported in that case and unenrolled patients are randomized by
sample()without stratification. The warning is suppressed whensilent = TRUE.
TrialSimulator 1.25.0
New Feature
- New adaptation method
trial$stop_followup()(wrapperstop_followup()): stop follow-up of a subset of enrolled patients at a milestone, optionally after extra follow-up time (additional_followup). Patients are selected by conditions compatible withdplyr::filter; affected time-to-event endpoints are censored and non-time-to-event readouts are set to missing. This adaptation supports, e.g., treatment discontinuation and enrichment design. Like other adaptations, it must be called within an action function, after a milestone has been triggered.
Updates
-
censor_trial_data()gains...to further restrict the patients to be censored by conditions compatible withdplyr::filter, in addition toselected_armsandenrolled_before. Internal callers are unchanged and benchmark at parity with 1.24.0; simulation outputs are identical.
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).