diff --git a/DESCRIPTION b/DESCRIPTION index 4e4d6be..a11b10a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -8,8 +8,8 @@ Description: Tool-set to support Bayesian evidence synthesis. This for details on applying this package while Neuenschwander et al. (2010) and Schmidli et al. (2014) explain details on the methodology. -Version: 1.8-0 -Date: 2025-01-08 +Version: 1.8-1 +Date: 2025-01-20 Authors@R: c(person("Novartis", "Pharma AG", role = "cph") ,person("Sebastian", "Weber", email="sebastian.weber@novartis.com", role=c("aut", "cre")) ,person("Beat", "Neuenschwander", email="beat.neuenschwander@novartis.com", role="ctb") @@ -17,6 +17,7 @@ Authors@R: c(person("Novartis", "Pharma AG", role = "cph") ,person("Baldur", "Magnusson", email="baldur.magnusson@novartis.com", role="ctb") ,person("Yue", "Li", email="yue-1.li@novartis.com", role="ctb") ,person("Satrajit", "Roychoudhury", email="satrajit.roychoudhury@novartis.com", role="ctb") + ,person("Lukas A.", "Widmer", email="lukas_andreas.widmer@novartis.com", role = "ctb", comment = c(ORCID = "0000-0003-1471-3493")) ,person("Trustees of", "Columbia University", role="cph", comment="R/stanmodels.R, configure, configure.win") ) Depends: @@ -71,5 +72,5 @@ Suggests: VignetteBuilder: knitr SystemRequirements: GNU make, pandoc (>= 1.12.3), pngquant, C++17 Encoding: UTF-8 -RoxygenNote: 7.3.1 +RoxygenNote: 7.3.2 Config/testthat/edition: 3 diff --git a/NEWS.md b/NEWS.md index 1e2a68e..7a17c25 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,10 @@ +# RBesT 1.8-1 - January 20th, 2025 + +## Bugfixes + +* Fixed an issue with the `ess` function for beta and gamma mixtures + when used inside of `lapply` or `sapply`. + # RBesT 1.8-0 - January 8th, 2025 ## Enhancements diff --git a/R/mixess.R b/R/mixess.R index 78ef8fd..fbb90b2 100644 --- a/R/mixess.R +++ b/R/mixess.R @@ -177,7 +177,9 @@ weighted_lir_link <- function(mix, info, fisher_inverse, link) { ess.betaMix <- function(mix, method = c("elir", "moment", "morita"), ..., s = 100) { method <- match.arg(method) - assert_that(!("family" %in% names(match.call())), msg = "Argument family is only supported for normal mixtures.") + call_arg_names <- names(match.call()) + family_arg_is_set <- "family" %in% call_arg_names + assert_that(!family_arg_is_set, msg = "Argument family is only supported for normal mixtures.") if (method == "elir") { if (!test_numeric(mix[2, ], lower = 1, finite = TRUE, any.missing = FALSE) || @@ -270,7 +272,9 @@ binomialInfo <- function(r, theta, n) { ess.gammaMix <- function(mix, method = c("elir", "moment", "morita"), ..., s = 100, eps = 1E-4) { method <- match.arg(method) - assert_that(!("family" %in% names(match.call())), msg = "Argument family is only supported for normal mixtures.") + call_arg_names <- names(match.call()) + family_arg_is_set <- "family" %in% call_arg_names + assert_that(!family_arg_is_set, msg = "Argument family is only supported for normal mixtures.") lik <- likelihood(mix) diff --git a/R/sysdata.rda b/R/sysdata.rda index c26bf63..b28e66b 100644 Binary files a/R/sysdata.rda and b/R/sysdata.rda differ diff --git a/man/RBesT-package.Rd b/man/RBesT-package.Rd index e2802a1..0016edf 100644 --- a/man/RBesT-package.Rd +++ b/man/RBesT-package.Rd @@ -77,6 +77,7 @@ Other contributors: \item Baldur Magnusson \email{baldur.magnusson@novartis.com} [contributor] \item Yue Li \email{yue-1.li@novartis.com} [contributor] \item Satrajit Roychoudhury \email{satrajit.roychoudhury@novartis.com} [contributor] + \item Lukas A. Widmer \email{lukas_andreas.widmer@novartis.com} (\href{https://orcid.org/0000-0003-1471-3493}{ORCID}) [contributor] \item Trustees of Columbia University (R/stanmodels.R, configure, configure.win) [copyright holder] } diff --git a/tests/testthat/test-utils.R b/tests/testthat/test-utils.R index 493b963..6d89458 100644 --- a/tests/testthat/test-utils.R +++ b/tests/testthat/test-utils.R @@ -183,6 +183,10 @@ test_that("moment matching for beta mixtures is correct", { expect_equal(ess(bmix, method = "moment"), sum(ab_matched)) }) +test_that("beta mix ess works when run through sapply", { + expect_numeric(sapply(X = list(bmix), FUN=ess)) +}) + test_that("normal mixtures have reference scale used correctly", { nmix_sigma_small <- nmix nmix_sigma_large <- nmix @@ -223,6 +227,9 @@ test_that("gamma mixtures have likelihood property respected", { expect_true(e1r != e2r) }) +test_that("gamma mix ess works when run through sapply", { + expect_numeric(sapply(X = list(gmix), FUN=ess)) +}) test_that("gamma 1-component density gives canonical results", { guni1 <- gmix[[1, rescale = TRUE]] diff --git a/tools/make-ds.R b/tools/make-ds.R index e261788..ff852f1 100644 --- a/tools/make-ds.R +++ b/tools/make-ds.R @@ -43,7 +43,7 @@ make_internal_ds <- function() { calibration_meta["MD5"] <- vals["MD5"] pkg_create_date <- Sys.time() - pkg_sha <- "3437e3d" + pkg_sha <- "5048c0b" if (gsub("\\$", "", pkg_sha) == "Format:%h") { pkg_sha <- system("git rev-parse --short HEAD", intern=TRUE)