| hypergeometric_p_value | R Documentation |
Computes P(X >= k) where X ~ Hypergeometric(N, K, n). Returns 1.0 for invalid inputs so the metric is safe to feed into BH-FDR without filtering.
hypergeometric_p_value(N, K, n, k)
N |
Population size (total items in the universe). Integer >= 1. |
K |
Number of success states in the population (e.g. inclusive |A|). Integer >= 0. |
n |
Number of draws (e.g. inclusive |B|). Integer >= 0. |
k |
Observed successes (e.g. |A intersection B|). Integer >= 0. |
Maps to R's ‘phyper(k - 1, K, N - K, n, lower.tail = FALSE)'. Note that R’s phyper parameter convention differs from Python's scipy: R uses 'm' for success-in-population and 'n' for failure-in-population (= N - K), where Python uses 'N' for total population.
Numeric in [0, 1].
hypergeometric_p_value(20000, 138, 581, 126)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.