README (original) (raw)
publipha
An R package for Bayesian meta-analysis that accounts for publication bias or _p_-hacking.
Overview
publipha is an package for doing Bayesian meta-analysis that accounts for publication bias or _p_-hacking. Its main functions are:
psmadoes random effects meta-analysis under publication bias with a one-sided _p_-value based selection probability. The model is roughly the same as that of (Hedges, 1992)phmadoes random effects meta-analysis under a certain model of _p_-hacking with a one-sided _p_-value based propensity to _p_-hack. This is based on the forthcoming paper ofby Moss and De Bin (2019).cmadoes classical random effects meta-analysis with the same priors aspsmaandcma.
Installation
Use the following command from inside R:
# install.packages("devtools")
devtools::install_github("JonasMoss/publipha")Usage
Call the library function and use it like a barebonesmetafor::rma. The alpha tellspsma or phma where they should place the cutoffs for significance.
library("publipha")
# Publication bias model
set.seed(313) # For reproducibility
model_psma = publipha::psma(yi = yi,
vi = vi,
alpha = c(0, 0.025, 0.05, 1),
data = metadat::dat.bangertdrowns2004)
# p-hacking model
set.seed(313)
model_phma = publipha::phma(yi = yi,
vi = vi,
alpha = c(0, 0.025, 0.05, 1),
data = metadat::dat.bangertdrowns2004)
# Classical model
set.seed(313)
model_cma = publipha::cma(yi = yi,
vi = vi,
alpha = c(0, 0.025, 0.05, 1),
data = metadat::dat.bangertdrowns2004)You can calculate the posterior means of the meta-analytic mean withextract_theta0:
extract_theta0(model_psma)
#> [1] 0.1277197extract_theta0(model_cma)
#> [1] 0.2212093If you wish to plot a histogram of the posterior distribution oftau, the standard deviation of the effect size distribution, you can do it like this:
extract_tau(model_psma, hist)
References
- Hedges, Larry V. “Modeling publication selection effects in meta-analysis.” Statistical Science (1992): 246-255.
- Moss, Jonas and De Bin, Riccardo. “Modelling publication bias and p-hacking” (2019)
How to Contribute or Get Help
If you encounter a bug, have a feature request or need some help, open a Github issue. Create a pull requests to contribute.