diff --git a/.lintr b/.lintr index 34473d273..13fa06ef2 100644 --- a/.lintr +++ b/.lintr @@ -1,5 +1,5 @@ linters: linters_with_defaults( line_length_linter = line_length_linter(120), - cyclocomp_linter = NULL, - object_usage_linter = NULL + object_usage_linter = NULL, + pipe_consistency_linter = NULL ) diff --git a/DESCRIPTION b/DESCRIPTION index 86bf04dbd..4862e43e5 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: chevron Title: Standard TLGs for Clinical Trials Reporting -Version: 0.2.15.9000 +Version: 0.2.16 Date: 2026-10-28 Authors@R: c( person("Liming", "Li", , "liming.li@roche.com", role = "aut", @@ -72,7 +72,7 @@ Config/Needs/verdepcheck: mllg/checkmate, tidyverse/dplyr, yihui/knitr, rstudio/rmarkdown, r-lib/testthat, tidyverse/tidyr, r-lib/vdiffr, r-lib/withr Config/Needs/website: insightsengineering/nesttemplate -Config/roxygen2/version: 8.1.0 +Config/roxygen2/version: 8.1.1 Config/testthat/edition: 3 Encoding: UTF-8 Language: en-US diff --git a/NEWS.md b/NEWS.md index 314c99f8d..860a3003e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,8 +1,11 @@ -# chevron 0.2.15.9000 +# chevron 0.2.16 + +* Updated `rspt01` tests and documentation for `tern` >= 0.9.12, which no longer accepts `"ha"` and `"schouten"` as stratified methods; the examples now use `"cmh_sato"`. +* Converted the derived `*_main` functions of `cmt02_pt`, `coxt02`, `egt01`, `egt02_2`, `rmpt03`, `rmpt04`, `rmpt05`, `vst01` and `vst02` from `modify_default_args()` wrappers into explicit forwarding functions so their requirements are picked up by the test traceability report (no change to output). # chevron 0.2.15 -* Skip test to avoid cran check fails for tern. +* Skip test to avoid CRAN check fails for tern. # chevron 0.2.14 diff --git a/R/cmt02_pt.R b/R/cmt02_pt.R index 9f867f93c..33df709fd 100644 --- a/R/cmt02_pt.R +++ b/R/cmt02_pt.R @@ -7,11 +7,23 @@ #' @returns the main function returns an `rtables` object. #' @export #' -cmt02_pt_main <- modify_default_args( - cmt01a_main, - row_split_var = NULL, - summary_labels = quote(list(TOTAL = cmt01_label)) -) +cmt02_pt_main <- function(adam_db, + arm_var = "ARM", + lbl_overall = NULL, + row_split_var = NULL, + medname_var = "CMDECOD", + summary_labels = list(TOTAL = cmt01_label), + ...) { + cmt01a_main( + adam_db = adam_db, + arm_var = arm_var, + lbl_overall = lbl_overall, + row_split_var = row_split_var, + medname_var = medname_var, + summary_labels = summary_labels, + ... + ) +} #' @describeIn cmt02_pt Preprocessing #' diff --git a/R/coxt02.R b/R/coxt02.R index 1446b625b..8e07a13e2 100644 --- a/R/coxt02.R +++ b/R/coxt02.R @@ -8,7 +8,27 @@ #' #' @export #' -coxt02_main <- modify_default_args(coxt01_main, multivar = TRUE) +coxt02_main <- function(adam_db, + arm_var = "ARM", + time_var = "AVAL", + event_var = "EVENT", + covariates = c("SEX", "RACE", "AAGE"), + strata = NULL, + lbl_vars = "Effect/Covariate Included in the Model", + multivar = TRUE, + ...) { + coxt01_main( + adam_db = adam_db, + arm_var = arm_var, + time_var = time_var, + event_var = event_var, + covariates = covariates, + strata = strata, + lbl_vars = lbl_vars, + multivar = multivar, + ... + ) +} #' `COXT02` Multi-Variable Cox Regression Model Table. #' diff --git a/R/egt01.R b/R/egt01.R index 3aa780fcd..735e37f79 100644 --- a/R/egt01.R +++ b/R/egt01.R @@ -10,7 +10,33 @@ #' #' @export #' -egt01_main <- modify_default_args(cfbt01_main, dataset = "adeg", precision = quote(list(default = 0L))) +egt01_main <- function(adam_db, + dataset = "adeg", + arm_var = "ACTARM", + lbl_overall = NULL, + row_split_var = NULL, + summaryvars = c("AVAL", "CHG"), + visitvar = "AVISIT", + precision = list(default = 0L), + page_var = "PARAMCD", + .stats = c("n", "mean_sd", "median", "range"), + skip = list(CHG = "BASELINE"), + ...) { + cfbt01_main( + adam_db = adam_db, + dataset = dataset, + arm_var = arm_var, + lbl_overall = lbl_overall, + row_split_var = row_split_var, + summaryvars = summaryvars, + visitvar = visitvar, + precision = precision, + page_var = page_var, + .stats = .stats, + skip = skip, + ... + ) +} #' @describeIn egt01 Preprocessing #' diff --git a/R/egt02.R b/R/egt02.R index 3c6235bc2..923438a48 100644 --- a/R/egt02.R +++ b/R/egt02.R @@ -124,7 +124,19 @@ egt02_1 <- chevron_t( #' #' @export #' -egt02_2_main <- modify_default_args(egt02_1_main, exclude_base_abn = TRUE) +egt02_2_main <- function(adam_db, + arm_var = "ACTARM", + lbl_overall = NULL, + exclude_base_abn = TRUE, + ...) { + egt02_1_main( + adam_db = adam_db, + arm_var = arm_var, + lbl_overall = lbl_overall, + exclude_base_abn = exclude_base_abn, + ... + ) +} #' `EGT02_2` ECG Abnormalities Table. #' diff --git a/R/rmpt03.R b/R/rmpt03.R index 89a8e2a69..ed4031777 100644 --- a/R/rmpt03.R +++ b/R/rmpt03.R @@ -12,12 +12,23 @@ #' #' @export #' -rmpt03_main <- modify_default_args( - rmpt01_main, - summaryvars = "AGEGR1", - col_split_var = "SEX", - overall_col_lbl = "All Genders" -) +rmpt03_main <- function(adam_db, + summaryvars = "AGEGR1", + show_tot = TRUE, + row_split_var = NULL, + col_split_var = "SEX", + overall_col_lbl = "All Genders", + ...) { + rmpt01_main( + adam_db = adam_db, + summaryvars = summaryvars, + show_tot = show_tot, + row_split_var = row_split_var, + col_split_var = col_split_var, + overall_col_lbl = overall_col_lbl, + ... + ) +} #' @describeIn rmpt03 Preprocessing #' diff --git a/R/rmpt04.R b/R/rmpt04.R index 8014fa22c..ab30584ba 100644 --- a/R/rmpt04.R +++ b/R/rmpt04.R @@ -14,7 +14,23 @@ #' #' @export #' -rmpt04_main <- modify_default_args(rmpt01_main, summaryvars = "ETHNIC") +rmpt04_main <- function(adam_db, + summaryvars = "ETHNIC", + show_tot = TRUE, + row_split_var = NULL, + col_split_var = NULL, + overall_col_lbl = NULL, + ...) { + rmpt01_main( + adam_db = adam_db, + summaryvars = summaryvars, + show_tot = show_tot, + row_split_var = row_split_var, + col_split_var = col_split_var, + overall_col_lbl = overall_col_lbl, + ... + ) +} #' @describeIn rmpt04 Preprocessing #' diff --git a/R/rmpt05.R b/R/rmpt05.R index 6a61876a2..5ea70b393 100644 --- a/R/rmpt05.R +++ b/R/rmpt05.R @@ -14,7 +14,23 @@ #' #' @export #' -rmpt05_main <- modify_default_args(rmpt01_main, summaryvars = "RACE") +rmpt05_main <- function(adam_db, + summaryvars = "RACE", + show_tot = TRUE, + row_split_var = NULL, + col_split_var = NULL, + overall_col_lbl = NULL, + ...) { + rmpt01_main( + adam_db = adam_db, + summaryvars = summaryvars, + show_tot = show_tot, + row_split_var = row_split_var, + col_split_var = col_split_var, + overall_col_lbl = overall_col_lbl, + ... + ) +} #' @describeIn rmpt05 Preprocessing #' diff --git a/R/rspt01.R b/R/rspt01.R index 03034d452..d78b43609 100644 --- a/R/rspt01.R +++ b/R/rspt01.R @@ -15,9 +15,9 @@ #' @param methods (`list`) a named list, use a named list to control, for example: #' `methods = list(prop_conf_method = "wald", #' diff_conf_method = "wald", -#' strat_diff_conf_method = "ha", +#' strat_diff_conf_method = "cmh_sato", #' diff_pval_method = "fisher", -#' strat_diff_pval_method = "schouten")` +#' strat_diff_pval_method = "cmh_sato")` #' `prop_conf_method` controls the methods of calculating proportion confidence interval, #' `diff_conf_method` controls the methods of calculating unstratified difference confidence interval, #' `strat_diff_conf_method` controls the methods of calculating stratified difference confidence interval, diff --git a/R/vst01.R b/R/vst01.R index 456ba4717..4298b91a0 100644 --- a/R/vst01.R +++ b/R/vst01.R @@ -8,11 +8,33 @@ #' #' @export #' -vst01_main <- modify_default_args( - cfbt01_main, - dataset = "advs", - precision = quote(list(DIABP = 0, PUL = 0, SYSBP = 0, default = 2L)) -) +vst01_main <- function(adam_db, + dataset = "advs", + arm_var = "ACTARM", + lbl_overall = NULL, + row_split_var = NULL, + summaryvars = c("AVAL", "CHG"), + visitvar = "AVISIT", + precision = list(DIABP = 0, PUL = 0, SYSBP = 0, default = 2L), + page_var = "PARAMCD", + .stats = c("n", "mean_sd", "median", "range"), + skip = list(CHG = "BASELINE"), + ...) { + cfbt01_main( + adam_db = adam_db, + dataset = dataset, + arm_var = arm_var, + lbl_overall = lbl_overall, + row_split_var = row_split_var, + summaryvars = summaryvars, + visitvar = visitvar, + precision = precision, + page_var = page_var, + .stats = .stats, + skip = skip, + ... + ) +} #' @describeIn vst01 Preprocessing #' diff --git a/R/vst02.R b/R/vst02.R index dcb871636..38fd345de 100644 --- a/R/vst02.R +++ b/R/vst02.R @@ -135,7 +135,19 @@ vst02_1 <- chevron_t( #' #' @export #' -vst02_2_main <- modify_default_args(vst02_1_main, exclude_base_abn = TRUE) +vst02_2_main <- function(adam_db, + arm_var = "ACTARM", + lbl_overall = NULL, + exclude_base_abn = TRUE, + ...) { + vst02_1_main( + adam_db = adam_db, + arm_var = arm_var, + lbl_overall = lbl_overall, + exclude_base_abn = exclude_base_abn, + ... + ) +} #' `VST02` Vital Sign Abnormalities Table. #' #' Vital Sign Parameters outside Normal Limits Among Patients without Abnormality at Baseline. diff --git a/man/proportion_lyt.Rd b/man/proportion_lyt.Rd index 9b0599a27..f485dab4e 100644 --- a/man/proportion_lyt.Rd +++ b/man/proportion_lyt.Rd @@ -20,7 +20,7 @@ proportion_lyt( \item{arm_var}{(\code{string}) variable used for column splitting} \item{methods}{(\code{list}) a named list, use a named list to control, for example: -\code{methods = list(prop_conf_method = "wald", diff_conf_method = "wald", strat_diff_conf_method = "ha", diff_pval_method = "fisher", strat_diff_pval_method = "schouten")} +\code{methods = list(prop_conf_method = "wald", diff_conf_method = "wald", strat_diff_conf_method = "cmh_sato", diff_pval_method = "fisher", strat_diff_pval_method = "cmh_sato")} \code{prop_conf_method} controls the methods of calculating proportion confidence interval, \code{diff_conf_method} controls the methods of calculating unstratified difference confidence interval, \code{strat_diff_conf_method} controls the methods of calculating stratified difference confidence interval, diff --git a/man/rspt01.Rd b/man/rspt01.Rd index 1e6788917..18f9db58a 100644 --- a/man/rspt01.Rd +++ b/man/rspt01.Rd @@ -47,7 +47,7 @@ or unstratified analyses, or both, e.g. \code{c("unstrat", "strat")}. Only unstr \item{conf_level}{(\code{numeric}) the level of confidence interval, default is 0.95.} \item{methods}{(\code{list}) a named list, use a named list to control, for example: -\code{methods = list(prop_conf_method = "wald", diff_conf_method = "wald", strat_diff_conf_method = "ha", diff_pval_method = "fisher", strat_diff_pval_method = "schouten")} +\code{methods = list(prop_conf_method = "wald", diff_conf_method = "wald", strat_diff_conf_method = "cmh_sato", diff_pval_method = "fisher", strat_diff_pval_method = "cmh_sato")} \code{prop_conf_method} controls the methods of calculating proportion confidence interval, \code{diff_conf_method} controls the methods of calculating unstratified difference confidence interval, \code{strat_diff_conf_method} controls the methods of calculating stratified difference confidence interval, diff --git a/tests/testthat/_snaps/mng01/mng01-with-custom-theme.svg b/tests/testthat/_snaps/mng01/mng01-with-custom-theme.svg deleted file mode 100644 index 4acbd8a9c..000000000 --- a/tests/testthat/_snaps/mng01/mng01-with-custom-theme.svg +++ /dev/null @@ -1,306 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -10 -15 -20 -25 - - - - - - - - - - -BASELINE -WEEK 1 DAY 8 -WEEK 2 DAY 15 -WEEK 3 DAY 22 -WEEK 4 DAY 29 -WEEK 5 DAY 36 - -Description of Actual Arm - - - - - - - - - - - - -A: Drug X (N = 15) -B: Placebo (N = 15) -C: Combination (N = 15) -Alanine Aminotransferase Measurement - - - - - - - - - - - - - - - - - - -15 -18.7 -(11.76, 25.55) -15 -16.3 -(10.30, 22.32) -15 -16.6 -(10.82, 22.48) -15 -17.5 -(11.57, 23.40) -15 -16.8 -(11.75, 21.83) -15 -17.9 -(13.87, 21.89) - - - - - - - - - - -15 -16.8 -(10.70, 22.97) -15 -22.1 -(17.88, 26.23) -15 -20.8 -(15.45, 26.06) -15 -20.1 -(15.58, 24.53) -15 -17.6 -(12.10, 23.02) -15 -17.4 -(13.50, 21.33) - - - - - - - - - - -15 -22.4 -(17.15, 27.62) -15 -19.6 -(14.11, 25.04) -15 -10.9 -(6.64, 15.19) -15 -18.4 -(13.14, 23.68) -15 -18.4 -(11.96, 24.83) -15 -15.2 -(10.52, 19.83) - - - - - - - - - - -C: Combination - - - - - - - - - - -B: Placebo - - - - - - - - - - -A: Drug X - - -Mean 95% CI -Mean -n -Mean 95% CI -Mean -n -Mean 95% CI -Mean -n - - diff --git a/tests/testthat/_snaps/mng01/mng01-with-default-value.svg b/tests/testthat/_snaps/mng01/mng01-with-default-value.svg deleted file mode 100644 index 4d2346f7d..000000000 --- a/tests/testthat/_snaps/mng01/mng01-with-default-value.svg +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -10 -15 -20 -25 - - - - - - - - - - -BASELINE -WEEK 1 DAY 8 -WEEK 2 DAY 15 -WEEK 3 DAY 22 -WEEK 4 DAY 29 -WEEK 5 DAY 36 - -Description of Actual Arm - - - - - - - - - - - - -A: Drug X (N = 15) -B: Placebo (N = 15) -C: Combination (N = 15) -Alanine Aminotransferase Measurement - - - - - - - - - - - - - - - - - - -15 -18.7 -(11.76, 25.55) -15 -16.3 -(10.30, 22.32) -15 -16.6 -(10.82, 22.48) -15 -17.5 -(11.57, 23.40) -15 -16.8 -(11.75, 21.83) -15 -17.9 -(13.87, 21.89) - - - - - - - - - - -15 -16.8 -(10.70, 22.97) -15 -22.1 -(17.88, 26.23) -15 -20.8 -(15.45, 26.06) -15 -20.1 -(15.58, 24.53) -15 -17.6 -(12.10, 23.02) -15 -17.4 -(13.50, 21.33) - - - - - - - - - - -15 -22.4 -(17.15, 27.62) -15 -19.6 -(14.11, 25.04) -15 -10.9 -(6.64, 15.19) -15 -18.4 -(13.14, 23.68) -15 -18.4 -(11.96, 24.83) -15 -15.2 -(10.52, 19.83) - - - - - - - - - - -C: Combination - - - - - - - - - - -B: Placebo - - - - - - - - - - -A: Drug X - - -Mean 95% CI -Mean -n -Mean 95% CI -Mean -n -Mean 95% CI -Mean -n - - diff --git a/tests/testthat/_snaps/mng01/run-mng01-with-combination-of-x-variables.svg b/tests/testthat/_snaps/mng01/run-mng01-with-combination-of-x-variables.svg deleted file mode 100644 index d98789967..000000000 --- a/tests/testthat/_snaps/mng01/run-mng01-with-combination-of-x-variables.svg +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -10 -15 -20 -25 - - - - - - - - - - -BASELINE_0 -WEEK 1 DAY 8_1 -WEEK 2 DAY 15_2 -WEEK 3 DAY 22_3 -WEEK 4 DAY 29_4 -WEEK 5 DAY 36_5 - -Description of Actual Arm - - - - - - - - - - - - -A: Drug X (N = 15) -B: Placebo (N = 15) -C: Combination (N = 15) -Alanine Aminotransferase Measurement - - - - - - - - - - - - - - - - - - -15 -18.7 -(11.76, 25.55) -15 -16.3 -(10.30, 22.32) -15 -16.6 -(10.82, 22.48) -15 -17.5 -(11.57, 23.40) -15 -16.8 -(11.75, 21.83) -15 -17.9 -(13.87, 21.89) - - - - - - - - - - -15 -16.8 -(10.70, 22.97) -15 -22.1 -(17.88, 26.23) -15 -20.8 -(15.45, 26.06) -15 -20.1 -(15.58, 24.53) -15 -17.6 -(12.10, 23.02) -15 -17.4 -(13.50, 21.33) - - - - - - - - - - -15 -22.4 -(17.15, 27.62) -15 -19.6 -(14.11, 25.04) -15 -10.9 -(6.64, 15.19) -15 -18.4 -(13.14, 23.68) -15 -18.4 -(11.96, 24.83) -15 -15.2 -(10.52, 19.83) - - - - - - - - - - -C: Combination - - - - - - - - - - -B: Placebo - - - - - - - - - - -A: Drug X - - -Mean 95% CI -Mean -n -Mean 95% CI -Mean -n -Mean 95% CI -Mean -n - - diff --git a/tests/testthat/_snaps/mng01/run-mng01-with-custom-color-set.svg b/tests/testthat/_snaps/mng01/run-mng01-with-custom-color-set.svg deleted file mode 100644 index d3748801d..000000000 --- a/tests/testthat/_snaps/mng01/run-mng01-with-custom-color-set.svg +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -10 -15 -20 -25 - - - - - - - - - - -BASELINE -WEEK 1 DAY 8 -WEEK 2 DAY 15 -WEEK 3 DAY 22 -WEEK 4 DAY 29 -WEEK 5 DAY 36 - -Description of Actual Arm - - - - - - - - - - - - -A: Drug X (N = 15) -B: Placebo (N = 15) -C: Combination (N = 15) -Alanine Aminotransferase Measurement - - - - - - - - - - - - - - - - - - -15 -18.7 -(11.76, 25.55) -15 -16.3 -(10.30, 22.32) -15 -16.6 -(10.82, 22.48) -15 -17.5 -(11.57, 23.40) -15 -16.8 -(11.75, 21.83) -15 -17.9 -(13.87, 21.89) - - - - - - - - - - -15 -16.8 -(10.70, 22.97) -15 -22.1 -(17.88, 26.23) -15 -20.8 -(15.45, 26.06) -15 -20.1 -(15.58, 24.53) -15 -17.6 -(12.10, 23.02) -15 -17.4 -(13.50, 21.33) - - - - - - - - - - -15 -22.4 -(17.15, 27.62) -15 -19.6 -(14.11, 25.04) -15 -10.9 -(6.64, 15.19) -15 -18.4 -(13.14, 23.68) -15 -18.4 -(11.96, 24.83) -15 -15.2 -(10.52, 19.83) - - - - - - - - - - -C: Combination - - - - - - - - - - -B: Placebo - - - - - - - - - - -A: Drug X - - -Mean 95% CI -Mean -n -Mean 95% CI -Mean -n -Mean 95% CI -Mean -n - - diff --git a/tests/testthat/_snaps/mng01/run-mng01-with-custom-line-type-set.svg b/tests/testthat/_snaps/mng01/run-mng01-with-custom-line-type-set.svg deleted file mode 100644 index 0b5d08503..000000000 --- a/tests/testthat/_snaps/mng01/run-mng01-with-custom-line-type-set.svg +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -10 -15 -20 -25 - - - - - - - - - - -BASELINE -WEEK 1 DAY 8 -WEEK 2 DAY 15 -WEEK 3 DAY 22 -WEEK 4 DAY 29 -WEEK 5 DAY 36 - -Description of Actual Arm - - - - - - - - - - - - -A: Drug X (N = 15) -B: Placebo (N = 15) -C: Combination (N = 15) -Alanine Aminotransferase Measurement - - - - - - - - - - - - - - - - - - -15 -18.7 -(11.76, 25.55) -15 -16.3 -(10.30, 22.32) -15 -16.6 -(10.82, 22.48) -15 -17.5 -(11.57, 23.40) -15 -16.8 -(11.75, 21.83) -15 -17.9 -(13.87, 21.89) - - - - - - - - - - -15 -16.8 -(10.70, 22.97) -15 -22.1 -(17.88, 26.23) -15 -20.8 -(15.45, 26.06) -15 -20.1 -(15.58, 24.53) -15 -17.6 -(12.10, 23.02) -15 -17.4 -(13.50, 21.33) - - - - - - - - - - -15 -22.4 -(17.15, 27.62) -15 -19.6 -(14.11, 25.04) -15 -10.9 -(6.64, 15.19) -15 -18.4 -(13.14, 23.68) -15 -18.4 -(11.96, 24.83) -15 -15.2 -(10.52, 19.83) - - - - - - - - - - -C: Combination - - - - - - - - - - -B: Placebo - - - - - - - - - - -A: Drug X - - -Mean 95% CI -Mean -n -Mean 95% CI -Mean -n -Mean 95% CI -Mean -n - - diff --git a/tests/testthat/_snaps/mng01/run-mng01-with-custom-unnamed-color-set.svg b/tests/testthat/_snaps/mng01/run-mng01-with-custom-unnamed-color-set.svg deleted file mode 100644 index ab8acb7a1..000000000 --- a/tests/testthat/_snaps/mng01/run-mng01-with-custom-unnamed-color-set.svg +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -10 -15 -20 -25 - - - - - - - - - - -BASELINE -WEEK 1 DAY 8 -WEEK 2 DAY 15 -WEEK 3 DAY 22 -WEEK 4 DAY 29 -WEEK 5 DAY 36 - -Description of Actual Arm - - - - - - - - - - - - -A: Drug X (N = 15) -B: Placebo (N = 15) -C: Combination (N = 15) -Alanine Aminotransferase Measurement - - - - - - - - - - - - - - - - - - -15 -18.7 -(11.76, 25.55) -15 -16.3 -(10.30, 22.32) -15 -16.6 -(10.82, 22.48) -15 -17.5 -(11.57, 23.40) -15 -16.8 -(11.75, 21.83) -15 -17.9 -(13.87, 21.89) - - - - - - - - - - -15 -16.8 -(10.70, 22.97) -15 -22.1 -(17.88, 26.23) -15 -20.8 -(15.45, 26.06) -15 -20.1 -(15.58, 24.53) -15 -17.6 -(12.10, 23.02) -15 -17.4 -(13.50, 21.33) - - - - - - - - - - -15 -22.4 -(17.15, 27.62) -15 -19.6 -(14.11, 25.04) -15 -10.9 -(6.64, 15.19) -15 -18.4 -(13.14, 23.68) -15 -18.4 -(11.96, 24.83) -15 -15.2 -(10.52, 19.83) - - - - - - - - - - -C: Combination - - - - - - - - - - -B: Placebo - - - - - - - - - - -A: Drug X - - -Mean 95% CI -Mean -n -Mean 95% CI -Mean -n -Mean 95% CI -Mean -n - - diff --git a/tests/testthat/_snaps/mng01/run-mng01-with-custom-unnamed-line-type-set.svg b/tests/testthat/_snaps/mng01/run-mng01-with-custom-unnamed-line-type-set.svg deleted file mode 100644 index 6bdd44371..000000000 --- a/tests/testthat/_snaps/mng01/run-mng01-with-custom-unnamed-line-type-set.svg +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -10 -15 -20 -25 - - - - - - - - - - -BASELINE -WEEK 1 DAY 8 -WEEK 2 DAY 15 -WEEK 3 DAY 22 -WEEK 4 DAY 29 -WEEK 5 DAY 36 - -Description of Actual Arm - - - - - - - - - - - - -A: Drug X (N = 15) -B: Placebo (N = 15) -C: Combination (N = 15) -Alanine Aminotransferase Measurement - - - - - - - - - - - - - - - - - - -15 -18.7 -(11.76, 25.55) -15 -16.3 -(10.30, 22.32) -15 -16.6 -(10.82, 22.48) -15 -17.5 -(11.57, 23.40) -15 -16.8 -(11.75, 21.83) -15 -17.9 -(13.87, 21.89) - - - - - - - - - - -15 -16.8 -(10.70, 22.97) -15 -22.1 -(17.88, 26.23) -15 -20.8 -(15.45, 26.06) -15 -20.1 -(15.58, 24.53) -15 -17.6 -(12.10, 23.02) -15 -17.4 -(13.50, 21.33) - - - - - - - - - - -15 -22.4 -(17.15, 27.62) -15 -19.6 -(14.11, 25.04) -15 -10.9 -(6.64, 15.19) -15 -18.4 -(13.14, 23.68) -15 -18.4 -(11.96, 24.83) -15 -15.2 -(10.52, 19.83) - - - - - - - - - - -C: Combination - - - - - - - - - - -B: Placebo - - - - - - - - - - -A: Drug X - - -Mean 95% CI -Mean -n -Mean 95% CI -Mean -n -Mean 95% CI -Mean -n - - diff --git a/tests/testthat/_snaps/mng01/run-mng01-with-jitter.svg b/tests/testthat/_snaps/mng01/run-mng01-with-jitter.svg deleted file mode 100644 index 1f3a63058..000000000 --- a/tests/testthat/_snaps/mng01/run-mng01-with-jitter.svg +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -10 -15 -20 -25 - - - - - - - - - - -BASELINE -WEEK 1 DAY 8 -WEEK 2 DAY 15 -WEEK 3 DAY 22 -WEEK 4 DAY 29 -WEEK 5 DAY 36 - -Description of Actual Arm - - - - - - - - - - - - -A: Drug X (N = 15) -B: Placebo (N = 15) -C: Combination (N = 15) -Alanine Aminotransferase Measurement - - - - - - - - - - - - - - - - - - -15 -18.7 -(11.76, 25.55) -15 -16.3 -(10.30, 22.32) -15 -16.6 -(10.82, 22.48) -15 -17.5 -(11.57, 23.40) -15 -16.8 -(11.75, 21.83) -15 -17.9 -(13.87, 21.89) - - - - - - - - - - -15 -16.8 -(10.70, 22.97) -15 -22.1 -(17.88, 26.23) -15 -20.8 -(15.45, 26.06) -15 -20.1 -(15.58, 24.53) -15 -17.6 -(12.10, 23.02) -15 -17.4 -(13.50, 21.33) - - - - - - - - - - -15 -22.4 -(17.15, 27.62) -15 -19.6 -(14.11, 25.04) -15 -10.9 -(6.64, 15.19) -15 -18.4 -(13.14, 23.68) -15 -18.4 -(11.96, 24.83) -15 -15.2 -(10.52, 19.83) - - - - - - - - - - -C: Combination - - - - - - - - - - -B: Placebo - - - - - - - - - - -A: Drug X - - -Mean 95% CI -Mean -n -Mean 95% CI -Mean -n -Mean 95% CI -Mean -n - - diff --git a/tests/testthat/_snaps/mng01/run-mng01-with-numeric-x-variables.svg b/tests/testthat/_snaps/mng01/run-mng01-with-numeric-x-variables.svg deleted file mode 100644 index 5ba4c1d83..000000000 --- a/tests/testthat/_snaps/mng01/run-mng01-with-numeric-x-variables.svg +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -0 -10 -20 -30 - - - - - - - -0 -4 -8 - -Description of Actual Arm - - - - - - - - - - - - -A: Drug X (N = 15) -B: Placebo (N = 15) -C: Combination (N = 15) -Alanine Aminotransferase Measurement - - - - - - - - - - - - - - - - - - -0 -NA -NA -14 -18.4 -(10.97, 25.86) -14 -16.4 -(9.93, 22.92) -14 -16.0 -(9.89, 22.18) -14 -18.0 -(11.68, 24.28) -14 -16.2 -(10.91, 21.44) -14 -17.4 -(13.22, 21.63) -6 -20.4 -(13.81, 26.90) - - - - - - - - - - -13 -17.4 -(13.87, 21.01) -12 -13.8 -(7.40, 20.17) -12 -23.9 -(19.29, 28.45) -12 -20.9 -(14.32, 27.46) -12 -20.1 -(14.38, 25.89) -12 -17.7 -(10.75, 24.61) -12 -18.3 -(13.55, 23.05) -5 -23.5 -(15.10, 31.89) - - - - - - - - - - -4 -14.5 -(-6.83, 35.89) -13 -21.5 -(15.57, 27.46) -13 -19.9 -(14.15, 25.56) -13 -12.2 -(7.74, 16.70) -13 -17.4 -(11.44, 23.32) -14 -18.5 -(11.59, 25.50) -14 -14.3 -(9.69, 19.01) -6 -21.9 -(11.38, 32.48) - - - - - - - - - - -C: Combination - - - - - - - - - - -B: Placebo - - - - - - - - - - -A: Drug X - - -Mean 95% CI -Mean -n -Mean 95% CI -Mean -n -Mean 95% CI -Mean -n - - diff --git a/tests/testthat/_snaps/mng01/run-mng01-without-table.svg b/tests/testthat/_snaps/mng01/run-mng01-without-table.svg deleted file mode 100644 index fc7d09137..000000000 --- a/tests/testthat/_snaps/mng01/run-mng01-without-table.svg +++ /dev/null @@ -1,151 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -10 -15 -20 -25 - - - - - - - - - - -BASELINE -WEEK 1 DAY 8 -WEEK 2 DAY 15 -WEEK 3 DAY 22 -WEEK 4 DAY 29 -WEEK 5 DAY 36 - -Description of Actual Arm - - - - - - - - - - - - -A: Drug X (N = 15) -B: Placebo (N = 15) -C: Combination (N = 15) -Alanine Aminotransferase Measurement - - diff --git a/tests/testthat/_snaps/rspt01.md b/tests/testthat/_snaps/rspt01.md index fabf17424..24359dcc3 100644 --- a/tests/testthat/_snaps/rspt01.md +++ b/tests/testthat/_snaps/rspt01.md @@ -234,48 +234,69 @@ Code cat(export_as_txt(res, lpp = 100)) Output - A: Drug X B: Placebo - (N=15) (N=15) - ——————————————————————————————————————————————————————————————————————————————————————————— - Responders 10 (66.7%) 9 (60.0%) - 95% CI (Wald, without correction) (42.8, 90.5) (35.2, 84.8) - Unstratified Analysis - Difference in Response rate (%) -6.7 - 95% CI (Wald, without correction) (-41.1, 27.7) - p-value (Fisher's Exact Test) 1.0000 - Odds Ratio (95% CI) 0.75 (0.17 - 3.33) - Stratified Analysis - Difference in Response rate (%) -6.7 - 95% CI (Anderson-Hauck) (-45.6, 32.3) - p-value (Chi-Squared Test with Schouten Correction) 0.8522 - Odds Ratio (95% CI) 0.75 (0.17 - 3.33) - Complete Response (CR) 4 (26.7%) 4 (26.7%) - 95% CI (Wald, without correction) (4.29, 49.05) (4.29, 49.05) - Partial Response (PR) 6 (40.0%) 5 (33.3%) - 95% CI (Wald, without correction) (15.21, 64.79) (9.48, 57.19) - Stable Disease (SD) 5 (33.3%) 6 (40.0%) - 95% CI (Wald, without correction) (9.48, 57.19) (15.21, 64.79) - \s\n C: Combination - (N=15) - —————————————————————————————————————————————————————————————————————————— - Responders 11 (73.3%) - 95% CI (Wald, without correction) (51.0, 95.7) - Unstratified Analysis - Difference in Response rate (%) 6.7 - 95% CI (Wald, without correction) (-26.0, 39.4) - p-value (Fisher's Exact Test) 1.0000 - Odds Ratio (95% CI) 1.37 (0.29 - 6.60) - Stratified Analysis - Difference in Response rate (%) 6.7 - 95% CI (Anderson-Hauck) (-30.5, 43.9) - p-value (Chi-Squared Test with Schouten Correction) 0.8447 - Odds Ratio (95% CI) 1.37 (0.29 - 6.60) - Complete Response (CR) 7 (46.7%) - 95% CI (Wald, without correction) (21.42, 71.91) - Partial Response (PR) 4 (26.7%) - 95% CI (Wald, without correction) (4.29, 49.05) - Stable Disease (SD) 4 (26.7%) - 95% CI (Wald, without correction) (4.29, 49.05) + A: Drug X + (N=15) + —————————————————————————————————————————————————————————————————————————————————————— + Responders 10 (66.7%) + 95% CI (Wald, without correction) (42.8, 90.5) + Unstratified Analysis + Difference in Response rate (%) + 95% CI (Wald, without correction) + p-value (Fisher's Exact Test) + Odds Ratio (95% CI) + Stratified Analysis + Difference in Response rate (%) + 95% CI (CMH, Sato variance estimator) + p-value (Cochran-Mantel-Haenszel Test with Sato Variance Estimator) + Odds Ratio (95% CI) + Complete Response (CR) 4 (26.7%) + 95% CI (Wald, without correction) (4.29, 49.05) + Partial Response (PR) 6 (40.0%) + 95% CI (Wald, without correction) (15.21, 64.79) + Stable Disease (SD) 5 (33.3%) + 95% CI (Wald, without correction) (9.48, 57.19) + \s\n B: Placebo + (N=15) + —————————————————————————————————————————————————————————————————————————————————————————— + Responders 9 (60.0%) + 95% CI (Wald, without correction) (35.2, 84.8) + Unstratified Analysis + Difference in Response rate (%) -6.7 + 95% CI (Wald, without correction) (-41.1, 27.7) + p-value (Fisher's Exact Test) 1.0000 + Odds Ratio (95% CI) 0.75 (0.17 - 3.33) + Stratified Analysis + Difference in Response rate (%) -7.7 + 95% CI (CMH, Sato variance estimator) (-41.7, 26.3) + p-value (Cochran-Mantel-Haenszel Test with Sato Variance Estimator) 0.6576 + Odds Ratio (95% CI) 0.75 (0.17 - 3.33) + Complete Response (CR) 4 (26.7%) + 95% CI (Wald, without correction) (4.29, 49.05) + Partial Response (PR) 5 (33.3%) + 95% CI (Wald, without correction) (9.48, 57.19) + Stable Disease (SD) 6 (40.0%) + 95% CI (Wald, without correction) (15.21, 64.79) + \s\n C: Combination + (N=15) + —————————————————————————————————————————————————————————————————————————————————————————— + Responders 11 (73.3%) + 95% CI (Wald, without correction) (51.0, 95.7) + Unstratified Analysis + Difference in Response rate (%) 6.7 + 95% CI (Wald, without correction) (-26.0, 39.4) + p-value (Fisher's Exact Test) 1.0000 + Odds Ratio (95% CI) 1.37 (0.29 - 6.60) + Stratified Analysis + Difference in Response rate (%) 9.2 + 95% CI (CMH, Sato variance estimator) (-25.7, 44.1) + p-value (Cochran-Mantel-Haenszel Test with Sato Variance Estimator) 0.6045 + Odds Ratio (95% CI) 1.37 (0.29 - 6.60) + Complete Response (CR) 7 (46.7%) + 95% CI (Wald, without correction) (21.42, 71.91) + Partial Response (PR) 4 (26.7%) + 95% CI (Wald, without correction) (4.29, 49.05) + Stable Disease (SD) 4 (26.7%) + 95% CI (Wald, without correction) (4.29, 49.05) # rspt01 works if change confidence interval diff --git a/tests/testthat/test-rspt01.R b/tests/testthat/test-rspt01.R index 81ac7f1f2..f1e03fe4a 100644 --- a/tests/testthat/test-rspt01.R +++ b/tests/testthat/test-rspt01.R @@ -89,7 +89,6 @@ test_that("rspt01 works if change reference group", { test_that("rspt01 works if change statistic methods", { skip_on_os("windows") - skip_on_cran() filter_data <- dunlin::log_filter(syn_data, PARAMCD == "BESRSPI", "adrs") res <- expect_silent(run(rspt01, filter_data, dataset = "adrs", @@ -105,13 +104,13 @@ test_that("rspt01 works if change statistic methods", { dataset = "adrs", odds_ratio = TRUE, perform_analysis = c("unstrat", "strat"), - strata = c("STRATA1", "STRATA2"), + strata = c("STRATA2"), methods = list( prop_conf_method = "wald", diff_conf_method = "wald", - strat_diff_conf_method = "ha", + strat_diff_conf_method = "cmh_sato", diff_pval_method = "fisher", - strat_diff_pval_method = "schouten" + strat_diff_pval_method = "cmh_sato" ) )) expect_snapshot(cat(export_as_txt(res, lpp = 100))) diff --git a/vignettes/chevron_catalog.rmd b/vignettes/chevron_catalog.rmd index e00faf636..885f14b76 100644 --- a/vignettes/chevron_catalog.rmd +++ b/vignettes/chevron_catalog.rmd @@ -946,7 +946,7 @@ run(rspt01, proc_data, perform_analysis = "strat", strata = c("STRATA1", "STRATA #### **5. Best Overall Response (modifying analysis details like type of confidence interval, alpha level, test for p-value)** 1) The level of the confidence intervals is defined by the argument `conf_level`. -2) The methods to construct confidence interval and p-value are controlled by the argument `methods`. It is a named list with five optional sub-arguments. For example, `methods = list(prop_conf_method = "wald", diff_conf_method = "wald", strat_diff_conf_method = "ha", diff_pval_method = "fisher", strat_diff_pval_method = "schouten")` +2) The methods to construct confidence interval and p-value are controlled by the argument `methods`. It is a named list with five optional sub-arguments. For example, `methods = list(prop_conf_method = "wald", diff_conf_method = "wald", strat_diff_conf_method = "cmh_sato", diff_pval_method = "fisher", strat_diff_pval_method = "cmh_sato")` See table below for what each argument controls and the available method options: @@ -955,8 +955,8 @@ See table below for what each argument controls and the available method options | `prop_conf_method` | proportion confidence interval | `"waldcc"` (default), `"wald"`, etc. | | `diff_conf_method` | unstratified difference confidence interval | `"waldcc"` (default), `"wald"`, etc. | | `diff_pval_method` | unstratified p-value for odds ratio | `"chisq"` (default), `"fisher"` | -| `strat_diff_conf_method` | stratified difference confidence interval | `"cmh"` (default), `"ha"` | -| `strat_diff_pval_method` | stratified p-value for odds ratio | `"cmh"` (default), `"schouten"` | +| `strat_diff_conf_method` | stratified difference confidence interval | `"cmh"` (default), `"cmh_sato"`, `"cmh_mn"`, `"strat_newcombe"`, `"strat_newcombecc"` | +| `strat_diff_pval_method` | stratified p-value for odds ratio | `"cmh"` (default), `"cmh_sato"`, `"cmh_wh"` | See in the table below the method options for estimates of proportions and the associated statistical methods: