Skip to content

Commit d9d79ab

Browse files
committed
CRAN preparations
1 parent d575367 commit d9d79ab

15 files changed

Lines changed: 141 additions & 153 deletions

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: bhmbasket
22
Title: Bayesian Hierarchical Models for Basket Trials
3-
Version: 1.0.0
3+
Version: 1.1.0
44
Authors@R:
55
c(
66
person(given = 'Stephan',

NEWS.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# bhmbasket 1.1.0
2+
3+
### New and Altered Features
4+
5+
* Added mixture priors and models `"exnex_mix"`, `"exnex_adj_mix"`, `"stratified_mix"`.
6+
7+
* Minor changes in code
8+
19
# bhmbasket 1.0.0
210

311
### New and Altered Features

R/AnalysisFunctions.R

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -818,8 +818,8 @@ mapUniqueTrials <- function (
818818
#' \item BHM that combines above approaches: `"exnex_adj"`
819819
#' \item Pooled beta-binomial approach: `"pooled"`
820820
#' \item Stratified beta-binomial approach: `"stratified"`
821-
#' \item BHM with mixture prior on the NEX component: `"exnex_mix"`
822-
#' \item Adjusted BHM with mixture prior on the NEX component: `"exnex_adj_mix"`
821+
#' \item BHM with mixture prior on the Nex component: `"exnex_mix"`
822+
#' \item Adjusted BHM with mixture prior on the Nex component: `"exnex_adj_mix"`
823823
#' \item Stratified beta-binomial approach with mixture beta prior: `"stratified_mix"`
824824
#' }
825825
#' The posterior distributions of the BHMs are approximated with Markov chain Monte Carlo (MCMC)
@@ -847,9 +847,9 @@ mapUniqueTrials <- function (
847847
#' The JAGS code for the BHM `"exnex"` was taken from Neuenschwander et al. (2016).
848848
#' The JAGS code for the BHM `"exnex_adj"` is based on the JAGS code for `"exnex"`.
849849
#' The JAGS code for the BHM `"exnex_mix"` extends the `"exnex"` model by using
850-
#' a mixture prior for the NEX component.
850+
#' a mixture prior for the Nex component.
851851
#' The JAGS code for the BHM `"exnex_adj_mix"` extends the `"exnex_adj"` model by using
852-
#' a mixture prior for the NEX component.
852+
#' a mixture prior for the Nex component.
853853
#' @seealso
854854
#' \code{\link[bhmbasket]{simulateScenarios}}
855855
#' \code{\link[bhmbasket]{createTrial}}
@@ -1386,6 +1386,7 @@ prepareAnalysis <- function (
13861386
j_data$Nstrata <- length(prior_parameters$mu_j)
13871387
j_data$nex_mean <- prior_parameters$mu_j
13881388
j_data$nex_prec <- prior_parameters$tau_j^-2
1389+
13891390
}
13901391

13911392
## ExNex mix / ExNex Adj mix
@@ -1396,6 +1397,7 @@ prepareAnalysis <- function (
13961397
j_data$w_nex <- prior_parameters$w_nex
13971398
j_data$mean_nex <- prior_parameters$mean_nex
13981399
j_data$prec_nex <- prior_parameters$sd_nex^-2
1400+
13991401
}
14001402

14011403
## adjusted models
@@ -1423,11 +1425,12 @@ prepareAnalysis <- function (
14231425

14241426
}
14251427

1426-
return(list(
1428+
return (list(
14271429
j_parameters = j_parameters,
14281430
j_model_file = j_model_file,
14291431
j_data = j_data
14301432
))
1433+
14311434
}
14321435

14331436
#' @export

R/OCFunctions.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ getAverageNSubjects <- function (
9999
#' Possible additional parameters for the Bayesian hierarchical models are
100100
#' `c('mu', 'tau')` for `'berry'`, `'exnex'`, `'exnex_mix'`, `'exnex_adj'`,
101101
#' and `'exnex_adj_mix'`.
102-
#' The ExNex-based models can also access posterior weights
102+
#' The ExNex-based models can also access posterior weights.
103103
#' `paste0("w_", seq_len(n_cohorts))`.
104104
#' @return A named list of matrices of estimates of response rates and credible intervals.
105105
#' Estimates of bias and MSE are included for response rate estimates of simulated trials.

R/PriorFunctions.R

Lines changed: 36 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#' and `"exnex_adj"`, Default: `0.5`
1515
#' @return A list with prior parameters of class `prior_parameters_list`
1616
#' @details
17-
#' Regarding the default prior parameters for `"berry"`, `"exnex"`, and `"exnex_adj"`:
17+
#' Regarding the default prior parameters for `"berry"`, `"exnex"`, `"exnex_mix"`, `"exnex_adj"` and `"exnex_adj_mix"`:
1818
#' \itemize{
1919
#' \item `"berry"`: The mean of \eqn{\mu} is set to `0`.
2020
#' Its variance is calculated as proposed in "Robust exchangeability designs for early
@@ -29,6 +29,7 @@
2929
#' phase clinical trials with multiple strata" (Neuenschwander et al. (2016))
3030
#' with regard to `n_worth`.
3131
#' The scale parameter of \eqn{\tau} is set to `tau_scale`.
32+
#'
3233
#' For the Nex components:
3334
#' The means of \eqn{\mu_j} are set to the respective target rates.
3435
#' The variances of \eqn{\tau_j} are calculated as proposed in "Robust exchangeability designs for early
@@ -42,18 +43,19 @@
4243
#' phase clinical trials with multiple strata" (Neuenschwander et al. (2016))
4344
#' with regard to `n_worth`, see also \code{\link[bhmbasket]{getMuVar}}.
4445
#' The scale parameter of \eqn{\tau} is set to `tau_scale`.
46+
#'
4547
#' For the Nex components:
4648
#' The means of \eqn{\mu_j} are set to the `0`.
4749
#' The variances of \eqn{\tau_j} are calculated as proposed in "Robust exchangeability designs for early
4850
#' phase clinical trials with multiple strata" (Neuenschwander et al. (2016))
4951
#' with regard to `n_worth`, see also \code{\link[bhmbasket]{getMuVar}}.
5052
#' \item `"exnex_mix"`: Uses the same default Ex prior construction as `"exnex"`.
51-
#' The NEX part is specified as a one-component mixture prior with
53+
#' The Nex part default parameters are specified as a one-component mixture prior with
5254
#' `w_nex = 1`, `mean_nex = matrix(logit(target_rates), nrow = 1)`,
5355
#' and `sd_nex = matrix(sqrt(getMuVar(target_rates, 0, n_worth)), nrow = 1)`.
54-
#' This keeps the default mixture representation compatible with the mix-model interface.
56+
#' This keeps the default mixture representation compatible with the `getPriorParameter()`'s input.
5557
#' \item `"exnex_adj_mix"`: Uses the same default Ex prior construction as `"exnex_adj"`.
56-
#' The NEX part is specified as a one-component mixture prior with
58+
#' The Nex part is specified as a one-component mixture prior with
5759
#' `w_nex = 1`, `mean_nex = matrix(logit(target_rates), nrow = 1)`,
5860
#' and `sd_nex = matrix(sqrt(getMuVar(target_rates, 0, n_worth)), nrow = 1)`.
5961
#' The Ex component is centered as in `"exnex_adj"`.
@@ -64,9 +66,9 @@
6466
#' The scale parameters \eqn{\alpha_j} are set to `target_rates * n_worth`.
6567
#' The scale parameters \eqn{\beta_j} are set to `(1 - target_rates) * n_worth`.
6668
#' \item `"stratified_mix"`:
67-
#' A two-component beta mixture prior is created for each cohort.
68-
#' The first component uses
69-
#' `a_j = target_rates * n_worth` and `b_j = (1 - target_rates) * n_worth`.
69+
#' A two-component beta mixture prior is created by default for each cohort.
70+
#' The first component uses `a_j = target_rates * n_worth` and
71+
#' `b_j = (1 - target_rates) * n_worth`.
7072
#' The second component is a vague prior with `a_j = 1` and `b_j = 1`.
7173
#' The default mixture weights are `c(0.8, 0.2)`.
7274
#' }
@@ -565,34 +567,34 @@ getPriorParametersExNex <- function (
565567
#' @description This function sets prior parameters for the analysis method `"exnex"`
566568
#' for use in \code{\link[bhmbasket]{performAnalyses}}.
567569
#'
568-
#' It supports two specifications for the NEX part:
570+
#' It supports two specifications for the Nex part:
569571
#' \itemize{
570-
#' \item the standard ExNex specification with cohort-specific NEX priors via `mu_j` and `tau_j`
571-
#' \item an extended specification with a mixture prior on the NEX part via `w_nex`, `mean_nex`, and `sd_nex`
572+
#' \item the standard ExNex specification with cohort-specific Nex priors via `mu_j` and `tau_j`
573+
#' \item an extended specification with a mixture prior on the Nex part via `w_nex`, `mean_nex`, and `sd_nex`
572574
#' }
573575
#'
574576
#' @param mu_mean A numeric for the mean of \eqn{\mu}
575577
#' @param mu_sd A positive numeric for the standard deviation of \eqn{\mu}
576578
#' @param tau_scale A positive numeric for the scale parameter of \eqn{\tau}
577-
#' @param mu_j A vector of numerics for the means \eqn{\mu_j} of the standard NEX priors.
579+
#' @param mu_j A vector of numerics for the means \eqn{\mu_j} of the standard Nex priors.
578580
#' Ignored if `w_nex`, `mean_nex`, and `sd_nex` are provided.
579581
#' @param tau_j A vector of positive numerics for the standard deviations \eqn{\tau_j}
580-
#' of the standard NEX priors. Ignored if `w_nex`, `mean_nex`, and `sd_nex` are provided.
582+
#' of the standard Nex priors. Ignored if `w_nex`, `mean_nex`, and `sd_nex` are provided.
581583
#' @param w_j A numeric in `(0, 1)` for the weight of the Ex component, or a numeric vector
582584
#' of mixture weights summing to 1 if multiple Ex components are specified.
583585
#' @param w_nex An optional numeric vector of mixture weights in \eqn{[0,1]} summing to 1
584-
#' for the NEX mixture prior.
585-
#' @param mean_nex An optional numeric matrix of NEX mixture means with one row per NEX
586+
#' for the Nex mixture prior.
587+
#' @param mean_nex An optional numeric matrix of Nex mixture means with one row per Nex
586588
#' mixture component and one column per cohort.
587-
#' @param sd_nex An optional positive numeric matrix of NEX mixture standard deviations with
588-
#' one row per NEX mixture component and one column per cohort.
589+
#' @param sd_nex An optional positive numeric matrix of Nex mixture standard deviations with
590+
#' one row per Nex mixture component and one column per cohort.
589591
#'
590592
#' @return A list with prior parameters of class `prior_parameters_list`
591593
#'
592594
#' @details
593595
#' This function sets the prior parameters for the method proposed by Neuenschwander et al. (2016).
594596
#' If `w_nex`, `mean_nex`, and `sd_nex` are all `NULL`, the standard ExNex formulation is used.
595-
#' Otherwise, the NEX part is specified as a finite mixture prior.
597+
#' Otherwise, the Nex part is specified as a finite mixture prior.
596598
#'
597599
#' @author Stephan Wojciekowski
598600
#'
@@ -607,7 +609,7 @@ getPriorParametersExNex <- function (
607609
#' w_j = 0.8
608610
#' )
609611
#'
610-
#' ## ExNex with NEX mixture prior
612+
#' ## ExNex with Nex mixture prior
611613
#' prior_parameters_exnex_mix <- setPriorParametersExNex(
612614
#' mu_mean = 0,
613615
#' mu_sd = 1,
@@ -784,7 +786,7 @@ getPriorParametersExNexAdj <- function (
784786
w_j, lower = 0, upper = 1, len = 1, .var.name = error_w_j
785787
)
786788

787-
## mixed NEX validation only if mixture inputs are supplied
789+
## mixed Nex validation only if mixture inputs are supplied
788790
if (!(is.null(w_nex) && is.null(mean_nex) && is.null(sd_nex))) {
789791
checkmate::assertNumeric(
790792
w_nex, any.missing = FALSE, lower = 0, upper = 1, .var.name = error_w_nex
@@ -842,35 +844,35 @@ getPriorParametersExNexAdj <- function (
842844
#' @description This function sets prior parameters for the analysis method `"exnex_adj"`
843845
#' for use in \code{\link[bhmbasket]{performAnalyses}}.
844846
#'
845-
#' It supports two specifications for the NEX part:
847+
#' It supports two specifications for the Nex part:
846848
#' \itemize{
847-
#' \item the standard ExNex Adjusted specification with cohort-specific NEX priors via `mu_j` and `tau_j`
848-
#' \item an extended specification with a mixture prior on the NEX part via `w_nex`, `mean_nex`, and `sd_nex`
849+
#' \item the standard ExNex Adjusted specification with cohort-specific Nex priors via `mu_j` and `tau_j`
850+
#' \item an extended specification with a mixture prior on the Nex part via `w_nex`, `mean_nex`, and `sd_nex`
849851
#' }
850852
#'
851853
#' @param mu_mean [numeric] Mean of \eqn{\mu}
852854
#' @param mu_sd [numeric] Positive standard deviation of \eqn{\mu}
853855
#' @param tau_scale [numeric] Positive scale parameter of \eqn{\tau}
854-
#' @param mu_j [numeric] Vector of means \eqn{\mu_j} for the standard NEX priors.
856+
#' @param mu_j [numeric] Vector of means \eqn{\mu_j} for the standard Nex priors.
855857
#' Ignored if `w_nex`, `mean_nex`, and `sd_nex` are provided.
856858
#' @param tau_j [numeric] Vector of positive standard deviations \eqn{\tau_j}
857-
#' for the standard NEX priors. Ignored if `w_nex`, `mean_nex`, and `sd_nex` are provided.
859+
#' for the standard Nex priors. Ignored if `w_nex`, `mean_nex`, and `sd_nex` are provided.
858860
#' @param w_j [numeric] Weight of the Ex component in `(0, 1)`, or a numeric vector
859861
#' of mixture weights summing to 1 if multiple Ex components are specified.
860862
#' @param w_nex [numeric] Optional vector of mixture weights in \eqn{[0,1]} summing to 1
861-
#' for the NEX mixture prior.
862-
#' @param mean_nex [numeric] Optional matrix of NEX mixture means with one row per NEX
863+
#' for the Nex mixture prior.
864+
#' @param mean_nex [numeric] Optional matrix of Nex mixture means with one row per Nex
863865
#' mixture component and one column per cohort.
864-
#' @param sd_nex [numeric] Optional positive matrix of NEX mixture standard deviations with
865-
#' one row per NEX mixture component and one column per cohort.
866+
#' @param sd_nex [numeric] Optional positive matrix of Nex mixture standard deviations with
867+
#' one row per Nex mixture component and one column per cohort.
866868
#'
867869
#' @return A list with prior parameters of class `prior_parameters_list`
868870
#'
869871
#' @details
870872
#' This function sets prior parameters for the ExNex Adjusted method, which combines
871873
#' the approach proposed by Neuenschwander et al. (2016) and the approach proposed by
872874
#' Berry et al. (2013). If `w_nex`, `mean_nex`, and `sd_nex` are all `NULL`, the standard
873-
#' ExNex Adjusted formulation is used. Otherwise, the NEX part is specified as a finite
875+
#' ExNex Adjusted formulation is used. Otherwise, the Nex part is specified as a finite
874876
#' mixture prior.
875877
#'
876878
#' @author Stephan Wojciekowski
@@ -886,7 +888,7 @@ getPriorParametersExNexAdj <- function (
886888
#' w_j = 0.8
887889
#' )
888890
#'
889-
#' ## ExNex Adjusted with NEX mixture prior
891+
#' ## ExNex Adjusted with Nex mixture prior
890892
#' prior_parameters_exnex_adj_mix <- setPriorParametersExNexAdj(
891893
#' mu_mean = 0,
892894
#' mu_sd = 1,
@@ -1004,7 +1006,7 @@ setPriorParametersExNexAdj <- function (
10041006

10051007
} else {
10061008

1007-
## mixed NEX version
1009+
## mixed Nex version
10081010
checkmate::assertNumeric(
10091011
w_nex, any.missing = FALSE, lower = 0, upper = 1, .var.name = error_w_nex
10101012
)
@@ -1326,13 +1328,14 @@ getPriorParametersStratifiedMix <- function (
13261328
#' for use in \code{\link[bhmbasket]{performAnalyses}}.
13271329
#' @param w A numeric vector of mixture weights in \eqn{[0,1]} summing to 1.
13281330
#' @param a_j A positive numeric matrix of beta shape parameters \eqn{\alpha_j},
1329-
#' with one row per mixture component and one column per cohort.
1331+
#' with rows per mixture component and columns per cohort.
13301332
#' @param b_j A positive numeric matrix of beta shape parameters \eqn{\beta_j},
1331-
#' with one row per mixture component and one column per cohort.
1333+
#' with rows per mixture component and columns per cohort.
13321334
#' @return A list with prior parameters of class `prior_parameters_list`
13331335
#' @details
13341336
#' The method `"stratified_mix"` is a beta-binomial model that assesses each cohort
13351337
#' individually with a finite mixture beta prior.
1338+
#' See also the R package `RBesT`.
13361339
#' @author Stephan Wojciekowski
13371340
#' @examples
13381341
#' prior_parameters_stratified_mix <- setPriorParametersStratifiedMix(

cran-comments.md

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,21 @@ Maintainer: 'Stephan Wojciekowski <[email protected]
22

33
## Test environments & R CMD check results
44

5-
- Macbuilder aarch64-aarch64-apple-darwin20, macOS 26.2 (25C56), Apple M1, R 4.6.0 (r-devel-macosx-arm64), SDK 14.4 (clang-1700.6.3.2)
5+
- Macbuilder aarch64-aarch64-apple-darwin20, R Under development (unstable) (2026-03-22 r89674)
66
- Status: OK
7-
- Winbuilder Windows Server 2022 x64 (build 20348), x86_64-w64-mingw32, R Under development (unstable) (2026-02-18 r89435 ucrt)
7+
- Winbuilder Windows Server 2022 x64 (build 20348), x86_64-w64-mingw32, R 4.6.0 beta (2026-04-12 r89874 ucrt)
88
- Status: OK
9-
- GitHub Action Linux: R 4.5.2 (2025-10-31), x86_64-pc-linux-gnu
9+
- GitHub Action Linux: R version 4.5.3 (2026-03-11), x86_64-pc-linux-gnu
1010
- Status: OK
11-
- GitHub Action Mac: R 4.5.2 (2025-10-31), aarch64-apple-darwin20
11+
- GitHub Action Mac: R version 4.5.3 (2026-03-11), aarch64-apple-darwin20
1212
- Status: OK
13-
- GitHub Action Windows: R 4.5.2 (2025-10-31 ucrt), x86_64-w64-mingw32
13+
- GitHub Action Windows: R version 4.5.3 (2026-03-11 ucrt), x86_64-w64-mingw32
1414
- Status: OK
1515

16-
## From NEWS.md: bhmbasket 1.0.0
16+
## bhmbasket 1.1.0
1717

18-
* Added structured unit tests for core functionality
18+
### New and Altered Features
1919

20-
* Integrated code coverage
21-
22-
* Replaced validation logic with checkmate assertions and removed unused helper functions
23-
24-
* Replaced dependency on R2jags to rjags
25-
26-
* Added Github Actions workflows for automated R CMD check and CI validation
20+
* Added mixture priors and models `"exnex_mix"`, `"exnex_adj_mix"`, `"stratified_mix"`.
2721

2822
* Minor changes in code

devtools_script.R

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,14 @@ devtools::install_deps()
4949
devtools::run_examples()
5050
devtools::spell_check()
5151
devtools::check()
52-
devtools::check_win_devel()
52+
devtools::check_win_devel() # https://win-builder.r-project.org/upload.aspx
53+
devtools::check_mac_release()
5354
# devtools::check_rhub()
5455
devtools::document()
5556
## Update your NEWS file
5657
## Update DESCRIPTION (e.g. version number)
5758
devtools::spell_check()
59+
spelling::update_wordlist()
5860
## Update cran-comments.md
5961
devtools::check()
6062

0 commit comments

Comments
 (0)