Package 'savvyr'

Title: Survival Analysis for AdVerse Events with VarYing Follow-Up Times
Description: The SAVVY (Survival Analysis for AdVerse Events with VarYing Follow-Up Times) project is a consortium of academic and pharmaceutical industry partners that aims to improve the analyses of adverse event (AE) data in clinical trials through the use of survival techniques appropriately dealing with varying follow-up times and competing events, see Stegherr, Schmoor, Beyersmann, et al. (2021) <doi:10.1186/s13063-021-05354-x>. Although statistical methodologies have advanced, in AE analyses often the incidence proportion, the incidence density or a non-parametric Kaplan-Meier estimator are used, which either ignore censoring or competing events. This package contains functions to easily conduct the proposed improved AE analyses.
Authors: Thomas Kuenzel [aut, cre], Kaspar Rufibach [aut], Regina Stegherr [aut], Daniel Sabanés Bové [aut], F. Hoffmann-La Roche AG [cph, fnd], Universität Ulm [cph, fnd]
Maintainer: Thomas Kuenzel <[email protected]>
License: Apache License 2.0
Version: 0.1.1
Built: 2024-11-03 04:55:27 UTC
Source: https://github.com/openpharma/savvyr

Help Index


Aalen Johansen Estimator

Description

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)

Generate Example Data

Description

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)

Computing the Incidence Proportion

Description

Computing the Incidence Proportion

Usage

inc_prop(data, 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.

tau

(numeric)
milestone at which incidence proportion is computed.

Value

(vector)
with the following entries:

  • ae_prob: Estimated probability of AE.

  • ae_prob_var: Variance of that estimate.

Examples

set.seed(123)
dat <- generate_data(
  n = 5,
  cens = c(2, 5),
  haz_ae = 2,
  haz_death = 3,
  haz_soft = 5
)

inc_prop(dat, tau = 4)

One Minus Kaplan-Meier

Description

This function calculates the one minus Kaplan-Meier estimator of adverse events (while censoring all competing events) observed in ⁠[0, tau]⁠. Please also refer to formula (4) in Stegherr et al. (2021).

Usage

one_minus_kaplan_meier(data, 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.

tau

(number)
milestone at which One Minus Kaplan-Meier is computed.

Value

(vector)
with the following entries:

  • ae_prob: Estimated probability of AE.

  • ae_prob_var: Variance of that estimate.

References

Stegherr R, Beyersmann J, Jehl V, Rufibach K, Leverkus F, Schmoor C, Friede T (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-670. doi:10.1002/bimj.201900347, https://onlinelibrary.wiley.com/doi/pdf/10.1002/bimj.201900347, https://onlinelibrary.wiley.com/doi/abs/10.1002/bimj.201900347.

Examples

set.seed(123)
dat <- generate_data(n = 5, cens = c(2, 5), haz_ae = 2, haz_death = 3, haz_soft = 5)
one_minus_kaplan_meier(dat, tau = 4)

Computing the Probability Transform Incidence Density

Description

Computing the Probability Transform Incidence Density

Usage

prop_trans_inc_dens(data, 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.

tau

(number)
milestone at which Probability Transform Incidence Density is computed.

Value

(vector)
with the following entries:

  • ae_prob: Estimated probability of AE.

  • ae_prob_var: Variance of that estimate.

Examples

set.seed(123)
dat <- generate_data(n = 5, cens = c(2, 5), haz_ae = 2, haz_death = 3, haz_soft = 5)
prop_trans_inc_dens(dat, tau = 4)

Probability Transform Incidence Density Accounting for Competing Events

Description

This function calculates the incidence density of both adverse events and specified competing events observed in ⁠[0, tau]⁠ and then combines and transforms the incidence densities on a probability scale. Please also refer to formulas (4) and (5) in Stegherr et al. (2021).

Usage

prop_trans_inc_dens_ce(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 Probability Transform Incidence Density is computed.

Value

(vector)
with the following entries:

  • ae_prob: Estimated probability of AE.

  • ae_prob_var: Variance of that estimate.

References

Stegherr R, Schmoor C, Beyersmann J, Rufibach K, Jehl V, Brückner A, Eisele L, Künzel T, Kupas K, Langer F, Leverkus F, Loos A, Norenberg C, Voss F, Friede T (2021). “Survival analysis for AdVerse events with VarYing follow-up times (SAVVY)—estimation of adverse event risks.” Trials, 22(1), 420. ISSN 1745-6215, doi:10.1186/s13063-021-05354-x.

Examples

set.seed(123)
dat <- generate_data(n = 5, cens = c(2, 5), haz_ae = 2, haz_death = 3, haz_soft = 5)
prop_trans_inc_dens_ce(dat, ce = 2, tau = 4)