Skip to contents

Simulates assurance and operating characteristics for a group sequential trial under prior uncertainty about a delayed treatment effect. The function integrates beliefs about control survival, treatment delay, post-delay hazard ratio, recruitment, and group sequential design (GSD) parameters.

Usage

calc_dte_assurance_interim(
  n_c,
  n_t,
  control_model,
  effect_model,
  recruitment_model,
  GSD_model,
  n_sims = 1000
)

Arguments

n_c

Control group sample size

n_t

Treatment group sample size

control_model

A named list specifying the control arm survival distribution:

  • dist: Distribution type ("Exponential" or "Weibull")

  • parameter_mode: Either "Fixed" or "Distribution"

  • fixed_type: If "Fixed", specify as "Parameters" or "Landmark"

  • lambda, gamma: Scale and shape parameters

  • t1, t2: Landmark times

  • surv_t1, surv_t2: Survival probabilities at landmarks

  • t1_Beta_a, t1_Beta_b, diff_Beta_a, diff_Beta_b: Beta prior parameters

effect_model

A named list specifying beliefs about the treatment effect:

  • delay_SHELF, HR_SHELF: SHELF objects encoding beliefs

  • delay_dist, HR_dist: Distribution types ("hist" by default)

  • P_S: Probability that survival curves separate

  • P_DTE: Probability of delayed separation, conditional on separation

recruitment_model

A named list specifying the recruitment process:

  • method: "power" or "PWC"

  • period, power: Parameters for power model

  • rate, duration: Comma-separated strings for PWC model

GSD_model

A named list specifying the group sequential design:

  • events: Total number of events

  • alpha_spending: Cumulative alpha spending vector

  • alpha_IF: Information Fraction at which we look for efficacy

  • futility_type: beta (for beta-spending), BPP (for Bayesian Predictive Probability) or none

  • futility_IF: Information Fraction at which we look for futility

  • beta_spending: Cumulative beta spending vector

  • BPP_threshold: BPP value at which we will stop for futility

n_sims

Number of simulations to run (default = 1000)

Value

A data frame with one row per simulated trial and the following columns:

Trial

Simulation index

IF

Information fraction label used at the decision point

Decision

Interim decision outcome (e.g., "Continue", "Stop for efficacy", "Stop for futility")

StopTime

Time at which the trial stopped or completed

SampleSize

Total sample size at the time of decision

Final_Decision

Final classification of trial success based on the test statistic and threshold

Class: data.frame

Examples

# Minimal example with placeholder inputs
control_model <- list(dist = "Exponential", parameter_mode = "Fixed",
fixed_type = "Parameters", lambda = 0.1)
effect_model <- list(P_S = 1, P_DTE = 0,
HR_SHELF = SHELF::fitdist(c(0.6, 0.65, 0.7), probs = c(0.25, 0.5, 0.75), lower = 0, upper = 2),
HR_dist = "gamma",
delay_SHELF = SHELF::fitdist(c(3, 4, 5), probs = c(0.25, 0.5, 0.75), lower = 0, upper = 10),
delay_dist = "gamma"
)
recruitment_model <- list(method = "power", period = 12, power = 1)
GSD_model <- list(events = 300, alpha_spending = c("0.01, 0.025"),
                  beta_spending = c("0.05, 0.1"), IF_vec = c("0.5, 1"))
result <- calc_dte_assurance_interim(n_c = 300, n_t = 300,
                        control_model = control_model,
                        effect_model = effect_model,
                        recruitment_model = recruitment_model,
                        GSD_model = GSD_model,
                        n_sims = 10)
#> Warning: Caught simpleError. Canceling all iterations ...
#> Error in if (GSD_model$futility_type %in% c("beta", "none")) {    rpact_design <- make_rpact_design_from_GSD_model(GSD_model)    design <- rpact_design$design    outcome <- apply_GSD_to_trial(trial_data = trial, GSD_model = GSD_model,         design = design, total_events = GSD_model$events)    return(data.frame(Trial = i, Decision = outcome$decision,         StopTime = outcome$stop_time, SampleSize = outcome$sample_size,         Final_Decision = ifelse(z_stat > stats::qnorm(1 - 0.025),             "Successful", "Unsuccessful")))}: argument is of length zero
str(result)
#> function (future, ...)