Skip to contents

Simulate Competing Risks Data

Usage

simulate_bd_competing_data(
  n,
  pars = list(c(a = 1, b = 2.5, c = 1.8, k = 0.04), c(a = 1, b = 3.5, c = 1.2, k = 0.02)),
  gammas = NULL,
  censor_rate = 0.15,
  seed = NULL
)

Arguments

n

Sample size.

pars

List of parameter vectors, one per cause, each a named vector with `b`, `c`, `k` and optionally `a`. Defaults to two causes.

gammas

Numeric vector of accelerated failure time coefficients, one per cause, acting on a single binary covariate. `NULL` for no covariate.

censor_rate

Approximate proportion of right-censored observations.

seed

Optional integer seed.

Value

A data frame with `time`, `cause` (0 for censored) and, when `gammas` is supplied, the covariate `x`.

See also

[fit_bd_competing()]

Examples

d <- simulate_bd_competing_data(200, seed = 1)
table(d$cause)
#> 
#>   0   1   2 
#>  55  45 100