Skip to contents

This function calculates the Aalen Johansen estimator of adverse events observed in [0, tau]. Please also refer to Stegherr et al. (2021) .

Usage

aalen_johansen(data, ce, tau)

Arguments

data

(data.frame)
with columns including

  • 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.

ce

(number)
code for competing event.

tau

(number)
milestone at which Aalen-Johansen is computed.

Value

(vector)
with the following entries:

  • ae_prob: Estimated probability of AE.

  • ae_prob_var: Variance of that estimate.

  • ce_prob: Estimated probability of competing events.

  • ce_prob_var: Variance of competing events.

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)
dat <- generate_data(n = 5, cens = c(2, 5), haz_ae = 2, haz_death = 3, haz_soft = 5)
aalen_johansen(dat, ce = 2, tau = 4)
#>     ae_prob ae_prob_var     ce_prob ce_prob_var 
#>  0.46666667  0.06162963  0.26666667  0.05096296