SimData_per_group: Simulate Individual-Level Trial Data for One Arm

View source: R/SimData_per_group.R

SimData_per_groupR Documentation

Simulate Individual-Level Trial Data for One Arm

Description

Generates individual-level simulated data for a treatment or control arm in a hierarchical win ratio trial. The simulation includes frailty-adjusted time to death, recurrent event counts, censoring times, and a continuous quality-of-life change score.

Usage

SimData_per_group(
  treatment,
  ngroup,
  alpha.JFM,
  theta.JFM,
  lambda,
  ann.icr,
  censorrate,
  xbase,
  xfinal,
  sd.delta.x
)

Arguments

treatment

Integer. Treatment group indicator, usually 1 for the active treatment arm and 0 for the control arm.

ngroup

Integer. Number of subjects to simulate in this arm.

alpha.JFM

Numeric. Alpha parameter for the joint frailty model.

theta.JFM

Numeric. Frailty variance parameter for the joint frailty model. Must be positive.

lambda

Numeric. Annual mortality probability. Must be in [0, 1).

ann.icr

Numeric. Annual incidence rate of recurrent events.

censorrate

Numeric. Annual censoring probability. Must be in [0, 1).

xbase

Numeric. Baseline value of the continuous outcome.

xfinal

Numeric. Expected final value of the continuous outcome among subjects followed through 360 days.

sd.delta.x

Numeric. Standard deviation of the change in the continuous outcome.

Value

A named list. If treatment = 1, the list contains surv_1; otherwise, it contains surv_0. The data frame has one row per subject and includes subject ID, treatment indicator, death time, censoring time, death indicator, recurrent event count, and continuous outcome value.

Examples

set.seed(1)
sim <- SimData_per_group(
  treatment = 1, ngroup = 5,
  alpha.JFM = 0, theta.JFM = 1,
  lambda = 0.13, ann.icr = 0.32,
  censorrate = 0.2, xbase = 45, xfinal = 52.5,
  sd.delta.x = 20
)
str(sim$surv_1)

winratiosim documentation built on July 7, 2026, 1:07 a.m.