Package org.snpeff.probablility
Class FisherExactTest
java.lang.Object
org.snpeff.probablility.FisherExactTest
Calculate Fisher's exact test (based on hypergeometric distribution)
- Author:
- pcingola
-
Method Summary
Modifier and TypeMethodDescriptionbooleancanUseChiSquareApproximation(int k, int N, int D, int n) Can ChiSquare approximation be used? A rule of the thumb says it can be used if every expected frequency is more than 10doublechiSquareApproximation(int k, int N, int D, int n) Chi-Square approximation for Fisher's exact testdoublechiSquareCDF(double chiSquare, int nu) Chi-Square Cumulative Distribution Function probability that an observed chi-square value for a correct model should be less than chiSquare nu = the degrees of freedomdoublechiSquareCDFComplementary(double chiSquare, int nu) Chi-Square Complementary of Cumulative Distribution Function: 1 - chiSquareCDF(x, nu) probability that an observed chi-square value for a correct model should be greater than chiSquare nu = the degrees of freedomdoublefisherExactTestDown(int k, int N, int D, int n) Fisher's exact test for 'k' or less (lower tail)doublefisherExactTestDown(int k, int N, int D, int n, double threshold) Fisher's exact test for less than 'k' (lower tail) It also compares to a 'threshold' value to speedup the process.doublefisherExactTestUp(int k, int N, int D, int n) Fisher's exact test for 'k' or more (upper tail)doublefisherExactTestUp(int k, int N, int D, int n, double threshold) Fisher's exact test for 'k' or more It also compares to a 'threshold' value to speedup the process.static FisherExactTestget()doublemean(int k, int N, int D, int n) Calculate the mean References: http://en.wikipedia.org/wiki/Hypergeometric_distributiondoublepValueDown(int k, int N, int D, int n) doublepValueDown(int k, int N, int D, int n, double threshold) Pvalue for 'k' or less Note: Includes 'k' It also compares to a 'threshold' value to speedup the process.doublepValueUp(int k, int N, int D, int n) doublepValueUp(int k, int N, int D, int n, double threshold) Fisher's exact test for more than 'k' It also compares to a 'threshold' value to speedup the process.toR(int k, int N, int D, int n, boolean lowerTail) Convert values to Fisher's 'R' commanddoublevariance(int k, int N, int D, int n) Calculate the variance References: http://en.wikipedia.org/wiki/Hypergeometric_distribution
-
Method Details
-
get
-
canUseChiSquareApproximation
public boolean canUseChiSquareApproximation(int k, int N, int D, int n) Can ChiSquare approximation be used? A rule of the thumb says it can be used if every expected frequency is more than 10- Parameters:
k- : white marbles drawnN- : Total marblesD- : White marbles => N-D : Black marblesn- : marbles drawn => N-n : not drawn- Returns:
- Chi-Square approximation
-
chiSquareApproximation
public double chiSquareApproximation(int k, int N, int D, int n) Chi-Square approximation for Fisher's exact test- Parameters:
k- : white marbles drawnN- : Total marblesD- : White marbles => N-D : Black marblesn- : marbles drawn => N-n : not drawn- Returns:
- Chi-Square approximation
-
chiSquareCDF
public double chiSquareCDF(double chiSquare, int nu) Chi-Square Cumulative Distribution Function probability that an observed chi-square value for a correct model should be less than chiSquare nu = the degrees of freedom- Parameters:
chiSquare-nu-- Returns:
-
chiSquareCDFComplementary
public double chiSquareCDFComplementary(double chiSquare, int nu) Chi-Square Complementary of Cumulative Distribution Function: 1 - chiSquareCDF(x, nu) probability that an observed chi-square value for a correct model should be greater than chiSquare nu = the degrees of freedom- Parameters:
chiSquare-nu-- Returns:
-
fisherExactTestDown
public double fisherExactTestDown(int k, int N, int D, int n) Fisher's exact test for 'k' or less (lower tail)- Parameters:
k- : white marbles drawnN- : Total marblesD- : White marbles => N-D : Black marblesn- : marbles drawn => N-n : not drawn- Returns:
-
fisherExactTestDown
public double fisherExactTestDown(int k, int N, int D, int n, double threshold) Fisher's exact test for less than 'k' (lower tail) It also compares to a 'threshold' value to speedup the process. Whenever cumulative probability is over the threshold, 1.0 is returned- Parameters:
k- : white marbles drawnN- : Total marblesD- : White marbles => N-D : Black marblesn- : marbles drawn => N-n : not drawntheshold- Threshold value- Returns:
- Cumulative probability or 1.0 (if cumulative is over the threshold)
-
fisherExactTestUp
public double fisherExactTestUp(int k, int N, int D, int n) Fisher's exact test for 'k' or more (upper tail)- Parameters:
k- : white marbles drawnN- : Total marblesD- : White marbles => N-D : Black marblesn- : marbles drawn => N-n : not drawn- Returns:
-
fisherExactTestUp
public double fisherExactTestUp(int k, int N, int D, int n, double threshold) Fisher's exact test for 'k' or more It also compares to a 'threshold' value to speedup the process. Whenever cumulative probability is over the threshold, 1.0 is returned- Parameters:
k- : white marbles drawnN- : Total marblesD- : White marbles => N-D : Black marblesn- : marbles drawn => N-n : not drawntheshold- Threshold value- Returns:
- Cumulative probability or 1.0 (if cumulative is over the threshold)
-
mean
public double mean(int k, int N, int D, int n) Calculate the mean References: http://en.wikipedia.org/wiki/Hypergeometric_distribution -
pValueDown
public double pValueDown(int k, int N, int D, int n) -
pValueDown
public double pValueDown(int k, int N, int D, int n, double threshold) Pvalue for 'k' or less Note: Includes 'k' It also compares to a 'threshold' value to speedup the process. Whenever cumulative probability is over the threshold, 1.0 is returned This is useful when we are interested on very small p-values- Parameters:
k- : white marbles drawnN- : Total marblesD- : White marbles => N-D : Black marblesn- : marbles drawn => N-n : not drawntheshold- Threshold value- Returns:
- Cumulative probability or 1.0 (if cumulative is over the threshold)
-
pValueUp
public double pValueUp(int k, int N, int D, int n) -
pValueUp
public double pValueUp(int k, int N, int D, int n, double threshold) Fisher's exact test for more than 'k' It also compares to a 'threshold' value to speedup the process. Whenever cumulative probability is over the threshold, 1.0 is returned This is useful when we are interested on very small p-values- Parameters:
k- : white marbles drawnN- : Total marblesD- : White marbles => N-D : Black marblesn- : marbles drawn => N-n : not drawntheshold- Threshold value- Returns:
- Cumulative probability or 1.0 (if cumulative is over the threshold)
-
toR
Convert values to Fisher's 'R' command- Returns:
-
variance
public double variance(int k, int N, int D, int n) Calculate the variance References: http://en.wikipedia.org/wiki/Hypergeometric_distribution
-