Skip to contents

This generates the dataset denoted by S1 in Table 4 of Stegherr et al. (2021) , i.e. we assume constant hazards for the adverse event (AE) hazard, the hazard for the competing event of death, and the hazard for the "soft" competing events. Censoring is uniform in the given range.

Usage

generate_data(n, cens, haz_ae, haz_death, haz_soft)

Arguments

n

(count)
number of patients.

cens

(numeric)
minimum and maximum censoring time.

haz_ae

(number)
constant hazard for AE.

haz_death

(number)
constant hazard for death.

haz_soft

(number)
constant hazard for soft competing event.

Value

(data.frame)
a data.frame with the following columns:

  • id: Patient ID.

  • time_to_event: Time to the first AE, death or soft competing event.

  • type_of_event: 0 for censored, 1 for AE, 2 for death, 3 for soft competing event.

  • cens: Censoring time.

References

Stegherr R, Schmoor C, Lübbert M, Friede T, Beyersmann J (2021). “Estimating and comparing adverse event probabilities in the presence of varying follow-up times and competing events.” Pharmaceutical Statistics, 20(6), 1125--1146. doi:10.1002/pst.2130 , https://onlinelibrary.wiley.com/doi/abs/10.1002/pst.2130.

Examples

set.seed(123)
generate_data(n = 5, cens = c(2, 5), haz_ae = 2, haz_death = 3, haz_soft = 5)
#>   id time_to_event type_of_event     cens
#> 1  1   0.084345726             1 4.032712
#> 2  2   0.057661027             2 3.717900
#> 3  3   0.132905487             3 2.308774
#> 4  4   0.003157736             1 4.699475
#> 5  5   0.005621098             3 2.738263