Hypergeometric Distribution-based Hypothesis Testing
hyperg_test(term_genes, chosen_genes, background_genes)
vector of genes in the selected term gene set
vector containing the set of input genes
vector of background genes (i.e. universal set of genes in the experiment)
the p-value as determined using the hypergeometric distribution.
To determine whether the chosen_genes
are enriched
(compared to a background pool of genes) in the term_genes
, the
hypergeometric distribution is assumed and the appropriate p value
(the value under the right tail) is calculated and returned.
hyperg_test(letters[1:5], letters[2:5], letters)
#> [1] 0.0003344482
hyperg_test(letters[1:5], letters[2:10], letters)
#> [1] 0.03447856
hyperg_test(letters[1:5], letters[2:13], letters)
#> [1] 0.1173913