Upper bound for the number of false discoveries in a selection
Arguments
- p.values
A vector of p-values for the selected items
- thr
A vector of non-decreasing JER-controlling thresholds
References
Blanchard, G., Neuvial, P., & Roquain, E. (2020). Post hoc confidence bounds on false positives using reference families. Annals of Statistics, 48(3), 1281-1303.
Examples
m <- 123
sim <- gaussianSamples(m = m, rho = 0.2, n = 100,
pi0 = 0.8, SNR = 3, prob = 0.5)
X <- sim$X
groups <- sim$categ
p <- rowWelchTests(X, groups)$p.value
null_groups <- replicate(100, sample(groups))
p0 <- rowWelchTests(X, null_groups)$p.value
calib <- calibrate(p0, m, alpha = 0.1)
thr <- calib$thr
M0 <- maxFP(p, thr)
M0/m
#> [1] 0.8780488
sorted_p <- sort(p)
maxFP(head(sorted_p, 20), thr) # some signal
#> [1] 5
maxFP(tail(sorted_p), thr) # no signal
#> [1] 6
maxFP(c(head(sorted_p), tail(sorted_p)), thr)
#> [1] 6