Skip to content

Commit

Permalink
adding informed priors (from BayesTools) + BMA in Medicine vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
FBartos committed Nov 3, 2021
1 parent 8fe1e10 commit 8a77434
Show file tree
Hide file tree
Showing 22 changed files with 414 additions and 38 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ Meta
RoBMA.Rcheck
.Rhistory
.Rprofile
/doc/
/Meta/
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: RoBMA
Title: Robust Bayesian Meta-Analyses
Version: 2.1.0
Version: 2.1.1
Maintainer: František Bartoš <[email protected]>
Authors@R: c(
person("František", "Bartoš", role = c("aut", "cre"),
Expand Down Expand Up @@ -40,7 +40,7 @@ NeedsCompilation: yes
Depends:
R (>= 4.0.0)
Imports:
BayesTools (>= 0.1.2),
BayesTools (>= 0.1.3),
runjags,
bridgesampling,
rjags,
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export(plot_models)
export(prior)
export(prior_PEESE)
export(prior_PET)
export(prior_informed)
export(prior_none)
export(prior_weightfunction)
export(pwnorm)
Expand Down
10 changes: 10 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## version 2.1.1
### Fixes
- incorrectly formatted citations in vignettes and capitalization

### Features
- adding `informed_prior()` function (from the BayesTools package) that allows specification of various informed prior distributions from the field of medicine and psychology
- adding a vignette reproducing the example of dentine sensitivity with the informed Bayesian model-averaged meta-analysis from Bartoš et al., 2021 ([open-access](https://onlinelibrary.wiley.com/doi/10.1002/sim.9170)),
- further reductions of fitted object size when setting `save = "min"`


## version 2.1
### Fixes
- more informative error message when the JAGS module fails to load
Expand Down
5 changes: 3 additions & 2 deletions R/RoBMA-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
##' methodology.
##'
##' More details regarding customization of the model ensembles are provided in the
##' \href{../doc/ReproducingBMA.html}{\bold{Reproducing BMA}} and
##' \href{../doc/CustomEnsembles.html}{\bold{Fitting custom meta-analytic ensembles}}
##' \href{../doc/ReproducingBMA.html}{\bold{Reproducing BMA}},
##' \href{../doc/MedicineBMA.html}{\bold{BMA in Medicine}}, and
##' \href{../doc/CustomEnsembles.html}{\bold{Fitting Custom Meta-Analytic Ensembles}}
##' vignettes. Please, use the "Issues" section in the GitHub repository to ask any
##' further questions.
##'
Expand Down
23 changes: 21 additions & 2 deletions R/data.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#' @title 27 experimental studies from from
#' @title 27 experimental studies from
#' \insertCite{anderson2010violent;textual}{RoBMA} that meet the best practice criteria
#'
#' @description The data set contains correlation coefficients, sample
Expand All @@ -16,7 +16,7 @@
"Anderson2010"


#' @title 9 experimental studies from from
#' @title 9 experimental studies from
#' \insertCite{bem2011feeling;textual}{RoBMA} as described in
#' \insertCite{bem2011must;textual}{RoBMA}
#'
Expand All @@ -32,3 +32,22 @@
#' @references
#' \insertAllCited{}
"Bem2011"


#' @title 5 studies with a tactile outcome assessment from
#' \insertCite{poulsen2006potassium;textual}{RoBMA} of the effect of potassium-containing toothpaste
#' on dentine hypersensitivity
#'
#' @description The data set contains Cohen's d effect sizes, standard errors,
#' and labels for 5 studies assessing the tactile outcome from a meta-analysis of
#' the effect of potassium-containing toothpaste on dentine hypersensitivity
#' \insertCite{poulsen2006potassium}{RoBMA} which was used as an example in
#' \insertCite{bartos2021bayesian;textual}{RoBMA}.
#'
#' @format A data.frame with 3 columns and 5 observations.
#'
#' @return a data.frame.
#'
#' @references
#' \insertAllCited{}
"Poulsen2006"
2 changes: 2 additions & 0 deletions R/main.R
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ RoBMA <- function(
### remove model posteriors if asked to
if(save == "min"){
object <- .remove_model_posteriors(object)
object <- .remove_model_margliks(object)
}


Expand Down Expand Up @@ -499,6 +500,7 @@ update.RoBMA <- function(object, refit_failed = TRUE,
### remove model posteriors if asked to
if(save == "min"){
object <- .remove_model_posteriors(object)
object <- .remove_model_margliks(object)
}

return(object)
Expand Down
10 changes: 9 additions & 1 deletion R/priors.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,17 @@ prior_PET <- BayesTools::prior_PET
#' @export
prior_PEESE <- BayesTools::prior_PEESE


#' @name prior_weightfunction
#' @inherit BayesTools::prior_weightfunction
#' @export
prior_weightfunction <- BayesTools::prior_weightfunction

#' @name prior_informed
#' @inherit BayesTools::prior_informed
#' @details Further details can be found in \insertCite{erp2017estimates;textual}{RoBMA},
#' \insertCite{gronau2017bayesian;textual}{RoBMA}, and
#' \insertCite{bartos2021bayesian;textual}{RoBMA}.
#' @references
#' \insertAllCited{}
#' @export
prior_informed <- BayesTools::prior_informed
13 changes: 12 additions & 1 deletion R/tools.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ check_RoBMA <- function(fit){

.is_model_constant <- function(priors){
# checks whether there is at least one non-nill prior
return(all(sapply(priors, function(prior)is.prior.point(prior) | is.prior.none(prior))) & is.null(priors[["omega"]]))
return(all(sapply(priors, function(prior) is.prior.point(prior) | is.prior.none(prior))) & is.null(priors[["omega"]]))
}
.remove_model_posteriors <- function(object){
for(i in seq_along(object[["models"]])){
Expand All @@ -27,6 +27,17 @@ check_RoBMA <- function(fit){
}
return(object)
}
.remove_model_margliks <- function(object){
for(i in seq_along(object[["models"]])){
if(inherits(object$models[[i]][["marglik"]], "bridge")){
object$models[[i]]$marglik[["q11"]] <- NULL
object$models[[i]]$marglik[["q12"]] <- NULL
object$models[[i]]$marglik[["q21"]] <- NULL
object$models[[i]]$marglik[["q22"]] <- NULL
}
}
return(object)
}
.print_errors_and_warnings <- function(object, max_print = 5){

errors_and_warnings <- .collect_errors_and_warnings(object, max_print = max_print)
Expand Down
Binary file added data/Poulsen2006.RData
Binary file not shown.
89 changes: 73 additions & 16 deletions inst/REFERENCES.bib
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ @article{anderson2010violent
journal = {Psychological Bulletin},
year = {2010},
pages = {151},
url = {https://doi.org/10.1037/a0018251}
doi = {10.1037/a0018251}
}

@article{gronau2017bayesian,
Expand All @@ -18,15 +18,19 @@ @article{gronau2017bayesian
pages = {123--138},
year = {2017},
publisher = {Taylor \& Francis},
url = {https://doi.org/10.1080/23743603.2017.1326760}
doi = {10.1080/23743603.2017.1326760}
}

@article{gronau2020primer,
title = {A primer on {B}ayesian model-averaged meta-analysis},
author = {Gronau, Quentin Frederik and Heck, Daniel W and Berkhout, Sophie W and Haaf, Julia M and Wagenmakers, Eric-Jan},
author = {Gronau, Quentin F and Heck, Daniel W and Berkhout, Sophie W and Haaf, Julia M and Wagenmakers, Eric-Jan},
journal = {Advances in Methods and Practices in Psychological Science},
year = {in press},
url = {https://doi.org/10.31234/osf.io/97qup}
volume = {4},
number = {3},
pages = {25152459211031256},
year = {2021},
publisher = {SAGE Publications Sage CA: Los Angeles, CA},
doi = {10.1177/25152459211031256}
}

@article{erp2017estimates,
Expand All @@ -37,15 +41,15 @@ @article{erp2017estimates
number = {1},
year = {2017},
publisher = {Ubiquity Press},
url = {https://doi.org/10.5334/jopd.33}
doi = {10.5334/jopd.33}
}

@article{maier2020robust,
title = {Robust {B}ayesian Meta-Analysis: Addressing Publication Bias with Model-Averaging},
author = {Maier, Maximilian and Barto{\v{s}}, Franti{\v{s}}ek and Wagenmakers, Eric-Jan},
year = {in press},
journal = {Psychological Methods},
url = {https://doi.org/10.31234/osf.io/u4cns}
doi = {10.31234/osf.io/u4cns}
}


Expand All @@ -55,16 +59,16 @@ @unpublished{bartos2021no
year = {2021},
publisher = {PsyArXiv},
note = {preprint at \url{https://doi.org/10.31234/osf.io/kvsp7}},
url = {https://doi.org/10.31234/osf.io/kvsp7}
doi = {10.31234/osf.io/kvsp7}
}

@unpublished{bartos2020adjusting,
title = {Adjusting for Publication Bias in {JASP} — Selection Models and Robust {B}ayesian Meta-Analysis},
author = {Barto{\v{s}}, Franti{\v{s}}ek and Maier, Maximilian and Wagenmakers, Eric-Jan},
year = {2020},
title = {Adjusting for publication bias in {JASP} & {R} -- selection models, {PET-PEESE}, and robust {B}ayesian meta-analysis},
author = {Barto{\v{s}}, Franti{\v{s}}ek and Maier, Maximilian and Quintana, Daniel S and Wagenmakers, Eric-Jan},
year = {2021},
journal = {PsyArXiv},
note = {preprint at \url{https://doi.org/10.31234/osf.io/75bqn}},
url = {https://doi.org/10.31234/osf.io/75bqn}
doi = {10.31234/osf.io/75bqn}
}

@misc{jasp14,
Expand All @@ -83,7 +87,7 @@ @article{bem2011feeling
pages = {407},
year = {2011},
publisher = {American Psychological Association},
url = {https://doi.org/10.1037/a0021524}
doi = {10.1037/a0021524}
}

@article{bem2011must,
Expand All @@ -95,7 +99,7 @@ @article{bem2011must
number = {4},
pages = {716},
year = {2011},
url = {https://doi.org/10.1037/a0024777}
doi = {10.1037/a0024777}
}

@article{wagenmakers2011why,
Expand All @@ -106,7 +110,7 @@ @article{wagenmakers2011why
volume = {100},
number = {3},
pages = {426--432},
url = {https://doi.org/10.1037/a0022790}
doi = {10.1037/a0022790}
}

@article{rouder2011bayes,
Expand All @@ -118,7 +122,7 @@ @article{rouder2011bayes
pages = {682--689},
year = {2011},
publisher = {Springer},
url = {https://doi.org/10.3758/s13423-011-0088-7}
doi = {10.3758/s13423-011-0088-7}
}

@misc{schimmack2018my,
Expand All @@ -136,3 +140,56 @@ @book{borenstein2011introduction
year = {2011},
publisher = {John Wiley \& Sons}
}

@article{bartos2021bayesian,
title = {Bayesian model-averaged meta-analysis in medicine},
author = {Barto{\v{s}}, Franti{\v{s}}ek and Gronau, Quentin F and Timmers, Bram and Otte, Willem M. and Ly, Alexander and Wagenmakers, Eric-Jan},
journal = {Statistics in Medicine},
doi = {10.1002/sim.9170},
year = {2021}
}

@article{poulsen2006potassium,
title = {Potassium containing toothpastes for dentine hypersensitivity},
author = {Poulsen, Sven and Errboe, Marie and Mevil, Yamila Lescay and Glenny, Anne-Marie},
journal = {Cochrane Database of Systematic Reviews},
number = {3},
year = {2006},
doi = {10.1002/14651858.cd001476.pub2},
publisher = {John Wiley \& Sons, Ltd}
}

@article{stanley2014meta,
title = {Meta-regression approximations to reduce publication selection bias},
author = {Stanley, Tom D and Doucouliagos, Hristos},
journal = {Research Synthesis Methods},
volume = {5},
number = {1},
pages = {60--78},
year = {2014},
publisher = {Wiley Online Library},
doi = {10.1002/jrsm.1095}
}

@article{stanley2017limitations,
title = {Limitations of {PET-PEESE} and other meta-analysis methods},
author = {Stanley, Tom D},
journal = {Social Psychological and Personality Science},
volume = {8},
number = {5},
pages = {581--591},
year = {2017},
publisher = {Sage Publications Sage CA: Los Angeles, CA},
doi = {10.1177/1948550617693062}
}

@article{vevea1995general,
title = {A general linear model for estimating effect size in the presence of publication bias},
author = {Vevea, Jack L and Hedges, Larry V},
year = 1995,
journal = {Psychometrika},
volume = 60,
number = 3,
pages = {419--435},
doi = {10.1007/BF02294384}
}
2 changes: 1 addition & 1 deletion man/Anderson2010.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/Bem2011.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions man/Poulsen2006.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions man/RoBMA-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8a77434

Please sign in to comment.