Learn R Programming

mHG (version 1.1)

mHG.test: Perform Minimum-Hypergeometric test.

Description

Performs a minimum-hypergeometric (mHG) test. The null-hypothesis is that provided list was randomly and equiprobable selected from all lists containing N entries, B of which are 1s. The alternative hypothesis is that the 1s tend to appear at the top of the list.

Usage

mHG.test(lambdas, n_max = length(lambdas))

Arguments

lambdas

\(\{0,1\}^N\), sorted from top to bottom.

n_max

the algorithm will only consider the first \(n_{max}\) partitions.

Value

A list with class "htest" containing the following components:

statistic

The mHG statistic.

p.value

The p-value for the test.

parameters

  • B - number of black balls.

  • n_max - Max partition considered by the algorithm.

n

The index for which the mHG was obtained (smallest one if several n give the same mHG).

b

\(\sum\limits_{i=1}^n \lambda_i\).

Details

\(O(NB)\) running time, \(O(NB)\) space.

References

Eden, E. (2007). Discovering Motifs in Ranked Lists of DNA Sequences. Haifa. Retrieved from http://bioinfo.cs.technion.ac.il/people/zohar/thesis/eran.pdf (pages 10-12, 18-20)

Examples

Run this code
# NOT RUN {
N <- 50
B <- 15
lambdas <- numeric(50)
lambdas[sample(N, B)] <- 1
t <- mHG.test(lambdas)
t <- mHG.test(lambdas, n_max = 20)
# }

Run the code above in your browser using DataLab