Skip to content

Commit

Permalink
updating actions
Browse files Browse the repository at this point in the history
  • Loading branch information
FBartos committed Mar 31, 2022
1 parent c72c119 commit 33387b8
Show file tree
Hide file tree
Showing 9 changed files with 110 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ jobs:
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
remotes::install_version("BayesTools", "0.2.3")
#remotes::install_version("BayesTools", "0.2.3")
remotes::install_github("FBartos/[email protected]")
shell: Rscript {0}

- name: Check
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/R-CMD-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,8 @@ jobs:
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
remotes::install_version("BayesTools", "0.1.3")
#remotes::install_version("BayesTools", "0.2.3")
remotes::install_github("FBartos/[email protected]")
install.packages("devtools")
install.packages("testthat")
install.packages("vdiffr")
Expand All @@ -104,7 +105,8 @@ jobs:
run: |
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("rcmdcheck")
remotes::install_version("BayesTools", "0.2.3")
#remotes::install_version("BayesTools", "0.2.3")
remotes::install_github("FBartos/[email protected]")
install.packages("devtools")
install.packages("testthat")
install.packages("vdiffr")
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ jobs:
run: |
remotes::install_deps(dependencies = TRUE)
install.packages("pkgdown")
remotes::install_version("BayesTools", "0.2.3")
#remotes::install_version("BayesTools", "0.2.3")
remotes::install_github("FBartos/[email protected]")
shell: Rscript {0}

- name: Install package
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ jobs:
install.packages(c("remotes"))
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("covr")
remotes::install_version("BayesTools", "0.2.3")
#remotes::install_version("BayesTools", "0.2.3")
remotes::install_github("FBartos/[email protected]")
shell: Rscript {0}

- name: Test coverage
Expand Down
Binary file modified models/CustomEnsembles/Bem_update1.RDS
Binary file not shown.
Binary file modified models/CustomEnsembles/Bem_update2.RDS
Binary file not shown.
41 changes: 41 additions & 0 deletions vignettes/CustomEnsembles.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,47 @@ if(.Platform$OS.type == "windows"){
}
```

```{r include = FALSE, eval = FALSE}
# R package version updating
library(RoBMA)
data("Bem2011", package = "RoBMA")
fit <- RoBMA(d = Bem2011$d, se = Bem2011$se, study_names = Bem2011$study,
priors_effect = NULL, priors_heterogeneity = NULL, priors_bias = NULL,
priors_effect_null = prior("spike", parameters = list(location = 0)),
priors_heterogeneity_null = prior("spike", parameters = list(location = 0)),
priors_bias_null = prior_none(),
seed = 1)
fit <- update(fit,
prior_effect = prior("normal", parameters = list(mean = .15, sd = .10), truncation = list(lower = 0)),
prior_heterogeneity_null = prior("spike", parameters = list(location = 0)),
prior_bias_null = prior_none())
saveRDS(fit, file = "../models/CustomEnsembles/Bem_update1.RDS")
fit <- update(fit,
prior_effect = prior("normal", parameters = list(mean = .15, sd = .10), truncation = list(lower = 0)),
prior_heterogeneity = prior("invgamma", parameters = list(shape = 1, scale = .15)),
prior_bias_null = prior_none())
fit <- update(fit,
prior_effect_null = prior("spike", parameters = list(location = 0)),
prior_heterogeneity_null = prior("spike", parameters = list(location = 0)),
prior_bias = prior_weightfunction("one.sided", parameters = list(alpha = c(1, 1), steps = c(0.05))))
fit <- update(fit,
prior_effect_null = prior("spike", parameters = list(location = 0)),
prior_heterogeneity_null = prior("spike", parameters = list(location = 0)),
prior_bias = prior_weightfunction("one.sided", parameters = list(alpha = c(1, 1, 1), steps = c(0.05, 0.10))))
fit <- update(fit,
prior_effect_null = prior("spike", parameters = list(location = 0)),
prior_heterogeneity_null = prior("spike", parameters = list(location = 0)),
prior_bias = prior_PET("Cauchy", parameters = list(0, 1), truncation = list(lower = 0)))
fit <- update(fit,
prior_effect_null = prior("spike", parameters = list(location = 0)),
prior_heterogeneity_null = prior("spike", parameters = list(location = 0)),
prior_bias = prior_PEESE("Cauchy", parameters = list(0, 5), truncation = list(lower = 0)))
saveRDS(fit, file = "../models/CustomEnsembles/Bem_update2.RDS")
```

By default, the `RoBMA()` function specifies models as a combination of all supplied prior distributions (across null and alternative specification), with their prior model weights being equal to the product of prior distributions' weights. This results in the 36 meta-analytic models using the default settings [@bartos2021no]$^1$. In [another vignette](ReproducingBMA.html), we illustrated that RoBMA can be also utilized for reproducing Bayesian Model-Averaged Meta-Analysis (BMA) [@gronau2017bayesian; @gronau2020primer; @bartos2021bayesian]. However, the package was built as a framework for estimating highly customized meta-analytic model ensembles. Here, we are going to illustrate how to do exactly that (see @bartos2020adjusting for a tutorial paper on customizing the model ensemble with JASP).

Please keep in mind that all models should be justified by theory. Furthermore, the models should be tested to make sure that the ensemble can perform as intended a priori to drawing inference from it. The following sections are only for illustrating the functionality of the package. We provide a completely discussion with the relevant sources in the Example section of @bartos2021no.
Expand Down
27 changes: 27 additions & 0 deletions vignettes/MedicineBMA.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,33 @@ fit_BMAb <- readRDS(file = "../models/MedicineBMA/fit_BMAb.RDS")
fit_RoBMA <- readRDS(file = "../models/MedicineBMA/fit_RoBMA.RDS")
```

