Cardinal
  • Home
  • Template Catalog
  • About
  • Resources
  • Help
    • Getting Started
    • Report a Bug
    • FAQ

Overview of Adverse Events by Demographic Subgroup, Safety Population, Pooled Analysis (or Trial X)

FDA Table 51

table
FDA
safety
adverse events

FDA IG Shell

FDA IG example table shell

Programming Notes

Background and Instructions

Table 50: Overview of Serious Adverse Events by Demographic Subgroup and Table 51: Overview of Adverse Events by Demographic Subgroup in this section display placeholder values for the demographic characteristics for subgroup analysis of SAEs and AEs. These placeholder values will change to reflect the values found in the clinical trial data. When CDISC-controlled terminology is used in the clinical trial data, the demographic characteristics in this table will reflect the controlled terminology.

Customization

Provide any additional potentially relevant subgroups beyond the standard demographic ones that may shed light on which subjects are most susceptible to the safety event (e.g., baseline diseases [e.g., cardiovascular disease or diabetes, or by CKD stage], concomitant medication, anthropometric characteristics [e.g., BMI]). The clinical reviewer should discuss appropriate age groups for the subgroup analysis with the CDS.

Output

  • Full Code
  • Table
  • ARD
Code
# FDA TABLE 51 ---------------------------------------------------------------
# Self-contained template. Run top-to-bottom to build the objects below.
# Used by tests via run_template() and published in the catalog.

library(dplyr)
library(cards)
library(gtsummary)

adae <- pharmaverseadam::adae
adsl <- pharmaverseadam::adsl

adsl <- adsl |>
  filter(SAFFL == "Y") |>
  mutate(any_ae = "Any AE")

data <- adae |>
  filter(
    SAFFL == "Y",
    TRTEMFL == "Y"
  ) |>
  mutate(any_ae = "Any AE") |>
  # subset to one AE per subject
  dplyr::slice_tail(n = 1L, by = all_of(c("USUBJID", "ARM")))

# generate ARD for `n` statistic
ard_summary <- data |>
  ard_categorical(
    variables = c(any_ae, SEX, AGEGR1, RACE, ETHNIC),
    by = ARM,
    statistic = ~"n"
  )

# generate ARD for `N_s` statistic
ard_ns <- adsl |>
  ard_categorical(
    variables = c(any_ae, SEX, AGEGR1, RACE, ETHNIC),
    by = ARM,
    statistic = ~"n",
    stat_label = ~ list(n = "N_s")
  ) |>
  mutate(stat_name = "N_s")

# generate ARD for `p` statistic
ard_p <-
  cards::bind_ard(
    ard_summary,
    ard_ns
  ) |>
  select(-stat_label) |>
  tidyr::pivot_wider(names_from = stat_name, values_from = stat, values_fn = unlist) |>
  rowwise() |>
  mutate(
    stat_name = "p",
    stat_label = "%",
    stat = if_else(n > 0, list(n / N_s), list(0)),
    fmt_fun = list(label_round(digits = 1, scale = 100))
  ) |>
  select(-n, -N_s)

# combine all ARDs
ard <- cards::bind_ard(ard_summary, ard_ns, ard_p, ard_categorical(adsl, variables = ARM, statistic = ~"n")) |>
  cards::tidy_ard_row_order()

# generate table from ARDs
tbl <-
  tbl_ard_summary(
    ard,
    by = ARM,
    # set variable labels
    label = list(
      SEX = "Sex",
      AGEGR1 = "Age Group, years",
      RACE = "Race",
      ETHNIC = "Ethnicity"
    )
  ) |>
  gtsummary::modify_table_body(
    \(x) x |> filter(!label %in% "any_ae")
  ) |>
  gtsummary::modify_indent(columns = label, rows = variable == "any_ae", indent = 0L) |>
  # update statistic footnote
  gtsummary::modify_footnote_header(
    footnote = "n/N_s (%)",
    columns = all_stat_cols()
  ) |>
  gtsummary::modify_header(all_stat_cols() ~ "**{level}**  \n N = {n}")


