Learn R Programming

trtswitch (version 0.1.8)

recensor_sim_rpsftm: Simulation Study to Evaluate Recensoring Rules in RPSFTM

Description

Simulates datasets to evaluate the performance of various recensoring strategies under the Rank Preserving Structural Failure Time Model (RPSFTM) for handling treatment switching in survival analysis.

Usage

recensor_sim_rpsftm(
  nsim = NA_integer_,
  n = NA_integer_,
  shape = NA_real_,
  scale = NA_real_,
  gamma = NA_real_,
  tfmin = NA_real_,
  tfmax = NA_real_,
  psi = NA_real_,
  omega = NA_real_,
  pswitch = NA_real_,
  a = NA_real_,
  b = NA_real_,
  low_psi = -1,
  hi_psi = 1,
  treat_modifier = 1,
  recensor_type = 1L,
  admin_recensor_only = 1L,
  autoswitch = 1L,
  alpha = 0.05,
  ties = "efron",
  tol = 1e-06,
  boot = 1L,
  n_boot = 1000L,
  seed = NA_integer_
)

Value

A data frame summarizing the simulation results, including:

  • recensor_type, admin_recensor_only: Settings used in the simulation.

  • Event rates: p_event_1, p_dropout_1, p_admin_censor_1, p_event_0, p_dropout_0, p_admin_censor_0.

  • Progression and switching: p_pd_0, p_swtrt_0, p_recensored_0.

  • Causal parameter (\(\psi\)) estimates: psi, psi_est, psi_bias, psi_se, psi_mse.

  • Log hazard ratio estimates: loghr, loghr_est, loghr_se, loghr_mse.

  • Hazard ratio metrics: hr, hr_est (geometric mean), hr_pctbias (percent bias).

  • Standard errors of log hazard ratio: loghr_se_cox, loghr_se_lr, loghr_se_boot.

  • Coverage probabilities: hr_ci_cover_cox, hr_ci_cover_lr, hr_ci_cover_boot.

Arguments

nsim

Number of simulated datasets.

n

Number of subjects per simulation.

shape

Shape parameter of the Weibull distribution for time to death.

scale

Scale parameter of the Weibull distribution for time to death in the control group.

gamma

Rate parameter of the exponential distribution for random dropouts in the control group.

tfmin

Minimum planned follow-up time (in days).

tfmax

Maximum planned follow-up time (in days).

psi

Log time ratio of death time for control vs experimental treatment.

omega

Log time ratio of dropout time for control vs experimental treatment.

pswitch

Probability of treatment switching at disease progression.

a

Shape parameter 1 of the Beta distribution for time to disease progression as a fraction of time to death.

b

Shape parameter 2 of the Beta distribution for time to disease progression.

low_psi

Lower bound for the search interval of the causal parameter \(\psi\).

hi_psi

Upper bound for the search interval of the causal parameter \(\psi\).

treat_modifier

Sensitivity parameter modifying the constant treatment effect assumption.

recensor_type

Type of recensoring to apply:

  • 0: No recensoring

  • 1: Recensor all control-arm subjects

  • 2: Recensor only switchers in the control arm

  • 3: Recensor only control-arm switchers whose counterfactual survival exceeds the planned follow-up time

admin_recensor_only

Logical. If TRUE, recensoring is applied only to administrative censoring times. If FALSE, it is also applied to dropout times.

autoswitch

Logical. If TRUE, disables recensoring in arms without any treatment switching.

alpha

Significance level for confidence interval calculation (default is 0.05).

ties

Method for handling tied event times in the Cox model. Options are "efron" (default) or "breslow".

tol

Convergence tolerance for root-finding in estimation of \(\psi\).

boot

Logical. If TRUE, bootstrap is used to estimate the confidence interval for the hazard ratio. If FALSE, the confidence interval is matched to the log-rank p-value.

n_boot

Number of bootstrap samples, used only if boot = TRUE.

seed

Optional. Random seed for reproducibility. If not provided, the global seed is used.

Author

Kaifeng Lu, kaifenglu@gmail.com

Examples

Run this code
# \donttest{
result <- recensor_sim_rpsftm(
  nsim = 10, n = 400, shape = 1.5, scale = exp(6.3169),
  gamma = 0.001, tfmin = 407.5, tfmax = 407.5,
  psi = log(0.5) / 1.5, omega = log(1), pswitch = 0.7,
  a = 2, b = 4, low_psi = -5, hi_psi = 5,
  treat_modifier = 1, recensor_type = 1,
  admin_recensor_only = TRUE, autoswitch = TRUE,
  alpha = 0.05, tol = 1e-6, boot = TRUE,
  n_boot = 10, seed = 314159)
# }

Run the code above in your browser using DataLab