-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.Rmd
117 lines (95 loc) · 4.07 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
---
output:
github_document:
html_preview: true
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```
```{r setup_samples, include = FALSE, cache = TRUE}
library("publipha")
set.seed(313)
model_psma = publipha::psma(yi = yi,
vi = vi,
alpha = c(0, 0.025, 0.05, 1),
data = metadat::dat.bangertdrowns2004)
set.seed(313)
model_cma = publipha::cma(yi = yi,
vi = vi,
alpha = c(0, 0.025, 0.05, 1),
data = metadat::dat.bangertdrowns2004)
```
# publipha <img src="man/figures/logo.png" align="right" width="177" height="65" />
[![CRAN_Status_Badge](https://www.r-pkg.org/badges/version/publipha)](https://cran.r-project.org/package=publipha)
[![R-CMD-check](https://github.com/JonasMoss/publipha/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/JonasMoss/publipha/actions/workflows/R-CMD-check.yaml)
An `R` package for Bayesian meta-analysis that accounts for publication bias or *p*-hacking.
```{r setup, include=FALSE}
library("publipha")
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(out.width='750px', dpi=200)
```
## Overview
publipha is an package for doing Bayesian meta-analysis that accounts for
publication bias or *p*-hacking. Its main functions are:
* `psma` does 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)](https://www.jstor.org/stable/pdf/2246311.pdf)
* `phma` does 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 of [by Moss and De Bin (2019)](https://arxiv.org/abs/1911.12445).
* `cma` does classical random effects meta-analysis with the same priors
as `psma` and `cma`.
## Installation
Use the following command from inside `R`:
```{r install, echo = TRUE, eval = FALSE}
# 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.
```{r simpleuse, echo = TRUE, eval = FALSE}
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 with
`extract_theta0`:
```{R, echo = TRUE, eval = TRUE}
extract_theta0(model_psma)
```
```{R, echo = TRUE, eval = TRUE}
extract_theta0(model_cma)
```
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:
```{R, echo = TRUE, eval = TRUE}
extract_tau(model_psma, hist)
```
## References
* [Hedges, Larry V. "Modeling publication selection effects in meta-analysis." Statistical Science (1992): 246-255.](https://www.jstor.org/stable/pdf/2246311.pdf)
* [Moss, Jonas and De Bin, Riccardo. "Modelling publication bias and p-hacking" (2019)](https://arxiv.org/abs/1911.12445)
## How to Contribute or Get Help
If you encounter a bug, have a feature request or need some help, open a [Github issue](https://github.com/JonasMoss/publipha/issues). Create a pull requests
to contribute.