Skip to content

Commit

Permalink
implementation of aet05
Browse files Browse the repository at this point in the history
  • Loading branch information
zdz2101 committed Jan 24, 2024
1 parent a842499 commit 96156cc
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
26 changes: 26 additions & 0 deletions tests/testthat/_snaps/table_aet05.new.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# AET05 variant 1 is produced correctly

Code
res
Output
Placebo Xanomeline High Dose Xanomeline Low Dose
(N=86) (N=84) (N=84)
——————————————————————————————————————————————————————————————————————————————————————————————————
Total patient-years at risk 8.4 15.7 1.4
Number of adverse events observed 69 79 77
AE rate per 100 patient-years 819.32 502.87 5624.85
95% CI (626.00, 1012.64) (391.98, 613.76) (4368.49, 6881.21)

# AET05 variant 2 is produced correctly

Code
res
Output
Placebo Xanomeline High Dose Xanomeline Low Dose
(N=86) (N=84) (N=84)
——————————————————————————————————————————————————————————————————————————————————————————————————
Total patient-years at risk 8.4 15.7 1.4
Number of adverse events observed 69 79 77
AE rate per 100 patient-years 819.32 502.87 5624.85
95% CI (637.48, 1036.90) (398.13, 626.73) (4439.04, 7030.10)

16 changes: 13 additions & 3 deletions tests/testthat/test-table_aet05.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
# Test variants for AET05.
adsl <- adsl_raw
adaette <- adaette_raw
adsl <- adsl_pharmaverse
adae <- adae_pharmaverse
adaette <- left_join(
select(adsl, USUBJID, ARM, TRTSDT),
select(filter(adae, AESEQ == 1), USUBJID, ASTDTM),
by = "USUBJID"
) %>%
mutate(
PARAM = "Time to first occurrence of any adverse event",
AVAL = as.numeric(difftime(TRTSDT, ASTDTM, unit = "days"))/365.25,
AVALU = "YEARS",
CNSR = ifelse(is.na(AVAL), 1, 0)
)

adsl <- df_explicit_na(adsl)
adaette <- df_explicit_na(adaette)
Expand Down

0 comments on commit 96156cc

Please sign in to comment.