README.md

Compute Winner's Curse Correction

Zachary McCaw Updated: 20-09-15

Description

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.

Installation

devtools::install_github(repo = 'zrmacc/WinCurse')

Model

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.

Examples

Data

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:

The true $\pi = 0.75$ and the true $\tau^{2} = 0.05$.

Estimation

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

Outputs

The output of fit.WinCurse is an object of class winCurse with these slots.

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
fit@Estimates
## $pi
## [1] 0.7656391
## 
## $tau2
## [1] 0.04803447
head(fit@Expectations)
## [1]  0.165374887 -0.001272114 -0.059008241  0.020476311  0.008183376
## [6] -0.000698325
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

Posterior Expectations

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
)


zrmacc/WinCurse documentation built on April 2, 2021, 3:40 a.m.