ard <- gtsummary::gather_ard(tbl)
Code
tbl
Characteristic Placebo
N = 861
Xanomeline High Dose
N = 841
Xanomeline Low Dose
N = 841
Any AE 65 (75.6%) 75 (89.3%) 77 (91.7%)
Sex


    F 40 (75.5%) 36 (90.0%) 44 (88.0%)
    M 25 (75.8%) 39 (88.6%) 33 (97.1%)
Age Group, years


    18-64 10 (71.4%) 10 (90.9%) 8 (100.0%)
    >64 55 (76.4%) 65 (89.0%) 69 (90.8%)
Race


    AMERICAN INDIAN OR ALASKA NATIVE 0 (0.0%) 1 (100.0%) 0 (0.0%)
    BLACK OR AFRICAN AMERICAN 6 (75.0%) 7 (77.8%) 4 (66.7%)
    WHITE 59 (75.6%) 67 (90.5%) 73 (93.6%)
Ethnicity


    HISPANIC OR LATINO 3 (100.0%) 3 (100.0%) 6 (100.0%)
    NOT HISPANIC OR LATINO 62 (74.7%) 72 (88.9%) 71 (91.0%)
1 n/N_s (%)
Code
withr::local_options(width = 9999, tibble.print_max = Inf)
print(ard, columns = "all")
$tbl_ard_summary
# An ARD data frame: 103 × 12
    group1 group1_level         variable variable_level                   context     stat_name stat_label     stat             fmt_fun warning error  gts_column
    <chr>  <list>               <chr>    <list>                           <chr>       <chr>     <chr>          <list>           <list>  <list>  <list> <chr>     
  1 <NA>   <NULL>               any_ae   <NULL>                           attributes  label     Variable Label any_ae           <fn>    <NULL>  <NULL> <NA>      
  2 <NA>   <NULL>               any_ae   <NULL>                           attributes  class     Variable Class logical          <NULL>  <NULL>  <NULL> <NA>      
  3 ARM    Placebo              any_ae   Any AE                           categorical n         n              65               0       <NULL>  <NULL> stat_1    
  4 ARM    Placebo              SEX      F                                categorical n         n              40               0       <NULL>  <NULL> stat_1    
  5 ARM    Placebo              SEX      M                                categorical n         n              25               0       <NULL>  <NULL> stat_1    
  6 ARM    Placebo              AGEGR1   18-64                            categorical n         n              10               0       <NULL>  <NULL> stat_1    
  7 ARM    Placebo              AGEGR1   >64                              categorical n         n              55               0       <NULL>  <NULL> stat_1    
  8 ARM    Placebo              RACE     AMERICAN INDIAN OR ALASKA NATIVE categorical n         n              0                0       <NULL>  <NULL> stat_1    
  9 ARM    Placebo              RACE     BLACK OR AFRICAN AMERICAN        categorical n         n              6                0       <NULL>  <NULL> stat_1    
 10 ARM    Placebo              RACE     WHITE                            categorical n         n              59               0       <NULL>  <NULL> stat_1    
 11 ARM    Placebo              ETHNIC   HISPANIC OR LATINO               categorical n         n              3                0       <NULL>  <NULL> stat_1    
 12 ARM    Placebo              ETHNIC   NOT HISPANIC OR LATINO           categorical n         n              62               0       <NULL>  <NULL> stat_1    
 13 ARM    Placebo              any_ae   Any AE                           categorical N_s       N_s            86               0       <NULL>  <NULL> stat_1    
 14 ARM    Placebo              SEX      F                                categorical N_s       N_s            53               0       <NULL>  <NULL> stat_1    
 15 ARM    Placebo              SEX      M                                categorical N_s       N_s            33               0       <NULL>  <NULL> stat_1    
 16 ARM    Placebo              AGEGR1   18-64                            categorical N_s       N_s            14               0       <NULL>  <NULL> stat_1    
 17 ARM    Placebo              AGEGR1   >64                              categorical N_s       N_s            72               0       <NULL>  <NULL> stat_1    
 18 ARM    Placebo              RACE     AMERICAN INDIAN OR ALASKA NATIVE categorical N_s       N_s            0                0       <NULL>  <NULL> stat_1    
 19 ARM    Placebo              RACE     BLACK OR AFRICAN AMERICAN        categorical N_s       N_s            8                0       <NULL>  <NULL> stat_1    
 20 ARM    Placebo              RACE     WHITE                            categorical N_s       N_s            78               0       <NULL>  <NULL> stat_1    
 21 ARM    Placebo              ETHNIC   HISPANIC OR LATINO               categorical N_s       N_s            3                0       <NULL>  <NULL> stat_1    
 22 ARM    Placebo              ETHNIC   NOT HISPANIC OR LATINO           categorical N_s       N_s            83               0       <NULL>  <NULL> stat_1    
 23 ARM    Placebo              any_ae   Any AE                           categorical p         %              0.755814         <fn>    <NULL>  <NULL> stat_1    
 24 ARM    Placebo              SEX      F                                categorical p         %              0.754717         <fn>    <NULL>  <NULL> stat_1    
 25 ARM    Placebo              SEX      M                                categorical p         %              0.7575758        <fn>    <NULL>  <NULL> stat_1    
 26 ARM    Placebo              AGEGR1   18-64                            categorical p         %              0.7142857        <fn>    <NULL>  <NULL> stat_1    
 27 ARM    Placebo              AGEGR1   >64                              categorical p         %              0.7638889        <fn>    <NULL>  <NULL> stat_1    
 28 ARM    Placebo              RACE     AMERICAN INDIAN OR ALASKA NATIVE categorical p         %              0                <fn>    <NULL>  <NULL> stat_1    
 29 ARM    Placebo              RACE     BLACK OR AFRICAN AMERICAN        categorical p         %              0.75             <fn>    <NULL>  <NULL> stat_1    
 30 ARM    Placebo              RACE     WHITE                            categorical p         %              0.7564103        <fn>    <NULL>  <NULL> stat_1    
 31 ARM    Placebo              ETHNIC   HISPANIC OR LATINO               categorical p         %              1                <fn>    <NULL>  <NULL> stat_1    
 32 ARM    Placebo              ETHNIC   NOT HISPANIC OR LATINO           categorical p         %              0.746988         <fn>    <NULL>  <NULL> stat_1    
 33 ARM    Xanomeline High Dose any_ae   Any AE                           categorical n         n              75               0       <NULL>  <NULL> stat_2    
 34 ARM    Xanomeline High Dose SEX      F                                categorical n         n              36               0       <NULL>  <NULL> stat_2    
 35 ARM    Xanomeline High Dose SEX      M                                categorical n         n              39               0       <NULL>  <NULL> stat_2    
 36 ARM    Xanomeline High Dose AGEGR1   18-64                            categorical n         n              10               0       <NULL>  <NULL> stat_2    
 37 ARM    Xanomeline High Dose AGEGR1   >64                              categorical n         n              65               0       <NULL>  <NULL> stat_2    
 38 ARM    Xanomeline High Dose RACE     AMERICAN INDIAN OR ALASKA NATIVE categorical n         n              1                0       <NULL>  <NULL> stat_2    
 39 ARM    Xanomeline High Dose RACE     BLACK OR AFRICAN AMERICAN        categorical n         n              7                0       <NULL>  <NULL> stat_2    
 40 ARM    Xanomeline High Dose RACE     WHITE                            categorical n         n              67               0       <NULL>  <NULL> stat_2    
 41 ARM    Xanomeline High Dose ETHNIC   HISPANIC OR LATINO               categorical n         n              3                0       <NULL>  <NULL> stat_2    
 42 ARM    Xanomeline High Dose ETHNIC   NOT HISPANIC OR LATINO           categorical n         n              72               0       <NULL>  <NULL> stat_2    
 43 ARM    Xanomeline High Dose any_ae   Any AE                           categorical N_s       N_s            84               0       <NULL>  <NULL> stat_2    
 44 ARM    Xanomeline High Dose SEX      F                                categorical N_s       N_s            40               0       <NULL>  <NULL> stat_2    
 45 ARM    Xanomeline High Dose SEX      M                                categorical N_s       N_s            44               0       <NULL>  <NULL> stat_2    
 46 ARM    Xanomeline High Dose AGEGR1   18-64                            categorical N_s       N_s            11               0       <NULL>  <NULL> stat_2    
 47 ARM    Xanomeline High Dose AGEGR1   >64                              categorical N_s       N_s            73               0       <NULL>  <NULL> stat_2    
 48 ARM    Xanomeline High Dose RACE     AMERICAN INDIAN OR ALASKA NATIVE categorical N_s       N_s            1                0       <NULL>  <NULL> stat_2    
 49 ARM    Xanomeline High Dose RACE     BLACK OR AFRICAN AMERICAN        categorical N_s       N_s            9                0       <NULL>  <NULL> stat_2    
 50 ARM    Xanomeline High Dose RACE     WHITE                            categorical N_s       N_s            74               0       <NULL>  <NULL> stat_2    
 51 ARM    Xanomeline High Dose ETHNIC   HISPANIC OR LATINO               categorical N_s       N_s            3                0       <NULL>  <NULL> stat_2    
 52 ARM    Xanomeline High Dose ETHNIC   NOT HISPANIC OR LATINO           categorical N_s       N_s            81               0       <NULL>  <NULL> stat_2    
 53 ARM    Xanomeline High Dose any_ae   Any AE                           categorical p         %              0.8928571        <fn>    <NULL>  <NULL> stat_2    
 54 ARM    Xanomeline High Dose SEX      F                                categorical p         %              0.9              <fn>    <NULL>  <NULL> stat_2    
 55 ARM    Xanomeline High Dose SEX      M                                categorical p         %              0.8863636        <fn>    <NULL>  <NULL> stat_2    
 56 ARM    Xanomeline High Dose AGEGR1   18-64                            categorical p         %              0.9090909        <fn>    <NULL>  <NULL> stat_2    
 57 ARM    Xanomeline High Dose AGEGR1   >64                              categorical p         %              0.890411         <fn>    <NULL>  <NULL> stat_2    
 58 ARM    Xanomeline High Dose RACE     AMERICAN INDIAN OR ALASKA NATIVE categorical p         %              1                <fn>    <NULL>  <NULL> stat_2    
 59 ARM    Xanomeline High Dose RACE     BLACK OR AFRICAN AMERICAN        categorical p         %              0.7777778        <fn>    <NULL>  <NULL> stat_2    
 60 ARM    Xanomeline High Dose RACE     WHITE                            categorical p         %              0.9054054        <fn>    <NULL>  <NULL> stat_2    
 61 ARM    Xanomeline High Dose ETHNIC   HISPANIC OR LATINO               categorical p         %              1                <fn>    <NULL>  <NULL> stat_2    
 62 ARM    Xanomeline High Dose ETHNIC   NOT HISPANIC OR LATINO           categorical p         %              0.8888889        <fn>    <NULL>  <NULL> stat_2    
 63 ARM    Xanomeline Low Dose  any_ae   Any AE                           categorical n         n              77               0       <NULL>  <NULL> stat_3    
 64 ARM    Xanomeline Low Dose  SEX      F                                categorical n         n              44               0       <NULL>  <NULL> stat_3    
 65 ARM    Xanomeline Low Dose  SEX      M                                categorical n         n              33               0       <NULL>  <NULL> stat_3    
 66 ARM    Xanomeline Low Dose  AGEGR1   18-64                            categorical n         n              8                0       <NULL>  <NULL> stat_3    
 67 ARM    Xanomeline Low Dose  AGEGR1   >64                              categorical n         n              69               0       <NULL>  <NULL> stat_3    
 68 ARM    Xanomeline Low Dose  RACE     AMERICAN INDIAN OR ALASKA NATIVE categorical n         n              0                0       <NULL>  <NULL> stat_3    
 69 ARM    Xanomeline Low Dose  RACE     BLACK OR AFRICAN AMERICAN        categorical n         n              4                0       <NULL>  <NULL> stat_3    
 70 ARM    Xanomeline Low Dose  RACE     WHITE                            categorical n         n              73               0       <NULL>  <NULL> stat_3    
 71 ARM    Xanomeline Low Dose  ETHNIC   HISPANIC OR LATINO               categorical n         n              6                0       <NULL>  <NULL> stat_3    
 72 ARM    Xanomeline Low Dose  ETHNIC   NOT HISPANIC OR LATINO           categorical n         n              71               0       <NULL>  <NULL> stat_3    
 73 ARM    Xanomeline Low Dose  any_ae   Any AE                           categorical N_s       N_s            84               0       <NULL>  <NULL> stat_3    
 74 ARM    Xanomeline Low Dose  SEX      F                                categorical N_s       N_s            50               0       <NULL>  <NULL> stat_3    
 75 ARM    Xanomeline Low Dose  SEX      M                                categorical N_s       N_s            34               0       <NULL>  <NULL> stat_3    
 76 ARM    Xanomeline Low Dose  AGEGR1   18-64                            categorical N_s       N_s            8                0       <NULL>  <NULL> stat_3    
 77 ARM    Xanomeline Low Dose  AGEGR1   >64                              categorical N_s       N_s            76               0       <NULL>  <NULL> stat_3    
 78 ARM    Xanomeline Low Dose  RACE     AMERICAN INDIAN OR ALASKA NATIVE categorical N_s       N_s            0                0       <NULL>  <NULL> stat_3    
 79 ARM    Xanomeline Low Dose  RACE     BLACK OR AFRICAN AMERICAN        categorical N_s       N_s            6                0       <NULL>  <NULL> stat_3    
 80 ARM    Xanomeline Low Dose  RACE     WHITE                            categorical N_s       N_s            78               0       <NULL>  <NULL> stat_3    
 81 ARM    Xanomeline Low Dose  ETHNIC   HISPANIC OR LATINO               categorical N_s       N_s            6                0       <NULL>  <NULL> stat_3    
 82 ARM    Xanomeline Low Dose  ETHNIC   NOT HISPANIC OR LATINO           categorical N_s       N_s            78               0       <NULL>  <NULL> stat_3    
 83 ARM    Xanomeline Low Dose  any_ae   Any AE                           categorical p         %              0.9166667        <fn>    <NULL>  <NULL> stat_3    
 84 ARM    Xanomeline Low Dose  SEX      F                                categorical p         %              0.88             <fn>    <NULL>  <NULL> stat_3    
 85 ARM    Xanomeline Low Dose  SEX      M                                categorical p         %              0.9705882        <fn>    <NULL>  <NULL> stat_3    
 86 ARM    Xanomeline Low Dose  AGEGR1   18-64                            categorical p         %              1                <fn>    <NULL>  <NULL> stat_3    
 87 ARM    Xanomeline Low Dose  AGEGR1   >64                              categorical p         %              0.9078947        <fn>    <NULL>  <NULL> stat_3    
 88 ARM    Xanomeline Low Dose  RACE     AMERICAN INDIAN OR ALASKA NATIVE categorical p         %              0                <fn>    <NULL>  <NULL> stat_3    
 89 ARM    Xanomeline Low Dose  RACE     BLACK OR AFRICAN AMERICAN        categorical p         %              0.6666667        <fn>    <NULL>  <NULL> stat_3    
 90 ARM    Xanomeline Low Dose  RACE     WHITE                            categorical p         %              0.9358974        <fn>    <NULL>  <NULL> stat_3    
 91 ARM    Xanomeline Low Dose  ETHNIC   HISPANIC OR LATINO               categorical p         %              1                <fn>    <NULL>  <NULL> stat_3    
 92 ARM    Xanomeline Low Dose  ETHNIC   NOT HISPANIC OR LATINO           categorical p         %              0.9102564        <fn>    <NULL>  <NULL> stat_3    
 93 <NA>   <NULL>               ARM      Placebo                          categorical n         n              86               0       <NULL>  <NULL> <NA>      
 94 <NA>   <NULL>               ARM      Xanomeline High Dose             categorical n         n              84               0       <NULL>  <NULL> <NA>      
 95 <NA>   <NULL>               ARM      Xanomeline Low Dose              categorical n         n              84               0       <NULL>  <NULL> <NA>      
 96 <NA>   <NULL>               SEX      <NULL>                           attributes  label     Variable Label Sex              <fn>    <NULL>  <NULL> <NA>      
 97 <NA>   <NULL>               SEX      <NULL>                           attributes  class     Variable Class logical          <NULL>  <NULL>  <NULL> <NA>      
 98 <NA>   <NULL>               AGEGR1   <NULL>                           attributes  label     Variable Label Age Group, years <fn>    <NULL>  <NULL> <NA>      
 99 <NA>   <NULL>               AGEGR1   <NULL>                           attributes  class     Variable Class logical          <NULL>  <NULL>  <NULL> <NA>      
