lrsim_bmTrtSel: Simulation of a seamless phase II/III design with treatment...

View source: R/lrsim_bmTrtSel.R

lrsim_bmTrtSelR Documentation

Simulation of a seamless phase II/III design with treatment selection based on a short-term endpoint

Description

Simulates a two-stage seamless phase II/III trial in which several doses are compared with a common control. At the end of phase II a single dose is carried forward based on the posterior benefit-risk tradeoff of a binary short-term efficacy endpoint and a binary toxicity endpoint. The confirmatory phase III analysis is performed on a time-to-event long-term endpoint whose hazard depends on the short-term response status, and the type I error rate is protected by a closed testing procedure combined across the two stages.

Usage

lrsim_bmTrtSel(
  phase2SampleSizePerArm = NA_integer_,
  phase3SampleSizePerArmMin = NA_integer_,
  phase3SampleSizePerArmMax = NA_integer_,
  responseProbControl = NA_real_,
  responseProbTreatments = NA_real_,
  toxicityProbTreatments = NA_real_,
  corrEfficacyToxicity = 0,
  hazardRateControl = NA_real_,
  hazardRateTreatments = matrix(),
  studyDurationPhase3 = NA_real_,
  toxicityWeight = NA_real_,
  toxicityUpperLimit = NA_real_,
  efficacyThreshold = 0,
  safetyThreshold = 0,
  useUniformPrior = TRUE,
  methods = c("ctdunnett", "ctsimes", "ctpooled", "cer", "TSSSD.k", "TSSSD.uk",
    "TSSSD.k.rank", "TSSSD.uk.rank", "TSSSD.k.ce", "TSSSD.uk.ce", "TSSSD.k.rank.ce",
    "TSSSD.uk.rank.ce", "naive", "ph3only"),
  accrualRatePhase2 = NA_real_,
  accrualRatePhase3 = NA_real_,
  followupTimePhase2 = 0,
  maxNumberOfIterations = 1000,
  seed = 0,
  nthreads = 0
)

Arguments

phase2SampleSizePerArm

The number of subjects per arm enrolled in phase II (stage 1).

phase3SampleSizePerArmMin

The smallest number of subjects per arm enrolled in phase III (stage 2). Operating characteristics are reported for every stage 2 sample size from this value to phase3SampleSizePerArmMax.

phase3SampleSizePerArmMax

The largest number of subjects per arm enrolled in phase III (stage 2).

responseProbControl

The probability of a short-term response in the control arm.

responseProbTreatments

A vector of length M giving the probability of a short-term response for each of the M doses under investigation. Its length determines M.

toxicityProbTreatments

A vector of length M giving the probability of toxicity for each dose under investigation.

corrEfficacyToxicity

The correlation between the bivariate latent normal variables used to generate the binary efficacy and toxicity endpoints. This is the correlation on the latent scale, not the correlation of the observed binary endpoints. Use 0 for independent endpoints.

hazardRateControl

A vector of length 2 giving the hazard rate of the long-term endpoint in the control arm for short-term nonresponders and responders, respectively.

hazardRateTreatments

An M by 2 matrix giving the hazard rate of the long-term endpoint for each dose, with the first column for short-term nonresponders and the second column for responders.

studyDurationPhase3

The duration of phase III, measured from the first phase III enrollment to the final analysis.

toxicityWeight

The weight placed on the posterior mean toxicity rate in the benefit-risk tradeoff used for dose selection. Use 0 to select on efficacy alone.

toxicityUpperLimit

The prespecified upper limit for the toxicity rate used in the safety criterion. Use 1 when the safety criterion is not applied.

efficacyThreshold

The threshold for the posterior probability that a dose is superior to the control in short-term response. Use 0 when the efficacy criterion is not applied.

safetyThreshold

The threshold for the posterior probability that the toxicity rate of a dose is below toxicityUpperLimit. Use 0 when the safety criterion is not applied.

useUniformPrior

Whether to use the uniform Beta(1,1) prior (the default) or the Jeffreys Beta(0.5,0.5) prior for the beta-binomial posterior used in dose selection.

methods

A character vector naming the testing procedures to evaluate for the confirmatory analysis. Any subset of "ctdunnett", "ctsimes", "ctpooled", "cer", "TSSSD.k", "TSSSD.uk", "TSSSD.k.rank", "TSSSD.uk.rank", "TSSSD.k.ce", "TSSSD.uk.ce", "TSSSD.k.rank.ce", "TSSSD.uk.rank.ce", "naive", and "ph3only". Restricting the set skips the corresponding computation entirely, which matters because the methods differ by orders of magnitude in cost.

accrualRatePhase2

The accrual rate per arm during phase II. Arrival times follow a homogeneous Poisson process.

accrualRatePhase3

The accrual rate per arm during phase III.

followupTimePhase2

The follow-up time after the last phase II enrollment across all arms. Phase III enrollment opens at that point. Use 0 when dose selection occurs immediately after the last phase II enrollment.

maxNumberOfIterations

The number of simulated trials.

seed

The seed for the random number generator.

nthreads

The number of threads to use. The default, 0, leaves the RcppParallel setting unchanged.

Details

