Local false discovery rate via empirical-Bayes two-component mixture
Source:R/multiple_testing.R
local_fdr.RdEstimates the local FDR for each test as \(lfdr_i = \pi_0 \, f_0(z_i) / f(z_i)\), where \(z_i = \Phi^{-1}(1 - p_i / 2)\) are two-sided z-scores, \(f_0\) is the standard-normal null density, \(f\) is a kernel density estimate of the observed z-scores, and \(\pi_0\) is the proportion of null hypotheses estimated by the Storey-style cutoff at \(p > 0.5\).
Value
A data frame with columns p_value, z_score,
local_fdr, and (if supplied) label. The data frame
additionally carries class morie_rich_result.
Examples
set.seed(1)
p <- c(stats::runif(80),
stats::pnorm(-abs(stats::rnorm(20, mean = 3))) * 2)
lfdr <- local_fdr(p)
head(lfdr)
#> p_value z_score local_fdr
#> 1 0.2655087 1.1134653 0.4653070
#> 2 0.3721239 0.8925020 0.4540127
#> 3 0.5728534 0.5638542 0.4921580
#> 4 0.9082078 0.1152994 0.7779674
#> 5 0.2016819 1.2767743 0.4877259
#> 6 0.8983897 0.1276958 0.7612524