100 <NA>   <NULL>               RACE     <NULL>                           attributes  label     Variable Label Race             <fn>    <NULL>  <NULL> <NA>      
101 <NA>   <NULL>               RACE     <NULL>                           attributes  class     Variable Class logical          <NULL>  <NULL>  <NULL> <NA>      
102 <NA>   <NULL>               ETHNIC   <NULL>                           attributes  label     Variable Label Ethnicity        <fn>    <NULL>  <NULL> <NA>      
103 <NA>   <NULL>               ETHNIC   <NULL>                           attributes  class     Variable Class logical          <NULL>  <NULL>  <NULL> <NA>      
Source Code
---
title: Overview of Adverse Events by Demographic Subgroup, Safety Population, Pooled Analysis (or Trial X)
subtitle: FDA Table 51
categories: [table, FDA, safety, adverse events]
---

::::: columns

:::: {.column width="52%"}
### FDA IG Shell

![](ig_shell.png){fig-alt="FDA IG example table shell" .lightbox width=100%}

### Programming Notes

**Background and Instructions**

Table 50: Overview of Serious Adverse Events by Demographic Subgroup and Table 51: Overview of Adverse Events by Demographic Subgroup in this section display placeholder values for the demographic characteristics for subgroup analysis of SAEs and AEs. These placeholder values will change to reflect the values found in the clinical trial data. When CDISC-controlled terminology is used in the clinical trial data, the demographic characteristics in this table will reflect the controlled terminology.

**Customization**

Provide any additional potentially relevant subgroups beyond the standard demographic ones that may shed light on which subjects are most susceptible to the safety event (e.g., baseline diseases [e.g., cardiovascular disease or diabetes, or by CKD stage], concomitant medication, anthropometric characteristics [e.g., BMI]). The clinical reviewer should discuss appropriate age groups for the subgroup analysis with the CDS.

::::

:::: {.column width="4%"}
::::

:::: {.column width="44%"}
### Output

```{r out-result, echo=FALSE, fig.align='center', out.width='100%'}
knitr::include_graphics("result.png")
```

::::

:::::

::: panel-tabset
## Full Code

```{r fullcode, file="../../../inst/templates/fda-table_51.R", message=FALSE, warning=FALSE, results='hide'}
```

## Table

```{r tbl}
tbl
```

## ARD

```{r ard, message=FALSE, warning=FALSE}
withr::local_options(width = 9999, tibble.print_max = Inf)
print(ard, columns = "all")
```

:::
 
  • This website as well as code examples are licensed under the Apache License, Version 2.0.
Cookie Preferences