For each subject on a treatment arm, a bivariate latent normal vector (z_T, z_E) with mean zero, unit variances, and correlation corrEfficacyToxicity is drawn. The binary toxicity and efficacy endpoints are obtained as Y_T = I\{z_T \le \Phi^{-1}(p_T(d))\} and Y_E = I\{z_E \le \Phi^{-1}(p_E(d))\}, so that the marginal probabilities are p_T(d) and p_E(d) while the two endpoints are correlated. The long-term endpoint is exponential with a rate determined by the realized short-term response status.

Dose selection uses a beta-binomial model with independent priors, either uniform Beta(1,1) or Jeffreys Beta(0.5,0.5) depending on useUniformPrior. A dose enters the acceptable set when the posterior probability that its response rate exceeds that of the control is above efficacyThreshold and the posterior probability that its toxicity rate is below toxicityUpperLimit is above safetyThreshold. Among the acceptable doses, the one maximizing the posterior mean benefit-risk tradeoff is selected. When both thresholds are 0, all doses are acceptable.

Phase III enrollment opens followupTimePhase2 after the last phase II enrollment across all arms, and the final analysis occurs studyDurationPhase3 later. Subjects whose long-term endpoint has not occurred by then are censored at the analysis time.

Value

A list of operating characteristics. Let ngrid denote phase3SampleSizePerArmMax - phase3SampleSizePerArmMin + 1, the number of stage 2 sample sizes examined, and let M denote the number of doses. The list contains

  • n1, n2, numberOfIterations, trueOBD: The design inputs echoed back, with n2 the vector of stage 2 sample sizes examined.

  • selectionProb: A vector of length M giving the probability that each dose is selected at the end of phase II.

  • pcs: The percentage of simulated trials selecting the dose with the largest true benefit-risk tradeoff responseProbTreatments - toxicityWeight * toxicityProbTreatments.

  • ave.event: An ngrid by 3 matrix of the average number of events in the selected dose and the control arm combined, in stage 1, stage 2, and overall.

  • methods: The testing procedures evaluated, in canonical order.

  • byMethod: A named list with one element per evaluated method, each containing

    • gpower: A vector of length ngrid giving the generalized power, the probability of both selecting the true best dose and rejecting its null hypothesis.

    • prob.rej.each: An ngrid by M matrix of the probability of rejecting the null hypothesis for each dose conditional on that dose being selected.

    • prob.rej.any: A vector of length ngrid giving the probability of rejecting any null hypothesis.

    The method names are ctdunnett, ctsimes, and ctpooled for the closed testing procedure with the inverse normal combination of stage 1 and stage 2 p-values, using the Dunnett, Simes, and pooled log-rank local tests respectively; cer for the conditional error rate method; TSSSD.k and TSSSD.uk for the original two-stage seamless design boundaries with known and unknown correlation; TSSSD.k.rank and TSSSD.uk.rank for rank-adjusted versions of those boundaries; TSSSD.k.ce, TSSSD.uk.ce, TSSSD.k.rank.ce, and TSSSD.uk.rank.ce for conditional-error updates that start from nominal boundaries based on n1/(n1+n2) and then update boundaries using the observed stage 1 z-statistic and observed information fraction; naive for the unadjusted log-rank test on the combined stage 1 and stage 2 data; and ph3only for the unadjusted log-rank test on the stage 2 data only. Because dose selection uses stage 1 data only, ph3only is based on data independent of the selection and still controls the familywise error rate, at the cost of discarding the stage 1 information. naive reuses the selection data and is anticonservative; it is reported for reference.

Author(s)

Kaifeng Lu, kaifenglu@gmail.com

References

Liyun Jiang and Ying Yuan. Seamless phase II/III design: a useful strategy to reduce the sample size for dose optimization. Journal of the National Cancer Institute. 2023, 115(9):1092-1098.

Ping Gao and Yingqiu Li. Adaptive two-stage seamless sequential design for clinical trials. Journal of Biopharmaceutical Statistics. 2025, 35(4), 565-587.

Cyrus Mehta, Ajoy Mukhopadhyay, and Martin Posch. Graph Based, Adaptive, Multiarm, Multiple Endpoint, Two-Stage Designs. Statistics in Medicine. 2025.

Examples


# hazard rates in the nonresponse and response groups of the control arm
the0 <- c(log(2)/12, log(2)/24)

# response rates of the two doses under investigation
pe <- c(0.6, 0.5)

# hazard ratio versus control within each response group
hr <- rbind(c(0.75, 0.75), c(0.75, 0.75))
the1 <- t(sapply(1:2, function(k) hr[k,]*the0))

sim <- lrsim_bmTrtSel(
  phase2SampleSizePerArm = 50,
  phase3SampleSizePerArmMin = 113,
  phase3SampleSizePerArmMax = 118,
  responseProbControl = 0.4,
  responseProbTreatments = pe,
  toxicityProbTreatments = c(0, 0),
  corrEfficacyToxicity = 0,
  hazardRateControl = the0,
  hazardRateTreatments = the1,
  studyDurationPhase3 = 42.1,
  toxicityWeight = 0,
  toxicityUpperLimit = 1,
  efficacyThreshold = 0,
  safetyThreshold = 0,
  methods = c("ctdunnett", "ctsimes", "ctpooled",
              "cer", "naive", "ph3only"),
  accrualRatePhase2 = 3,
  accrualRatePhase3 = 6,
  followupTimePhase2 = 6,
  maxNumberOfIterations = 100,
  seed = 314159,
  nthreads = 1)

sim$pcs
sim$byMethod$ctdunnett$gpower


lrstat documentation built on Aug. 25, 2026, 5:07 p.m.