Skip to contents

In this vignette we give an introduction how to use savvyr to estimate adverse event probabilities using the SAVVY framework.

Example using dummy data

We generate the dataset \(S1\) in Stegherr, Beyersmann, et al. (2021) using the parameter values for Arm A. First we define the sample size and a range of censoring times. Then we set the hazard of the three event types (adverse event, death/hard competing event and soft competing event). After the dataset has been generated, we set \(\tau\) as the maximum event time.

n <- 200

min_cens <- 0
max_cens <- 1000

set.seed(2020)
dat1 <- generate_data(
  n,
  cens = c(min_cens, max_cens),
  haz_ae = 0.00265,
  haz_death = 0.00151,
  haz_soft = 0.00227
)

tau <- max(dat1[, "time_to_event"])

The structure of the dataset looks as follows:

kable(head(dat1, 10), align = c("crcr"))
id time_to_event type_of_event cens
1 45.692951 1 424.518663
2 197.519473 1 266.013197
3 36.859040 2 650.432466
4 115.062905 2 164.620580
5 220.764432 1 994.178471
6 8.499869 0 8.499869
7 833.042670 0 833.042670
8 37.389099 1 987.244922
9 82.243862 2 556.460553
10 75.843159 1 813.761866

For this dataset we then compute all the estimators used in the comparisons in Stegherr, Schmoor, Beyersmann, et al. (2021) and Stegherr, Schmoor, Lübbert, et al. (2021). We start with the estimators that do not account for competing events (incidence proportion, incidence density, Inverse Kaplan Meier), then incidence proportion accounting for competing events and Aalen-Johansen (both first with death only as hard competing event, then using all competing events):

ip <- inc_prop(dat1, tau)
id <- prop_trans_inc_dens(dat1, tau)
km <- one_minus_kaplan_meier(dat1, tau)

idce_2 <- prop_trans_inc_dens_ce(dat1, ce = 2, tau)
aj_2 <- aalen_johansen(dat1, ce = 2, tau)

idce_3 <- prop_trans_inc_dens_ce(dat1, ce = 3, tau)
aj_3 <- aalen_johansen(dat1, ce = 3, tau)

The AE risks look as follows:

tab <- rbind(ip, id, km, idce_2, aj_2[1:2], idce_3, aj_3[1:2])
colnames(tab) <- c(
  "estimated AE probability",
  "variance of estimation"
)
rownames(tab) <- c(
  "incidence proportion",
  "probability transform incidence density ignoring competing event",
  "1 - Kaplan-Meier", "probability transform incidence density (death only)",
  "Aalen-Johansen (death only), AE risk", "probability transform incidence density (all CEs)",
  "Aalen-Johansen (all CEs), AE risk"
)

kable(tab, digits = c(3, 5))
estimated AE probability variance of estimation
incidence proportion 0.370 0.00117
probability transform incidence density ignoring competing event 0.872 0.00094
1 - Kaplan-Meier 0.806 0.00380
probability transform incidence density (death only) 0.636 0.00190
Aalen-Johansen (death only), AE risk 0.623 0.00261
probability transform incidence density (all CEs) 0.436 0.00144
Aalen-Johansen (all CEs), AE risk 0.436 0.00147

Finally, the estimated probabilities of competing events based on the Aalen-Johansen estimators:

tab <- rbind(aj_2[3:4], aj_3[3:4])
colnames(tab) <- c(
  "estimated probability",
  "variance of estimation"
)
rownames(tab) <- c(
  "Aalen-Johansen (death only), CE risk",
  "Aalen-Johansen (all CEs), CE risk"
)

kable(tab, digits = c(3, 5))
estimated probability variance of estimation
Aalen-Johansen (death only), CE risk 0.252 0.00148
Aalen-Johansen (all CEs), CE risk 0.542 0.00150

References

Stegherr, Regina, Jan Beyersmann, Valentine Jehl, Kaspar Rufibach, Friedhelm Leverkus, Claudia Schmoor, and Tim Friede. 2021. “Survival Analysis for AdVerse Events with VarYing Follow-up Times (SAVVY): Rationale and Statistical Concept of a Meta-Analytic Study.” Biometrical Journal 63 (3): 650–70. https://doi.org/https://doi.org/10.1002/bimj.201900347.
Stegherr, Regina, Claudia Schmoor, Jan Beyersmann, Kaspar Rufibach, Valentine Jehl, Andreas Brückner, Lewin Eisele, et al. 2021. “Survival Analysis for AdVerse Events with VarYing Follow-up Times (SAVVY)—Estimation of Adverse Event Risks.” Trials 22 (1): 420. https://doi.org/10.1186/s13063-021-05354-x.
Stegherr, Regina, Claudia Schmoor, Michael Lübbert, Tim Friede, and Jan Beyersmann. 2021. “Estimating and Comparing Adverse Event Probabilities in the Presence of Varying Follow-up Times and Competing Events.” Pharmaceutical Statistics 20 (6): 1125–46. https://doi.org/https://doi.org/10.1002/pst.2130.