mHGtest
01 Syntax
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| sumFirst | 1 | sum(HG_row[1:b]) in the R reference, which is the sum of the first b hypergeometric probabilities HG_row(i) = Prob(X == i), i < b. |
| mHGtest | 1 | Performs a minimum-hypergeometric test. |
| mHGstatisticcalc | 1 | Calculates the mHG statistic. |
| mHGpvalcalc | 1 | Calculates the p-value associated with the mHG statistic. |
| R_separation_linecalc | 1 | Determine R separation line - This Is the highest (broken) line crossing the B*W matrix horizontally, that underneath it all the associated p-values are higher than p, Or w + b >… |
| pi_rcalc | 1 | Consider an urn With N balls, B Of which are black And W white. |
| HG_row_ncalc_func | 1 | Calculate HG row n. This row contains the first (b_n + 1) hypergeometric probabilities, HG[i] = Prob(X == (i - 1)), For number Of tries n. Does so given an updated HG row m (m <… |
| d_ratio | 1 | The ratio between HG(n,b,B,N) And HG(n-1,b-1,B,N) See page 19 In Eden's thesis. |
| v_ratio | 2 | The vectorized version of mHGtest.v_ratio()), equals to the R call v_ratio(n, b, N, B) when b is a vector of integers. |
03 Fields
| Name | Overloads | Summary |
|---|---|---|
| EPSILON | 2 | We define EPSILON to account for small changes in the calculation of p-value between the Function calculating the statistic And this Function calculating the p-values Specificall… |
04 Members
Vector, Int32)sum(HG_row[1:b]) in the R reference, which is the sum of the first b hypergeometric probabilities HG_row(i) = Prob(X == i), i < b.
| Name | Type | Description |
|---|---|---|
HG_row | Vector | - |
b | Int32 | the number of probabilities that should be accumulated. |
Vector, Double)Performs a minimum-hypergeometric test.
Test Is based On the following thesis:
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
The null-hypothesis Is that the 1S In the lambda list are randomly And uniformly distributed In the lambdas list. The alternative hypothesis Is that the 1S tend To appeard In the top Of the list. As the designation Of "top" Is Not a clear-cut multiple hypergeometric tests are performed, With increasing length Of lambdas being considered To be In the "top". The statistic Is the minimal p-value obtained In those tests. A p-value Is calculated Based On the statistics.
equals to the R function mHG.test(lambdas, n_max = length(lambdas))
| Name | Type | Description |
|---|---|---|
lambdas | Vector |
|
n_max# | Double | the algorithm will only consider the first |
Vector, Double)Calculates the mHG statistic.
mHG(lambdas) = min over 1 <= n <= N of HGT (b_n(lambdas); N, B, n)
Where HGT Is the hypergeometric tail:
HGT(b; N, B, n) = Probability(X >= b)
And: b_n = sum over 1 <= i <= n of lambdas[i]
If several n gives the same mHG, then the lowest one Is taken.
| Name | Type | Description |
|---|---|---|
lambdas | Vector | sorted And labeled |
n_max# | Double | the algorithm will only consider the first |
Double, Int32, Double, Double)Calculates the p-value associated with the mHG statistic. Guidelines for the calculation are to be found in:
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 11-12, 19-20)
| Name | Type | Description |
|---|---|---|
p | Double | the mHG statistic. Marked as p, as it represenets an "uncorrected" p-value. |
N | Int32 | total number of white And black balls (according to the hypergeometric problem definition). |
B | Double | number of black balls. |
n_max | Double | the algorithm will calculate the p-value under the null hypothesis that only the first n_max partitions are taken into account in determining in minimum. |
p-value.
Double, Int32, Int32, Int32)Determine R separation line - This Is the highest (broken) line crossing the B*W matrix horizontally, that underneath it all the associated p-values are higher than p, Or w + b > n_max.
(This Is a bit different from the original definition To make the calculation more efficient)
See Eden, E. (2007) pages 11-12.
| Name | Type | Description |
|---|---|---|
p | Double | the mHG statistic. Marked As p, As it represenets an "uncorrected" p-value. |
N | Int32 | total number Of white And black balls (according To the hypergeometric problem definition). |
B | Int32 | number Of black balls. |
n_max | Int32 | Part Of the constraint On the line, the null hypothesis Is calculated under the assumption that the first n_max partitions are taken into account In determining the minimum. |
R_separation_line - represented As a vector size B + 1, index b containing the first (high enough) w To the right Of the R separation line (Or W + 1 If no such w exist).
Int32, Int32, Vector)Consider an urn With N balls, B Of which are black And W white. pi_r stores The probability Of drawing w white And b black balls In n draws (n = w + b) With the constraint Of P(w,b) = 0 If (w, b) Is On Or above separation line.
R's row 1 Of the matrix represents w = -1, col 1 represents b = -1; therefore the 0-based matrix here uses row 0 / col 0 fer the w = -1/b = -1 padding.
See Eden, E. (2007) page 20.
| Name | Type | Description |
|---|---|---|
N | Int32 | total number Of white And black balls (according To the hypergeometric problem definition). |
B | Int32 | number Of black balls. |
R_separation_line | Vector | represented As a vector size B + 1, index b containing the first (high enough) w To the right Of the R separation line. |
Vector, Int32, Int32, Double, Int32, Int32, Int32)Calculate HG row n. This row contains the first (b_n + 1) hypergeometric probabilities, HG[i] = Prob(X == (i - 1)), For number Of tries n. Does so given an updated HG row m (m < n), which contains the first (b_n) hypergeometric probabilities.
| Name | Type | Description |
|---|---|---|
HG_row_m | Vector | updated HG row m (m < n), which contains the first (b_n) hypergeometric probabilities. |
m | Int32 | the number Of tries (m < n) For which the HG_row_m fits. |
ni | Int32 | the number Of tries (n > m) For which we want To calculate the HG row |
b_n | Double | The maximal b For which we need To calculate the hypergeometric probabilities. |
N | Int32 | total number Of white And black balls (according To the hypergeometric problem definition). |
B | Int32 | number Of black balls. |
RECURSION_OVERHEAD_MULTIPLIER | Int32 | The Function directs the calculation To an iteration solution (With the cost Of B(n-m)) Or a recursive solution (With the cost B * log(B)). This multiplier helps To determine When To use the recursion solution - it Is Not a theoretical result, but an empirical one. |
Double, Double, Double, Double)The ratio between HG(n,b,B,N) And HG(n-1,b-1,B,N) See page 19 In Eden's thesis.
equals to the R expression: d_ratio = n * (B - (b - 1)) / (b * (N - (n - 1)))
Double, Double, Double, Double)The ratio between HG(n,b,B,N) And HG(n-1,b,B,N) See page 19 In Eden's thesis.
equals to the R expression: v_ratio = (n * (N - n - B + b + 1)) / ((n - b) * (N - n + 1))
Double, Vector, Double, Double)The vectorized version of mHGtest.v_ratio(), equals to the R call v_ratio(n, b, N, B) when b is a vector of integers.
We define EPSILON to account for small changes in the calculation of p-value between the Function calculating the statistic And this Function calculating the p-values Specifically, If (statistic + EPSILON) Is higher than the hypergeometric tail associated by a cell In the W*B path matrix, used In the p-value calculation, Then the cell Is Not In the "R region" We warn if the mHG statistic gets below -EPSILON