From 96156ccb47486bfbe58b6eb066dbf2edc93c1685 Mon Sep 17 00:00:00 2001 From: Zelos Zhu Date: Wed, 24 Jan 2024 17:39:59 +0000 Subject: [PATCH] implementation of aet05 --- tests/testthat/_snaps/table_aet05.new.md | 26 ++++++++++++++++++++++++ tests/testthat/test-table_aet05.R | 16 ++++++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 tests/testthat/_snaps/table_aet05.new.md diff --git a/tests/testthat/_snaps/table_aet05.new.md b/tests/testthat/_snaps/table_aet05.new.md new file mode 100644 index 00000000..cd71aa9c --- /dev/null +++ b/tests/testthat/_snaps/table_aet05.new.md @@ -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) + diff --git a/tests/testthat/test-table_aet05.R b/tests/testthat/test-table_aet05.R index 478ab3d1..2c5660e7 100644 --- a/tests/testthat/test-table_aet05.R +++ b/tests/testthat/test-table_aet05.R @@ -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)