Zachary McCaw
Updated: 2020-09-15
This package calculates the winner’s curse correction using the model proposed by Turley et al (2018), implemented via the Expectation-Maximization algorithm. Also see MGMM for fitting Gaussian Mixture Models more generally.
devtools::install_github(repo = 'zrmacc/WinCurse')See the model specification here. The parameters estimated by this package are the probability of membership to the null component (pi) and the variance component (tau^2) of the non-null component.
Example may be loaded via:
library(WinCurse)
data(wc_data)
head(wc_data)## non_null theta se
## 1 0 0.266490285 0.09712859
## 2 1 -0.013344779 0.10425721
## 3 0 -0.199862356 0.10540926
## 4 0 0.125285959 0.09901475
## 5 1 0.072490809 0.10000000
## 6 0 -0.007482795 0.09950372
Here:
non_nullis the generative component, 1 if non-null, 0 if null.thetais the estimated parameter.seis the standard error of the estimated parameter.
The true pi = 0.75 and the true tau^2 = 0.05.
To fit the winner’s curse model:
fit <- fit.WinCurse(
theta = wc_data$theta,
se = wc_data$se,
pi = 0.5,
tau2 = 1,
eps = 1e-12
)
show(fit)## Estimated null proportion:
## [1] 0.766
##
##
## Estimated non-null variance component:
## [1] 0.048
The output of fit.WinCurse is an object of class winCurse with these
slots.
@Assignmentscontaining the component assignments and normalized (0,1) assignment entropy. Higher entropy means the assignment is less certain.
head(fit@Assignments)## non_null entroy
## 1 1 0.8230338
## 2 0 0.5203778
## 3 0 0.9455816
## 4 0 0.7154702
## 5 0 0.5747059
## 6 0 0.5075906
@Estimatescontaining the final parameter estimates:
fit@Estimates## $pi
## [1] 0.7656391
##
## $tau2
## [1] 0.04803447
@Expectationscontaining the posterior expected effect size given the observed effect size. The posterior expectations are shrunk towards zero.
head(fit@Expectations)## [1] 0.165374887 -0.001272114 -0.059008241 0.020476311 0.008183376
## [6] -0.000698325
@Responsibilitiescontaining the posterior probabilities of membership to the null and non-null components.
head(fit@Responsibilities)## null non_null
## 1 0.2575546 0.7424454
## 2 0.8831021 0.1168979
## 3 0.6364610 0.3635390
## 4 0.8032057 0.1967943
## 5 0.8636100 0.1363900
## 6 0.8874397 0.1125603
For pre-computed pi and tau^2, the posterior expected effect size may be calculated via:
post_exp <- PostExp(
theta = wc_data$theta,
se = wc_data$se,
pi = 0.75,
tau2 = 0.05
)