GenData: Simulate Recurrent Events Data

View source: R/Data.R

GenDataR Documentation

Simulate Recurrent Events Data

Description

Simulate recurrent events data using exponential censoring, gap, and death times. Status is coded as 0 for censoring, 1 for event, 2 for death.

  • The subject-specific death rate is calculated as frailty x base_death_rate x exp(beta_death x covariates).

  • The subject-specific event rate is calculated as frailty x base_event_rate x exp(beta_event x covariates).

Usage

GenData(
  base_death_rate = 0.25,
  base_event_rate = 1,
  beta_death = NULL,
  beta_event = NULL,
  censoring_rate = 0.25,
  covariates = NULL,
  frailty_variance = 0,
  min_death_rate = 0.05,
  min_event_rate = 0.05,
  n = 100,
  tau = 4
)

Arguments

base_death_rate

Baseline arrival rate for the terminal event.

base_event_rate

Baseline arrival rate for recurrent events.

beta_death

Numeric vector of log rate ratios for the death rate.

beta_event

Numeric vector of log rate ratios for the event rate.

censoring_rate

Arrival rate for the censoring time.

covariates

Numeric design matrix.

frailty_variance

Variance of the gamma frailty.

min_death_rate

Minimum subject-specific event rate. Must be positive.

min_event_rate

Minimum subject-specific event rate. Must be positive.

n

Number of subjects. Overwritten by 'nrow(covariates)' if covariates are provided.

tau

Truncation time.

Value

Data.frame, containing:

  • The subject identifier 'idx' (index).

  • 'time' and 'status' of the event: 0 for censoring, 1 for an event, 2 for death.

  • The 'true_death_rate', 'true_event_rate', and 'frailty', which are subject-specific.


zrmacc/MCC documentation built on July 16, 2025, 4:04 p.m.