maxFP: Upper bound for the number of false discoveries in a...

View source: R/posthoc-bounds.R

maxFPR Documentation

Upper bound for the number of false discoveries in a selection

Description

Upper bound for the number of false discoveries in a selection

Usage

maxFP(p.values, thr)

Arguments

p.values

A vector of p-values for the selected items

thr

A vector of non-decreasing JER-controlling thresholds

Value

A post hoc upper bound on the number of false discoveries in the selection

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

sorted_p <- sort(p)
maxFP(head(sorted_p, 20), thr) # some signal
maxFP(tail(sorted_p), thr)     # no signal
maxFP(c(head(sorted_p), tail(sorted_p)), thr)

pneuvial/sanssouci documentation built on Feb. 12, 2024, 4:18 a.m.