Skip to content

Commit

Permalink
Merge pull request #17 from weberse2/issue-rel-173
Browse files Browse the repository at this point in the history
1.7-3 release
  • Loading branch information
weberse2 authored Jan 8, 2024
2 parents 8699ada + 9fdc6fb commit fba9384
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 39 deletions.
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ src/stan_files/.*\.hpp$
^src/package-binary$
^Makefile$
^LICENSE$
^vignettes/articles$
12 changes: 6 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Description: Tool-set to support Bayesian evidence synthesis. This
for details on applying this package while Neuenschwander et al. (2010)
<doi:10.1177/1740774509356002> and Schmidli et al. (2014)
<doi:10.1111/biom.12242> explain details on the methodology.
Version: 1.7-2
Date: 2023-08-21
Version: 1.7-3
Date: 2024-01-02
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")
Expand All @@ -25,7 +25,7 @@ Imports:
methods,
Rcpp (>= 0.12.0),
RcppParallel (>= 5.0.1),
rstan (>= 2.19.3),
rstan (>= 2.26.0),
rstantools (>= 2.3.1),
assertthat,
mvtnorm,
Expand All @@ -44,8 +44,8 @@ LinkingTo:
Rcpp (>= 0.12.0),
RcppEigen (>= 0.3.3.3.0),
RcppParallel (>= 5.0.1),
rstan (>= 2.19.3),
StanHeaders (>= 2.19.0)
rstan (>= 2.26.0),
StanHeaders (>= 2.26.0)
License: GPL (>=3)
LazyData: true
Biarch: true
Expand All @@ -69,6 +69,6 @@ Suggests:
glue,
ragg
VignetteBuilder: knitr
SystemRequirements: GNU make, pandoc (>= 1.12.3), pandoc-citeproc, C++17
SystemRequirements: GNU make, pandoc (>= 1.12.3), pngquant, C++17
Encoding: UTF-8
RoxygenNote: 7.2.3
15 changes: 15 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# RBesT 1.7-3 - January 2nd, 2024

## Enhancements