```{r include = FALSE, eval = FALSE}
# R package version updating
library(RoBMA)
data("Poulsen2006", package = "RoBMA")
fit_BMA <- RoBMA(d = Poulsen2006$d, se = Poulsen2006$se, study_names = Poulsen2006$study,
priors_effect = prior_informed(name = "oral health", parameter = "effect", type = "smd"),
priors_heterogeneity = prior_informed(name = "oral health", parameter = "heterogeneity", type = "smd"),
priors_bias = NULL,
transformation = "cohens_d", seed = 1, parallel = TRUE)
fit_BMAb <- RoBMA(d = Poulsen2006$d, se = Poulsen2006$se, study_names = Poulsen2006$study,
priors_effect = prior_informed(name = "oral health", parameter = "effect", type = "smd"),
priors_heterogeneity = prior_informed(name = "oral health", parameter = "heterogeneity", type = "smd"),
priors_bias = NULL,
seed = 1, parallel = TRUE)
fit_RoBMA <- RoBMA(d = Poulsen2006$d, se = Poulsen2006$se, study_names = Poulsen2006$study,
priors_effect = prior_informed(name = "oral health", parameter = "effect", type = "smd"),
priors_heterogeneity = prior_informed(name = "oral health", parameter = "heterogeneity", type = "smd"),
seed = 1, parallel = TRUE)
saveRDS(fit_BMA, file = "../models/MedicineBMA/fit_BMA.RDS")
saveRDS(fit_BMAb, file = "../models/MedicineBMA/fit_BMAb.RDS")
saveRDS(fit_RoBMA, file = "../models/MedicineBMA/fit_RoBMA.RDS")
```

Bayesian model-averaged meta-analysis allows researchers to seamlessly incorporate available prior information into the analysis [@gronau2017bayesian; @gronau2020primer; @bartos2021bayesian]. This vignette illustrates how to do this with an example from @bartos2021bayesian, who developed informed prior distributions for meta-analyses of continuous outcomes based on the Cochrane database of systematic reviews. Then, we extend the example by incorporating publication bias adjustment with robust Bayesian meta-analysis [@bartos2021no; @maier2020robust].

Expand Down
32 changes: 32 additions & 0 deletions vignettes/ReproducingBMA.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,38 @@ fit_RoBMA_test <- readRDS(file = "../models/ReproducingBMA/PowerPoseTest.RDS")
fit_RoBMA_est <- readRDS(file = "../models/ReproducingBMA/PowerPoseEst.RDS")
```

```{r include = FALSE, eval = FALSE}
# R package version updating
library(RoBMA)
data("power_pose", package = "metaBMA")
fit_RoBMA_test <- RoBMA(d = power_pose$effectSize, se = power_pose$SE, study_names = power_pose$study,
priors_effect = prior(
distribution = "cauchy",
parameters = list(location = 0, scale = 1/sqrt(2)),
truncation = list(0, Inf)),
priors_heterogeneity = prior(
distribution = "invgamma",
parameters = list(shape = 1, scale = 0.15)),
priors_bias = NULL,
transformation = "cohens_d", seed = 1, parallel = TRUE)
fit_RoBMA_est <- RoBMA(d = power_pose$effectSize, se = power_pose$SE, study_names = power_pose$study,
priors_effect = prior(
distribution = "cauchy",
parameters = list(location = 0, scale = 1/sqrt(2))),
priors_heterogeneity = prior(
distribution = "invgamma",
parameters = list(shape = 1, scale = 0.15)),
priors_bias = NULL,
priors_effect_null = NULL,
transformation = "cohens_d", seed = 2, parallel = TRUE)
saveRDS(fit_RoBMA_test, file = "../models/ReproducingBMA/PowerPoseTest.RDS")
saveRDS(fit_RoBMA_est, file = "../models/ReproducingBMA/PowerPoseEst.RDS")
```

By default, the package estimates an ensemble of 36 meta-analytic models and provides functions for convenient manipulation with the fitted object. However, it has been built in a way that it can be used as a framework for estimating any combination of meta-analytic models (or a single model). Here, we illustrate how to build a custom ensemble of meta-analytic models - specifically the same ensemble that is used in 'classical' Bayesian Model-Averaged Meta-Analysis [@gronau2017bayesian; @gronau2020primer; @bartos2021bayesian]. See [this vignette](CustomEnsembles.html) if you are interested in building more customized ensembles or @bartos2020adjusting for a tutorial on fitting (custom) models in JASP.


Expand Down

0 comments on commit 33387b8

Please sign in to comment.