Skip to content

Commit

Permalink
final fix?
Browse files Browse the repository at this point in the history
  • Loading branch information
Melkiades committed Jul 23, 2024
1 parent 3602521 commit a3a38ca
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 60 deletions.
9 changes: 6 additions & 3 deletions book/tables/efficacy/rbmit01.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.

<!-- skip strict because of https://github.com/insightsengineering/rbmi/issues/409 -->

```{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,
Expand Down Expand Up @@ -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.

<!-- skip strict because of https://github.com/insightsengineering/rbmi/issues/409 -->

```{r, opts.label = "skip_test_strict"}
#| code-fold: show
#| opts_label: "skip_test_strict" #
Expand Down Expand Up @@ -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.

<!-- skip strict because of https://github.com/insightsengineering/rbmi/issues/409 -->

```{r, opts.label = "skip_test_strict"}
#| code-fold: show
Expand Down Expand Up @@ -215,5 +218,5 @@ result
{{< include ../../_utils/save_results.qmd >}}

{{< include ../../repro.qmd >}}
:::

::::
32 changes: 16 additions & 16 deletions package/tests/testthat/_snaps/development/tables-ADA-adat01.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
Output
Baseline Prevalence and Incidence of Treatment Emergent ADA
—————————————————————————————————————————————————————————————————————————————————————————————————————————————————
A: Drug X C: Combination <Missing> 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 <Missing> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

36 changes: 18 additions & 18 deletions package/tests/testthat/_snaps/stable/tables-efficacy-rbmit01.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

18 changes: 13 additions & 5 deletions package/tests/testthat/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -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-<article_name>")`
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 = "<article_name>")`
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.")
Expand Down

0 comments on commit a3a38ca

Please sign in to comment.