* Updated Stan model file syntax to use new array syntax as required
by Stan >=2.33. This upgrades the minimal Stan version to 2.26.
* Moved most vignettes to be articles to decrease size of R
packages. Articles are available on [the package
homepage](https://opensource.nibr.com/RBesT/articles/).

## Bugfixes

* Added `pngquant` to system requirements of package as requested by
CRAN.

# RBesT 1.7-2 - August 21st, 2023

## Enhancements
Expand Down
2 changes: 1 addition & 1 deletion R/mixplot.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ plot.mix <- function(x, prob=0.99, fun=dmix, log=FALSE, comp=TRUE, size=1.25, ..

num_comp <- ncol(x)
pl <- ggplot(data.frame(x=interval), aes(x=x)) +
stat_function(geom=plot_geom, fun = plot_fun, args=list(mix=x, log=log), n=n_fun, size=size) +
stat_function(geom=plot_geom, fun = plot_fun, args=list(mix=x, log=log), n=n_fun, linewidth=size) +
bayesplot::bayesplot_theme_get()

if(funStr=="dmix") {
Expand Down
Binary file modified R/sysdata.rda
Binary file not shown.
20 changes: 10 additions & 10 deletions inst/stan/gMAP.stan
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,22 @@ data {
vector[H] y_se;

// binomial data, link=logit=2
int<lower=0> r[H];
int<lower=1> r_n[H];
array[H] int<lower=0> r;
array[H] int<lower=1> r_n;

// count data, link=log=3
int<lower=0> count[H];
array[H] int<lower=0> count;
vector[H] log_offset;

// exchangeability cluster mapping
int<lower=1> n_groups;
int<lower=1,upper=n_groups> group_index[H];
array[H] int<lower=1,upper=n_groups> group_index;

// tau prediction stratum
int<lower=1,upper=n_groups> n_tau_strata;
int<lower=1,upper=n_tau_strata> tau_strata_pred;
// data item to tau stratum mapping
int<lower=1,upper=n_tau_strata> tau_strata_index[H];
array[H] int<lower=1,upper=n_tau_strata> tau_strata_index;

// number of predictors
int<lower=1> mX;
Expand All @@ -52,20 +52,20 @@ data {
int<lower=0,upper=1> ncp;

// guesses on the parameter location and scales
vector[mX] beta_raw_guess[2];
real tau_raw_guess[2];
array[2] vector[mX] beta_raw_guess;
array[2] real tau_raw_guess;

// sample from prior predictive (do not add data to likelihood)
int<lower=0,upper=1> prior_PD;
}
transformed data {
vector[mX] beta_prior_stan[2];
vector[n_tau_strata] tau_prior_stan[2];
array[2] vector[mX] beta_prior_stan;
array[2] vector[n_tau_strata] tau_prior_stan;
//matrix[n_groups, n_tau_strata] S;
//matrix[H, n_groups] Z;
matrix[H, mX] X_param;
// group index to tau stratum mapping
int<lower=1,upper=n_tau_strata> tau_strata_gindex[n_groups] = rep_array(tau_strata_pred, n_groups);
array[n_groups] int<lower=1,upper=n_tau_strata> tau_strata_gindex = rep_array(tau_strata_pred, n_groups);

for (i in 1:mX) {
beta_prior_stan[1,i] = beta_prior[i,1];
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-gMAP.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ test_that("SBC data was up to date at package creation.", {
set.seed(92575)
rate <- round(-log(0.05)/2, 1)
test_that("gMAP matches RStanArm binomial family", {
skip("RStanArm has issues loading since 2024-01-02 on CI/CD systems.")
skip_on_cran()
best_run <- gMAP(cbind(r, n-r) ~ 1 | study,
data=AS,
Expand Down
2 changes: 1 addition & 1 deletion tools/make-ds.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ make_internal_ds <- function() {
calibration_meta["MD5"] <- vals["MD5"]

pkg_create_date <- Sys.time()
pkg_sha <- "0e02ce3"
pkg_sha <- "511a0f1"

if (gsub("\\$", "", pkg_sha) == "Format:%h") {
pkg_sha <- system("git rev-parse --short HEAD", intern=TRUE)
Expand Down
2 changes: 2 additions & 0 deletions vignettes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.html
*.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ vignette: >
%\VignetteEngine{knitr::rmarkdown}
---

```{r, child="settings-knitr.txt"}
```{r, child="../settings-knitr.txt"}
```
```{r, child="settings-sampling.txt"}
```{r, child="../settings-sampling.txt"}
```
```{r, include=FALSE}
library(bayesplot)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ vignette: >
%\VignetteEngine{knitr::rmarkdown}
---

```{r, child="settings-knitr.txt"}
```{r, child="../settings-knitr.txt"}
```
```{r, child="settings-sampling.txt"}
```{r, child="../settings-sampling.txt"}
```
```{r init, include=FALSE}
library(scales)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ vignette: >
%\VignetteEngine{knitr::rmarkdown}
---

```{r, child="settings-knitr.txt"}
```{r, child="../settings-knitr.txt"}
```
```{r, child="settings-sampling.txt"}
```{r, child="../settings-sampling.txt"}
```

# Introduction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ vignette: >
%\VignetteEngine{knitr::rmarkdown}
---

```{r, child="settings-knitr.txt"}
```{r, child="../settings-knitr.txt"}
```
```{r, child="settings-sampling.txt"}
```{r, child="../settings-sampling.txt"}
```

# Introduction
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ vignette: >
---


```{r, child="settings-knitr.txt"}
```{r, child="../settings-knitr.txt"}
```
```{r, child="settings-sampling.txt"}
```{r, child="../settings-sampling.txt"}
```
```{r, include=FALSE}
library(dplyr)
Expand Down
35 changes: 24 additions & 11 deletions vignettes/introduction.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,30 @@ vignette: >

# Introduction

The R Bayesian evidence synthesis Tools (RBesT) have been created to
facilitate the use of historical information in clinical trials. Once
relevant historical information has been identified, RBesT supports
the derivation of informative priors via the Meta-Analytic-Predictive
(MAP) approach [1] and the evaluation of the trial's operating
characteristics. The MAP approach performs a standard meta-analysis
followed by a prediction for the control group parameter of a future
study while accounting for the uncertainty in the population mean (the
standard result from a meta-analysis) and the between-trial
heterogeneity. Therefore, RBesT can also be used as a meta-analysis
tool if one simply neglects the prediction part.
The R Bayesian evidence synthesis Tools (RBesT) facilitate the use of
historical information in clinical trials. Once relevant historical
information has been identified, RBesT supports the derivation of
informative priors via the Meta-Analytic-Predictive (MAP) approach [1]
and the evaluation of the trial's operating characteristics. The MAP
approach performs a standard meta-analysis followed by a prediction
for the control group parameter of a future study while accounting for
the uncertainty in the population mean (the standard result from a
meta-analysis) and the between-trial heterogeneity. Therefore, RBesT
can also be used as a meta-analysis tool if one simply neglects the
prediction part.

This document demonstrates RBesT as it can be used to derive from
historical control data a prior for a binary endpoint. The [RBesT
package homepage](https://opensource.nibr.com/RBesT/) contains further
articles on introductory material:

- Probability of success with co-data
- Probability of success at an interim with a normal endpoint
- Customizing RBesT plots
- RBesT for a normal endpoint
- Meta-Analytic-Predictive priors for variances

# Binary responder analysis example

Let's consider a Novartis Phase II study in ankylosing spondylitis
comparing the Novartis test treatment secukinumab with placebo
Expand Down

0 comments on commit fba9384

Please sign in to comment.