publipha

Build Status CRAN_Status_Badge Coverage Status Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public.

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:

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 barebones metafor::rma. The alpha tells psma 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 = metafor::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 = metafor::dat.bangertdrowns2004)

# Classical model
set.seed(313)
model_cma = publipha::cma(yi = yi,
                          vi = vi,
                          alpha = c(0, 0.025, 0.05, 1),
                          data = metafor::dat.bangertdrowns2004)

You can calculate the posterior means of the meta-analytic mean with extract_theta0:

extract_theta0(model_psma)
#> [1] 0.1241181
extract_theta0(model_cma)
#> [1] 0.2206233

If you wish to plot a histogram of the posterior distribution of tau, the standard deviation of the effect size distribution, you can do it like this:

extract_tau(model_psma, hist)

References

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. This project follows a Contributor Code of Conduct.