r_frailty: Random Data Generation under Eight Censoring Schemes

View source: R/rng.R

r_frailtyR Documentation

Random Data Generation under Eight Censoring Schemes

Description

Generates survival times and censoring indicators for shared frailty regression models across all 10 baseline-frailty combinations under eight distinct censoring mechanisms.

Usage

r_frailty(
  n,
  baseline = c("weibull", "gw"),
  bpar,
  frailty = c("none", "gamma", "ig", "gl1", "gl2"),
  fpar = numeric(0),
  x = matrix(nrow = n, ncol = 0),
  beta = numeric(0),
  cen_type = c("none", "right", "left", "interval", "type1", "type2", "progressive",
    "progressive_type1"),
  cen_rate = 0.2,
  left_threshold = NULL,
  int_width = NULL,
  cen_time = NULL,
  r_failures = NULL,
  prog_scheme = NULL,
  prog_times = NULL
)

Arguments

n

Number of observations to generate.

baseline

Baseline hazard distribution ("weibull" or "gw").

bpar

Baseline parameter vector.

frailty

Frailty distribution ("none", "gamma", "ig", "gl1", or "gl2").

fpar

Frailty parameter vector.

x

Matrix of covariates (n x p). Default is 0-column matrix.

beta

Regression coefficient vector matching columns of x.

cen_type

Censoring mechanism: "none", "right", "left", "interval", "type1", "type2", "progressive", or "progressive_type1".

cen_rate

Exponential rate for right-censoring time generation. Default is 0.2.

left_threshold

Threshold for left censoring. Default is 20th percentile.

int_width

Width of censoring window for interval censoring. Default is 20% of mean time.

cen_time

Fixed cutoff time for Type-I censoring. Default is 70th percentile.

r_failures

Target number of failures for Type-II censoring. Default is floor(0.7 * n).

prog_scheme

Vector of progressive removal counts for progressive censoring.

prog_times

Inspection time points for progressive Type-I censoring.

Value

A data frame containing generated time, time2 (for interval), status, and covariates.

References

Hougaard, P. (1984). Life table methods for heterogeneous populations: distributions of frailties. Biometrika, 71(1), 75-83.

Pandey, A., Hanagal, D. D., & Tyagi, S. (2022). Shared Frailty Models Based on Cancer Data. International Journal of Statistics and Reliability Engineering, 9(3), 461-474.

Pandey, A., & Tyagi, S. (2021). Comparison of Multiplicative Frailty Models Under Weibull Baseline Distribution. Lobachevskii Journal of Mathematics, 42(13), 3184-3195.

Examples

set.seed(123)
dat <- r_frailty(n = 100, baseline = "weibull", bpar = c(2, 1.5),
                 frailty = "gl1", fpar = c(1.2, 0.5),
                 cen_type = "right", cen_rate = 0.1)
head(dat)

MultiFrailty documentation built on Aug. 8, 2026, 1:07 a.m.