From a3a38ca094bfb4c4fe8ef9a29a1224c88094d3be Mon Sep 17 00:00:00 2001 From: Melkiades Date: Tue, 23 Jul 2024 18:18:44 +0200 Subject: [PATCH] final fix? --- book/tables/efficacy/rbmit01.qmd | 9 +++-- .../_snaps/development/tables-ADA-adat01.md | 32 ++++++++--------- .../development/tables-efficacy-rbmit01.md | 36 +++++++++---------- .../_snaps/stable/tables-efficacy-rbmit01.md | 36 +++++++++---------- package/tests/testthat/setup.R | 18 +++++++--- 5 files changed, 71 insertions(+), 60 deletions(-) diff --git a/book/tables/efficacy/rbmit01.qmd b/book/tables/efficacy/rbmit01.qmd index 10de92de4b..5f8fbad8ed 100644 --- a/book/tables/efficacy/rbmit01.qmd +++ b/book/tables/efficacy/rbmit01.qmd @@ -7,7 +7,7 @@ subtitle: Tables for RBMI {{< include ../../_utils/envir_hook.qmd >}} -:::: {.panel-tabset} +::: panel-tabset ## Data Setup We use a publicly available example dataset from an antidepressant clinical trial of an active drug versus placebo from the `rbmi` package. @@ -117,10 +117,11 @@ draws_vars$subjid <- "TMP_ID" Define which imputation method to use, then create samples for the imputation parameters by running the `draws()` function. + ```{r, warning = FALSE, opts.label = "skip_test_strict"} #| code-fold: show -draws_method <- method_bayes() +draws_method <- method_bayes(seed = 123) draws_obj <- rbmi::draws( data = data_full, @@ -154,6 +155,7 @@ The next step is to run the analysis model on each imputed dataset. This is done by defining an analysis function and then calling `rbmi::analyse()` to apply this function to each imputed dataset. + ```{r, opts.label = "skip_test_strict"} #| code-fold: show #| opts_label: "skip_test_strict" # @@ -183,6 +185,7 @@ The `rbmi::pool()` function can be used to summarize the analysis results across Using the `broom::tidy()` function the `rbmi` final results are reshaped. + ```{r, opts.label = "skip_test_strict"} #| code-fold: show @@ -215,5 +218,5 @@ result {{< include ../../_utils/save_results.qmd >}} {{< include ../../repro.qmd >}} +::: -:::: diff --git a/package/tests/testthat/_snaps/development/tables-ADA-adat01.md b/package/tests/testthat/_snaps/development/tables-ADA-adat01.md index 018f83d50d..55baa454a9 100644 --- a/package/tests/testthat/_snaps/development/tables-ADA-adat01.md +++ b/package/tests/testthat/_snaps/development/tables-ADA-adat01.md @@ -5,22 +5,22 @@ Output Baseline Prevalence and Incidence of Treatment Emergent ADA - ————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - A: Drug X C: Combination B: Placebo All Drug X - (N=134) (N=132) (N=0) (N=134) (N=266) - ————————————————————————————————————————————————————————————————————————————————————————————————————————————————— - Baseline Prevalence of ADAs - Baseline evaluable patients 134 132 0 0 266 - Patient with a positive sample at baseline 63 (47.0%) 64 (48.5%) 0 0 127 (47.7%) - Patient with no positive samples at baseline 71 68 0 0 139 - Incidence of Treatment Emergent ADAs - Post-baseline evaluable patients 134 132 0 0 266 - Patient positive for Treatment Emergent ADA 0 0 0 0 0 - Treatment-induced ADA 0 0 0 0 0 - Treatment-enhanced ADA 0 0 0 0 0 - Patient negative for Treatment Emergent ADA 0 0 0 0 0 - Treatment unaffected 0 0 0 0 0 - ————————————————————————————————————————————————————————————————————————————————————————————————————————————————— + ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————— + A: Drug X C: Combination B: Placebo All Drug X + (N=134) (N=132) (N=0) (N=134) (N=266) + ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————— + Baseline Prevalence of ADAs + Baseline evaluable patients 134 132 0 0 266 + Patient with a positive sample at baseline 63 (47.0%) 64 (48.5%) 0 0 127 (47.7%) + Patient with no positive samples at baseline 71 68 0 0 139 + Incidence of Treatment Emergent ADAs + Post-baseline evaluable patients 134 132 0 0 266 + Patient positive for Treatment Emergent ADA 0 0 0 0 0 + Treatment-induced ADA 0 0 0 0 0 + Treatment-enhanced ADA 0 0 0 0 0 + Patient negative for Treatment Emergent ADA 0 0 0 0 0 + Treatment unaffected 0 0 0 0 0 + ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————— ADA = Anti-Drug Antibodies (is also referred to as ATA, or Anti-Therapeutic Antibodies) Baseline evaluable patient = a patient with an ADA assay result from a baseline sample(s) Post-baseline evaluable patient = a patient with an ADA assay result from at least one post-baseline sample Number of patients positive for Treatment Emergent diff --git a/package/tests/testthat/_snaps/development/tables-efficacy-rbmit01.md b/package/tests/testthat/_snaps/development/tables-efficacy-rbmit01.md index 25adeb5cfb..c7f3670607 100644 --- a/package/tests/testthat/_snaps/development/tables-efficacy-rbmit01.md +++ b/package/tests/testthat/_snaps/development/tables-efficacy-rbmit01.md @@ -13,24 +13,24 @@ Relative Reduction (%) 5.7% p-value (RBMI) 0.8932 5 - Adjusted Mean (SE) -4.257 (0.652) -2.813 (0.642) - 95% CI (-5.544, -2.970) (-4.080, -1.545) - Difference in Adjusted Means (SE) 1.444 (0.918) - 95% CI (-0.370, 3.258) - Relative Reduction (%) -33.9% - p-value (RBMI) 0.1178 + Adjusted Mean (SE) -4.255 (0.653) -2.857 (0.634) + 95% CI (-5.546, -2.965) (-4.109, -1.605) + Difference in Adjusted Means (SE) 1.398 (0.915) + 95% CI (-0.409, 3.205) + Relative Reduction (%) -32.9% + p-value (RBMI) 0.1285 6 - Adjusted Mean (SE) -6.357 (0.710) -4.104 (0.690) - 95% CI (-7.761, -4.953) (-5.469, -2.740) - Difference in Adjusted Means (SE) 2.253 (0.997) - 95% CI (0.283, 4.222) - Relative Reduction (%) -35.4% - p-value (RBMI) 0.0253 + Adjusted Mean (SE) -6.413 (0.712) -4.166 (0.692) + 95% CI (-7.821, -5.005) (-5.533, -2.800) + Difference in Adjusted Means (SE) 2.246 (1.005) + 95% CI (0.260, 4.232) + Relative Reduction (%) -35.0% + p-value (RBMI) 0.0269 7 - Adjusted Mean (SE) -7.625 (0.820) -4.794 (0.762) - 95% CI (-9.250, -6.000) (-6.302, -3.287) - Difference in Adjusted Means (SE) 2.831 (1.104) - 95% CI (0.647, 5.014) - Relative Reduction (%) -37.1% - p-value (RBMI) 0.0115 + Adjusted Mean (SE) -7.652 (0.775) -4.939 (0.771) + 95% CI (-9.185, -6.120) (-6.465, -3.414) + Difference in Adjusted Means (SE) 2.713 (1.099) + 95% CI (0.538, 4.888) + Relative Reduction (%) -35.5% + p-value (RBMI) 0.0149 diff --git a/package/tests/testthat/_snaps/stable/tables-efficacy-rbmit01.md b/package/tests/testthat/_snaps/stable/tables-efficacy-rbmit01.md index 17e263d0b4..db0aac273b 100644 --- a/package/tests/testthat/_snaps/stable/tables-efficacy-rbmit01.md +++ b/package/tests/testthat/_snaps/stable/tables-efficacy-rbmit01.md @@ -13,24 +13,24 @@ Relative Reduction (%) 5.7% p-value (RBMI) 0.8932 5 - Adjusted Mean (SE) -4.249 (0.654) -2.813 (0.651) - 95% CI (-5.540, -2.957) (-4.100, -1.526) - Difference in Adjusted Means (SE) 1.436 (0.922) - 95% CI (-0.385, 3.256) - Relative Reduction (%) -33.8% - p-value (RBMI) 0.1213 + Adjusted Mean (SE) -4.255 (0.653) -2.857 (0.634) + 95% CI (-5.546, -2.965) (-4.109, -1.605) + Difference in Adjusted Means (SE) 1.398 (0.915) + 95% CI (-0.409, 3.205) + Relative Reduction (%) -32.9% + p-value (RBMI) 0.1285 6 - Adjusted Mean (SE) -6.392 (0.705) -4.143 (0.690) - 95% CI (-7.785, -4.999) (-5.506, -2.780) - Difference in Adjusted Means (SE) 2.249 (0.986) - 95% CI (0.301, 4.197) - Relative Reduction (%) -35.2% - p-value (RBMI) 0.0240 + Adjusted Mean (SE) -6.413 (0.712) -4.166 (0.692) + 95% CI (-7.821, -5.005) (-5.533, -2.800) + Difference in Adjusted Means (SE) 2.246 (1.005) + 95% CI (0.260, 4.232) + Relative Reduction (%) -35.0% + p-value (RBMI) 0.0269 7 - Adjusted Mean (SE) -7.659 (0.800) -4.833 (0.754) - 95% CI (-9.242, -6.076) (-6.324, -3.342) - Difference in Adjusted Means (SE) 2.826 (1.097) - 95% CI (0.657, 4.996) - Relative Reduction (%) -36.9% - p-value (RBMI) 0.0111 + Adjusted Mean (SE) -7.652 (0.775) -4.939 (0.771) + 95% CI (-9.185, -6.120) (-6.465, -3.414) + Difference in Adjusted Means (SE) 2.713 (1.099) + 95% CI (0.538, 4.888) + Relative Reduction (%) -35.5% + p-value (RBMI) 0.0149 diff --git a/package/tests/testthat/setup.R b/package/tests/testthat/setup.R index a4d90e8493..1248826f75 100644 --- a/package/tests/testthat/setup.R +++ b/package/tests/testthat/setup.R @@ -3,16 +3,24 @@ test_book_path <- testthat::test_path("_book") test_data_path <- testthat::test_path("_data") Sys.setenv("QUARTO_TESTTHAT_DATA_PATH" = normalizePath(test_data_path)) -# flags for developers +# Flags for developers # use it if you want to disable render of book or render individual articles instead # for the latter: # (i) set if_render_book to FALSE # (ii) set if_render_article to TRUE # (iii) assure proper value of `test_profile` ("development" or "stable") -# (iv) run `devtools::test(filter = "test-")` -if_render_book <- TRUE -if_render_articles <- FALSE -if_test_plots <- TRUE # Additional option for optional skip of local plot tests +# (iv) run `devtools::test(filter = "")` +if_render_book <- TRUE # Remember to change this to FALSE if you want to render articles (otherwise loop) +if_render_articles <- !if_render_book +if_test_plots <- FALSE # Additional option for optional skip of local plot tests +# Example for render articles (NOTE: KEEP THESE COMMENTED WHEN RUNNING!!): +# setwd("package") +# Sys.setenv("QUARTO_PROFILE" = "development") +# devtools::test(filter = "tables-efficacy-rbmit01") +# devtools::test(filter = "tables-ADA-adat01") +# if the snapshot changed only an error will be printed and you need to update the snapshot +# testthat::snapshot_accept('development/tables-efficacy-rbmit01') + if (isTRUE(if_render_book) && isTRUE(if_render_articles)) { stop("Render both book and articles at the same time is not efficient! Please set one of them to FALSE.")