Skip to contents

Estimates the proportion of true null hypotheses (pi0) and tightens the BH thresholds by that factor. Delegates to qvalue::qvalue (Bioconductor) when installed; otherwise falls back to an inline Storey-style cutoff so the wrapper keeps working on CRAN-only installs.

Usage

storey_q(p_values, alpha = 0.05, lambda_param = 0.5, labels = NULL)

Arguments

p_values

Numeric vector of raw p-values.

alpha

Significance level.

lambda_param

Tuning parameter in (0, 1) for the pi0 estimator.

labels

Optional character vector of test labels.

Value

An object of class "morie_multiple_testing_result".

Examples

set.seed(1)
p <- c(runif(80), runif(20, 0, 0.005))

res <- storey_q(p)
res$pi0                     # estimated proportion of true nulls
#> [1] 0.78
head(res$adjusted)          # q-values
#> [1] 0.5633301 0.6083837 0.6874240 0.7417117 0.5014278 0.7417117
res$n_rejected
#> [1] 21

# `lambda_param` tunes the pi0 estimator; different lambda, different pi0.
storey_q(p, lambda_param = 0.5)$pi0
#> [1] 0.78
storey_q(p, lambda_param = 0.8)$pi0
#> [1] 0.75

# Adaptive FDR rejects at least as many as BH (pi0 <= 1 tightens BH):
c(storey = storey_q(p)$n_rejected, BH = benjamini_hochberg(p)$n_rejected)
#> storey     BH 
#>     21     20