knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Setup

# install.packages("gtreg")
library(gtreg)

Overview

Reporting of adverse events to regulatory agencies typically employs both standardized terminology and specific counting methods for adverse events.

Standardized Terminology

Providing standardized terminology is not in the scope of this package. Standardized terminology adheres to a hierarchy of terms from specific to general, as discussed in the MedDRA Hierarchy documentation. In {gtreg}, we facilitate reporting of a single term (i.e., ae, or adverse event), or a lower level term within a higher level term (i.e., ae within soc, system organ class).

Example Data

Data is typically recorded in a long format with multiple rows per subject. Events can be reported over time, where both multiple time points per subject and multiple events per time point are possible. It is possible that grade of the event is missing.

dat <- tibble::tribble(
    ~subject, ~visit,  ~soc, ~ae, ~grade,
    # Subject 1 ----------------------------------------------------------------
    "001", 1, "Eye disorders", "Eye irritation", 1,
    "001", 1, "Gastrointestinal disorders", "Difficult digestion", NA,
    "001", 2, "Eye disorders", "Eye irritation", 1,
    "001", 3, "Eye disorders", "Eye irritation", 2,
    "001", 4, "Eye disorders", "Vision blurred", 2,
    # Subject 2 ----------------------------------------------------------------
    "002", 1, "Gastrointestinal disorders", "Difficult digestion", 2,
    "002", 1, "Gastrointestinal disorders", "Reflux", 2,
    "002", 2, "Eye disorders", "Vision blurred", 2,
    "002", 2, "Gastrointestinal disorders", "Reflux", 2,
    "002", 3, "Gastrointestinal disorders", "Reflux", NA
  )
dat

Challenges Addressed

Study participants without adverse events are absent from the adverse event raw data table. Furthermore, study participants may have multiple adverse events, often with different severity grades.

These two features pose difficulties to computing the percentage of participants who experience a specific adverse event.

  1. In the numerator, we need to make sure that we do not double count the same AE within each participant, and in the denominator we need to make sure we include all patients in the treatment arm (not just those who experience an AE). These challenges are amplified when AE terms need to roll up into system organ class summaries. Functions in {gtreg} address these problems (among others) by implementing industry recommended approaches. For further reading, the PHUSE white paper regarding Analysis and Displays Associated with Adverse events provides an excellent summary of such standards.

Counting All Events

To count all instances of any event, utilize tbl_ae_count.

dat %>% 
  tbl_ae_count(
    ae = ae,
    soc = soc,
    by = grade
  ) %>% 
  modify_header(all_ae_cols() ~ "**Grade {by}**") %>% 
  add_overall() %>% 
  bold_labels()

In this case, we have two subjects which experienced a total of 5 eye disorders and 4 gastrointestinal disorders over the course of multiple time points. The only statistic allowed in tbl_ae_count() is n.

Counting By Highest Grade

Rather than counting all events, it is typical in regulatory reporting to count one event per subject by the highest grade experienced. To count the highest grade per subject, utilize tbl_ae().

The input by variable can be numeric (e.g., grade 1, 2, 3) or factor (e.g. attribution unlikely, possible, definite). In the respective cases, the highest value observed would be according to numeric order or factor level order, with missing values considered as the lowest level.

When counting by highest grade, the count reported in any cell cannot exceed the number of subjects. These methods apply to both the individual adverse events and the system organ class.

Counts Only

dat %>% 
  tbl_ae(
    id = subject,
    ae = ae,
    soc = soc,
    by = grade,
    statistic = "{n}"
  ) %>% 
  modify_header(all_ae_cols() ~ "**Grade {by}**") %>% 
  add_overall() %>% 
  bold_labels()

Adverse Events

System Organ Class

Eye disorders

Gastrointestinal disorders

Counts With Percents

The default statistic reported for tbl_ae() is n (%). The percent represents the percent of all subjects present in the data.

dat %>% 
  tbl_ae(
    id = subject,
    ae = ae,
    soc = soc,
    by = grade
  ) %>% 
  modify_header(all_ae_cols() ~ "**Grade {by}**") %>%
  modify_spanning_header(all_ae_cols() ~ "**N = {N}**") %>% 
  add_overall() %>% 
  bold_labels()

In adverse event reporting, it is common that not all subjects experience an adverse event, and hence are not included in the event reporting data set. For example, suppose there were 3 subjects of interest in this study, but subject 003 did not experience an adverse event. In order to get the correct subject denominator in this case, supply tbl_ae() with id_df, a data frame containing all subject ids.

dat %>% 
  tbl_ae(
    id = subject,
    id_df = tibble::tibble(subject = c("001", "002", "003")),
    ae = ae,
    soc = soc,
    by = grade
  ) %>% 
  modify_header(all_ae_cols() ~ "**Grade {by}**") %>% 
  modify_spanning_header(all_ae_cols() ~ "**N = {N}**") %>% 
  add_overall() %>% 
  bold_labels()


shannonpileggi/gtreg documentation built on Feb. 23, 2025, 3:04 p.m.