From b329c0b1917257e89bf74377c00e3767834a8ddf Mon Sep 17 00:00:00 2001 From: Audrey Yeo Date: Sat, 17 Oct 2026 19:08:58 +0200 Subject: [PATCH 1/7] remove warning and delete vignette --- DESCRIPTION | 2 +- NAMESPACE | 52 ++++++++++++++++++-------------- R/dbetabinom.R | 7 ----- man/Phase1b-package.Rd | 1 + man/plotDecision.Rd | 2 +- man/plotOc.Rd | 2 +- man/sumBetaDiff.Rd | 11 +++++++ tests/testthat/test-dbetabinom.R | 14 ++++----- vignettes/test.Rmd | 35 --------------------- 9 files changed, 50 insertions(+), 76 deletions(-) delete mode 100644 vignettes/test.Rmd diff --git a/DESCRIPTION b/DESCRIPTION index aba92d1e..36392e3f 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -53,7 +53,6 @@ Language: en-US LazyData: true Roxygen: list(markdown = TRUE, packages = "roxytypes") -RoxygenNote: 7.3.3 Config/Needs/documentation: roxytypes Remotes: @@ -86,3 +85,4 @@ Collate: 'sumBetaDiff.R' 'sumTable.R' Config/testthat/edition: 3 +Config/roxygen2/version: 8.1.1 diff --git a/NAMESPACE b/NAMESPACE index 1253a03a..025ee2d7 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -32,28 +32,34 @@ export(runShinyPhase1b) export(sumBetaDiff) export(sumTable) import(checkmate) -importFrom(ggplot2,annotate) -importFrom(ggplot2,geom_area) -importFrom(ggplot2,geom_bar) -importFrom(ggplot2,geom_line) -importFrom(ggplot2,ggtitle) -importFrom(ggplot2,theme_light) -importFrom(ggplot2,xlab) -importFrom(ggplot2,ylab) -importFrom(graphics,abline) -importFrom(graphics,axis) -importFrom(graphics,hist) -importFrom(graphics,lines) -importFrom(graphics,plot) -importFrom(graphics,polygon) +importFrom(ggplot2, + annotate, + geom_area, + geom_bar, + geom_line, + ggtitle, + theme_light, + xlab, + ylab +) +importFrom(graphics, + abline, + axis, + hist, + lines, + plot, + polygon +) importFrom(lifecycle,deprecated) -importFrom(stats,acf) -importFrom(stats,binom.test) -importFrom(stats,dbeta) -importFrom(stats,dbinom) -importFrom(stats,integrate) -importFrom(stats,optimize) -importFrom(stats,pbeta) -importFrom(stats,rbinom) -importFrom(stats,uniroot) +importFrom(stats, + acf, + binom.test, + dbeta, + dbinom, + integrate, + optimize, + pbeta, + rbinom, + uniroot +) importFrom(tibble,remove_rownames) diff --git a/R/dbetabinom.R b/R/dbetabinom.R index 840631b0..411dee23 100644 --- a/R/dbetabinom.R +++ b/R/dbetabinom.R @@ -90,13 +90,6 @@ h_getBetamixPost <- function(x, n, par, weights) { finite = TRUE ) assert_true(all(weights >= 0)) - # Correcting weights that do not sum to 1 - if (sum(weights) != 1) { - warning("Weights have been corrected. Advise to review allocated weights") - # We renormalize weights. - weights <- weights / sum(weights) - } - # We now compute updated parameters. postPar <- par postPar[, 1] <- postPar[, 1] + x diff --git a/man/Phase1b-package.Rd b/man/Phase1b-package.Rd index b31c037f..755383b6 100644 --- a/man/Phase1b-package.Rd +++ b/man/Phase1b-package.Rd @@ -23,6 +23,7 @@ Useful links: Authors: \itemize{ + \item Daniel Sabanes Bove \email{daniel@rconis.com} \item Markus Elze \email{markus.elze@roche.com} \item Tony Pourmohamad \email{pourmoht@gene.com} \item Jiawen Zhu \email{zhu.jiawen@gene.com} diff --git a/man/plotDecision.Rd b/man/plotDecision.Rd index 434cee7a..c63149eb 100644 --- a/man/plotDecision.Rd +++ b/man/plotDecision.Rd @@ -14,7 +14,7 @@ plotDecision(data, efficacious_prob, futile_prob) \item{futile_prob}{(\code{number}):\cr a cut off for the probability of a poor improvement} } \value{ -\code{\link[ggplot2:ggplot]{ggplot2::ggplot()}} object +\code{\link[ggplot2:ggplot]{ggplot()}} object } \description{ This function will return a plot showing a curve of the probability of a meaningful improvement over estimated diff diff --git a/man/plotOc.Rd b/man/plotOc.Rd index 526944c4..0cedde4b 100644 --- a/man/plotOc.Rd +++ b/man/plotOc.Rd @@ -17,7 +17,7 @@ Different to \code{all_sizes} which is after the adjustment, if made.} \item{wiggle_status}{(\code{flag}):\cr from \code{wiggle} flag in object.} } \value{ -\code{\link[ggplot2:ggplot]{ggplot2::ggplot()}} object +\code{\link[ggplot2:ggplot]{ggplot()}} object } \description{ Plots results from simulated results of : diff --git a/man/sumBetaDiff.Rd b/man/sumBetaDiff.Rd index 5cc1ae5e..130dde7c 100644 --- a/man/sumBetaDiff.Rd +++ b/man/sumBetaDiff.Rd @@ -27,3 +27,14 @@ along with the \code{go} and \code{stop} probabilities. A function to summarize the characters of a betadiff distribution \code{\link[=dbetadiff]{dbetadiff()}}. May require use of random sample generator to calculate, use \code{\link[=set.seed]{set.seed()}} to reproduce results. } +\examples{ +parX <- c(1, 52) # Control group's parameters +parY <- c(5.5, 20.5) # Treatment group's parameters +sumBetaDiff( + parX = parX, + parY = parY, + ci_level = 0.9, + go_cut = 0.6, + stop_cut = 0.2 +) +} diff --git a/tests/testthat/test-dbetabinom.R b/tests/testthat/test-dbetabinom.R index 60b3e547..15fa51b0 100644 --- a/tests/testthat/test-dbetabinom.R +++ b/tests/testthat/test-dbetabinom.R @@ -257,15 +257,16 @@ test_that("h_getBetamixPost gives the correct beta-mixture parameters", { }) test_that("h_getBetamixPost gives weight of 1 for a single beta distribution", { - expect_warning( + # expect_warning( results <- h_getBetamixPost( x = 16, n = 23, par = rbind(c(1, 2)), weights = 0.1 - ), - "Weights have been corrected" - ) + ) + # , + # "Weights have been corrected" + # ) expected <- list( par = rbind(c(17, 9)), weights = 1 @@ -285,15 +286,12 @@ test_that("h_getBetamixPost gives correct weights with 2 beta-mixture component" }) test_that("h_getBetamixPost gives the correct weights when sum of weights is not 1 in beta-mixture", { - expect_warning( result <- h_getBetamixPost( x = 16, n = 23, par = rbind(c(1, 2), c(3, 4), c(10, 10)), weights = c(0.6, 0.4, 0.5) - ), - "Weights have been corrected" - ) + ) expect_equal( result$weights, c(.2776991, 0.2683337, 0.4539671), diff --git a/vignettes/test.Rmd b/vignettes/test.Rmd deleted file mode 100644 index d5b056d6..00000000 --- a/vignettes/test.Rmd +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: "test" -package: phase1b -bibliography: '`r system.file("REFERENCES.bib", package = "phase1b")`' -author: - - name: Daniel Sabanes Bove - email: daniel.sabanes_bove@roche.com -output: - bookdown::html_document2: - theme: "spacelab" - highlight: "kate" - toc: true - toc_float: true -vignette: | - %\VignetteEncoding{UTF-8} - %\VignetteIndexEntry{test} - %\VignetteEngine{knitr::rmarkdown} -editor_options: - chunk_output_type: console ---- - -```{r, include = FALSE} -knitr::opts_chunk$set( - collapse = TRUE, - comment = "#>" -) -``` - -```{r, echo = FALSE} -cap <- "blo" -``` - -```{r bla, echo=FALSE, fig.cap = cap} -plot(cars) -``` From 10eb3b417a4779c159633fafb397132a106dce79 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 17 Oct 2026 17:16:20 +0000 Subject: [PATCH 2/7] [skip style] [skip vbump] Restyle files --- tests/testthat/test-dbetabinom.R | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/testthat/test-dbetabinom.R b/tests/testthat/test-dbetabinom.R index 15fa51b0..0a634fa2 100644 --- a/tests/testthat/test-dbetabinom.R +++ b/tests/testthat/test-dbetabinom.R @@ -258,14 +258,14 @@ test_that("h_getBetamixPost gives the correct beta-mixture parameters", { test_that("h_getBetamixPost gives weight of 1 for a single beta distribution", { # expect_warning( - results <- h_getBetamixPost( - x = 16, - n = 23, - par = rbind(c(1, 2)), - weights = 0.1 - ) - # , - # "Weights have been corrected" + results <- h_getBetamixPost( + x = 16, + n = 23, + par = rbind(c(1, 2)), + weights = 0.1 + ) + # , + # "Weights have been corrected" # ) expected <- list( par = rbind(c(17, 9)), @@ -286,12 +286,12 @@ test_that("h_getBetamixPost gives correct weights with 2 beta-mixture component" }) test_that("h_getBetamixPost gives the correct weights when sum of weights is not 1 in beta-mixture", { - result <- h_getBetamixPost( - x = 16, - n = 23, - par = rbind(c(1, 2), c(3, 4), c(10, 10)), - weights = c(0.6, 0.4, 0.5) - ) + result <- h_getBetamixPost( + x = 16, + n = 23, + par = rbind(c(1, 2), c(3, 4), c(10, 10)), + weights = c(0.6, 0.4, 0.5) + ) expect_equal( result$weights, c(.2776991, 0.2683337, 0.4539671), From 6db63cc07f657916d0a646047fe79cbd24a39325 Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Sat, 17 Oct 2026 17:18:06 +0000 Subject: [PATCH 3/7] [skip roxygen] [skip vbump] Roxygen Man Pages Auto Update --- man/sumBetaDiff.Rd | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/man/sumBetaDiff.Rd b/man/sumBetaDiff.Rd index 130dde7c..5cc1ae5e 100644 --- a/man/sumBetaDiff.Rd +++ b/man/sumBetaDiff.Rd @@ -27,14 +27,3 @@ along with the \code{go} and \code{stop} probabilities. A function to summarize the characters of a betadiff distribution \code{\link[=dbetadiff]{dbetadiff()}}. May require use of random sample generator to calculate, use \code{\link[=set.seed]{set.seed()}} to reproduce results. } -\examples{ -parX <- c(1, 52) # Control group's parameters -parY <- c(5.5, 20.5) # Treatment group's parameters -sumBetaDiff( - parX = parX, - parY = parY, - ci_level = 0.9, - go_cut = 0.6, - stop_cut = 0.2 -) -} From b3a60df644aa8f1b587e6604e8e0e0f2a14c6c6a Mon Sep 17 00:00:00 2001 From: Audrey Yeo Date: Sat, 17 Oct 2026 21:04:15 +0200 Subject: [PATCH 4/7] R CMD checks error --- tests/testthat/test-dbetabinom.R | 4 ---- tests/testthat/test-predprob.R | 28 ---------------------------- 2 files changed, 32 deletions(-) diff --git a/tests/testthat/test-dbetabinom.R b/tests/testthat/test-dbetabinom.R index 0a634fa2..ff7eb9e6 100644 --- a/tests/testthat/test-dbetabinom.R +++ b/tests/testthat/test-dbetabinom.R @@ -257,16 +257,12 @@ test_that("h_getBetamixPost gives the correct beta-mixture parameters", { }) test_that("h_getBetamixPost gives weight of 1 for a single beta distribution", { - # expect_warning( results <- h_getBetamixPost( x = 16, n = 23, par = rbind(c(1, 2)), weights = 0.1 ) - # , - # "Weights have been corrected" - # ) expected <- list( par = rbind(c(17, 9)), weights = 1 diff --git a/tests/testthat/test-predprob.R b/tests/testthat/test-predprob.R index 6137a9dd..fd6bb744 100644 --- a/tests/testthat/test-predprob.R +++ b/tests/testthat/test-predprob.R @@ -118,34 +118,6 @@ test_that("predprob gives an error when x exceeds interim n", { ) }) -test_that("Warning length equal to length of x", { - captured_warnings <- capture_warnings({ - result <- predprob( - x = 16, - n = 20, - Nmax = 22, - p = 0.6, - thetaT = 0.9, - parE = rbind(c(1, 1), c(25, 15)), - weights = c(3, 1) - ) - }) - expected <- data.frame( - counts = 0:2, - cumul_counts = c(20, 21, 22), - density = c(0.0738, 0.3651, 0.5611), - posterior = c(0.862329474749815, 0.928990451842824, 0.969938389163636), - success = c(FALSE, TRUE, TRUE) - ) - expect_equal( - length(captured_warnings), - 4, - info = "Should have generated one warning for each element in 'x' in the loop." - ) - expect_equal(result$result, 0.9262315, tolerance = 1e-4) - expect_equal(result$table, expected, tolerance = 1e-4) -}) - test_that("predprob gives an error when Nmax is less than n", { expect_error( predprob( From 1d433b97c2a81cc5c5acc28d6ebe403f60d08dc3 Mon Sep 17 00:00:00 2001 From: Audrey Yeo Date: Sun, 18 Oct 2026 12:32:28 +0200 Subject: [PATCH 5/7] Rerun R CMD check From f87b7c6f35c45a6ab8c73ada4da5cdd4e8645292 Mon Sep 17 00:00:00 2001 From: Audrey Yeo Date: Sun, 18 Oct 2026 13:06:46 +0200 Subject: [PATCH 6/7] clean --- ...Plot-of-plotBetaDiff-with-beta-mixture.svg | 114 +++++++----------- ...t-of-plotBetaDiff-without-beta-mixture.svg | 103 +++++++--------- ...d-respective-Go-and-Stop-probabilities.svg | 64 +++++----- vignettes/introduction.Rmd | 2 +- 4 files changed, 121 insertions(+), 162 deletions(-) diff --git a/tests/testthat/_snaps/plotBetaDiff/Plot-of-plotBetaDiff-with-beta-mixture.svg b/tests/testthat/_snaps/plotBetaDiff/Plot-of-plotBetaDiff-with-beta-mixture.svg index b6d75bda..19eb0a37 100644 --- a/tests/testthat/_snaps/plotBetaDiff/Plot-of-plotBetaDiff-with-beta-mixture.svg +++ b/tests/testthat/_snaps/plotBetaDiff/Plot-of-plotBetaDiff-with-beta-mixture.svg @@ -1,5 +1,5 @@ - + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - -P(Stop) is 11.72 % -P(Go) is 10.12 % + + + + + + + +P(Stop) is 11.72 % +P(Go) is 10.12 % + - -0 -1 -2 -3 -4 -5 - - - - - - - - - - - --1.0 --0.5 -0.0 -0.5 -1.0 -Difference between treatment -f -( -x -) -According to Beta difference density P(Go) is 10.12 % and P(Stop) is 11.72 % + +0 +1 +2 +3 +4 +5 + + + + + + + + + + + +-1.0 +-0.5 +0.0 +0.5 +1.0 +Difference between treatment +f +( +x +) +According to Beta difference density P(Go) is 10.12 % and P(Stop) is 11.72 % diff --git a/tests/testthat/_snaps/plotBetaDiff/Plot-of-plotBetaDiff-without-beta-mixture.svg b/tests/testthat/_snaps/plotBetaDiff/Plot-of-plotBetaDiff-without-beta-mixture.svg index 4328b13e..a7ac4be9 100644 --- a/tests/testthat/_snaps/plotBetaDiff/Plot-of-plotBetaDiff-without-beta-mixture.svg +++ b/tests/testthat/_snaps/plotBetaDiff/Plot-of-plotBetaDiff-without-beta-mixture.svg @@ -1,5 +1,5 @@ - + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - -P(Stop) is 59.49 % -P(Go) is 24.5 % + + + + + + + +P(Stop) is 59.49 % +P(Go) is 24.5 % + - -0 -1 -2 -3 - - - - - - - - - --1.0 --0.5 -0.0 -0.5 -1.0 -Difference between treatment -f -( -x -) -According to Beta difference density P(Go) is 24.5 % and P(Stop) is 59.49 % + +0 +1 +2 +3 + + + + + + + + + +-1.0 +-0.5 +0.0 +0.5 +1.0 +Difference between treatment +f +( +x +) +According to Beta difference density P(Go) is 24.5 % and P(Stop) is 59.49 % diff --git a/tests/testthat/_snaps/plotDecision/plot-of-Probability-of-Difference-and-respective-Go-and-Stop-probabilities.svg b/tests/testthat/_snaps/plotDecision/plot-of-Probability-of-Difference-and-respective-Go-and-Stop-probabilities.svg index ec7af51f..e64ca08c 100644 --- a/tests/testthat/_snaps/plotDecision/plot-of-Probability-of-Difference-and-respective-Go-and-Stop-probabilities.svg +++ b/tests/testthat/_snaps/plotDecision/plot-of-Probability-of-Difference-and-respective-Go-and-Stop-probabilities.svg @@ -32,30 +32,30 @@ - - - - - - + + + + + + - - - - - - - - - - - - -Probability of Go is 60% when difference is at least 21.18% -Probability of Stop is 60% when difference is at most 1.02% + + + + + + + + + + + + +Probability of Go is 60% when difference is at least 21.18% +Probability of Stop is 60% when difference is at most 1.02% @@ -67,18 +67,18 @@ - - - - - - -0 -5 -10 -15 -20 -25 + + + + + + +0 +5 +10 +15 +20 +25 Difference between treatment in Response Rate (%) Probability (%) Probability of Difference and respective Go and Stop probabilities. diff --git a/vignettes/introduction.Rmd b/vignettes/introduction.Rmd index 06e7d793..45231548 100644 --- a/vignettes/introduction.Rmd +++ b/vignettes/introduction.Rmd @@ -172,7 +172,7 @@ help(package = "phase1b") A list of functions will be displayed and you can learn more about each function, and see examples of its use, by clicking on its corresponding link. -Note that this will easiest work in [R-Studio](https://posit.co/download/rstudio-desktop/), which +Note that this will easiest work in [R-Studio](https://docs.posit.co/ide/user/#rstudio-ide-oss-downloads?ref=rstudio-legacy), which is the recommended software for editing and using R. # Methods and Models {#methods} From b3c94f16278b9764adad5ac2554d3770dcb7749d Mon Sep 17 00:00:00 2001 From: Audrey Yeo Date: Sun, 18 Oct 2026 17:20:59 +0200 Subject: [PATCH 7/7] Rerun R CMD check