Permutation-based FDR control via empirical null p-value distribution
Source:R/multiple_testing.R
permutation_fdr.RdEstimates the false discovery rate at each candidate threshold
using a matrix of p-values computed under the permutation null,
and selects the largest threshold whose estimated FDR is at most
alpha. Q-values are assigned as the minimum estimated FDR
across thresholds at least as large as each observed p-value.
Arguments
- test_stats
Numeric vector of observed p-values (named after the Python sibling argument to keep cross-language parity).
- null_stats
Numeric matrix of permutation-null p-values with \(n_{perm}\) rows and \(m\) columns.
- alpha
Target FDR level (default 0.05).
- labels
Optional character vector of test labels.
Value
A morie_rich_result list with original (raw
p-values), adjusted (q-values), rejected,
method, alpha, n_rejected, n_tests.
Examples
set.seed(1)
m <- 20; nperm <- 200
p_obs <- c(stats::runif(m - 4), c(1e-4, 1e-3, 1e-3, 5e-3))
p_null <- matrix(stats::runif(nperm * m), nperm, m)
permutation_fdr(p_obs, p_null)
#> Adjusted p-values (permutation_fdr)
#> ===================================
#> Call: method=permutation_fdr, alpha=0.0500, n=20
#>
#> Method permutation_fdr
#> alpha 0.05
#> Tests (n) 20
#> Rejected 4
#> Min adjusted p 0
#> Max adjusted p 0.9415
#>
#> 4 of 20 hypotheses are rejected at alpha=0.0500. Permutation-null FDR with 200 permutations.