simulate_hybrid_cox: Simulate a hybrid-control Cox proportional hazards dataset

View source: R/simulate_data.R

simulate_hybrid_coxR Documentation

Simulate a hybrid-control Cox proportional hazards dataset

Description

Generates a randomized trial augmented with an external control arm, under a Cox proportional hazards model

h(t \mid T,Z,X) = h_0(t)\,\exp(\theta T + \delta Z + \beta^\top X),

where T is the treatment indicator, Z is the external-control indicator, X is a vector of baseline covariates, \theta is the treatment effect, and \delta is the population drift between concurrent and external controls.

Usage

simulate_hybrid_cox(
  nI1 = 150,
  nI0 = 150,
  nE = 300,
  theta0 = 0,
  delta0 = 0,
  p = 5,
  beta = NULL,
  rho = 0,
  cov_shift = rep(0, p),
  shape = 1.2,
  lambda = 0.02,
  target_cens = 0.2
)

Arguments

nI1

Number of internal randomized treated subjects.

nI0

Number of internal randomized concurrent control subjects.

nE

Number of external control subjects.

theta0

True treatment effect (log hazard ratio).

delta0

True population drift (log hazard ratio for external vs. internal controls).

p

Number of covariates; use 0 for the no-covariate setting.

beta

Numeric vector of covariate coefficients (length p). Defaults to rep(0.2, p).

rho

Equicorrelation of covariates.

cov_shift

Covariate mean shift in the external control arm (numeric vector of length p).

shape

Weibull shape parameter for event-time generation.

lambda

Baseline scale parameter for event-time generation.

target_cens

Target right-censoring proportion.

Value

A list with components:

data

A data frame with time, status, T, Z, and covariates X1, ..., Xp.

truth

The true parameters used to generate the data.

settings

The simulation settings, including the calibrated censoring rate.

Examples

set.seed(1)
sim <- simulate_hybrid_cox(nI1 = 100, nI0 = 100, nE = 200,
                           theta0 = log(0.8), delta0 = 0)
head(sim$data)


fdb documentation built on Oct. 4, 2026, 5:07 p.m.