Package org.snpeff.probablility
Class RankSumNoReplacementPdf
java.lang.Object
org.snpeff.probablility.RankSumNoReplacementPdf
Calculate rank sum probability distribution function (pdf) and cumulative distribution function (cdf).
Note: This class assumes that ranks cannot be repeated (selecting without replacement)
- Author:
- Pablo Cingolani
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic intCache size roughly (N * NT)^2static Stringstatic int -
Method Summary
Modifier and TypeMethodDescriptionvoidcacheSetPdf(int n, int nt, long r, double pdf) booleancanBeCached(int n, int nt) Is the number in the cacheorg.apfloat.Apfloatcdf(int n, int nt, long r) Probability of getting a rank sum less or equal to 'r' when adding the ranks of 'nt' selected items.org.apfloat.ApfloatcdfExact(int n, int nt, long r) Cumulative density function (cdf)org.apfloat.ApfloatcdfNormal(int n, int nt, long r) Normal approximation to rankSum CDForg.apfloat.ApfloatcdfTriangle(int n, int nt, long r) Uniform 'approximation' to rank sum statisticorg.apfloat.ApfloatcdfUniform(int n, int nt, long r) Uniform 'approximation' to rank sum statisticvoidCreate a cache filestatic RankSumNoReplacementPdfget()longmaxRankSum(int n, int nt) Maximum possible rank sumdoublemean(int n, int nt) Mean value for a given N and N_TlongminRankSum(int n, int nt) Minimum possible rank sumorg.apfloat.Apfloatpdf(int n, int nt, long r) Probability of getting a rank sum equal to 'r' when adding the ranks of 'nt' selected items.org.apfloat.ApfloatpdfExact(int n, int nt, long r) Probability of getting a rank sum equal to 'r' when adding the ranks of 'nt' selected items.org.apfloat.ApfloatpdfExact(int n, int nt, long r, long rmin, int out) Probability density function (pdf): Exact calculationorg.apfloat.ApfloatpdfNormal(int n, int nt, long r) Normal approximation to rank sum statisticorg.apfloat.ApfloatpdfTriangle(int n, int nt, long r) Uniform 'approximation' to rank sum statisticorg.apfloat.ApfloatpdfUniform(int n, int nt, long r) Uniform 'approximation' to rank sum statisticvoidRead cache filevoidsetCacheFile(String cacheFile) doublesigma(int n, int nt) Wrapper to Sqrt(variance)Some cache statisticsdoublevariance(int n, int nt) Variance for a given N and N_TdoublevarianceSlow(int n, int nt) Variance for a given N and N_T (slow method, only used for debugging)
-
Field Details
-
CACHE_MAX_N
public static int CACHE_MAX_NCache size roughly (N * NT)^2 -
DEFAULT_CACHE_FILE
-
warnCDF
public static int warnCDF
-
-
Method Details
-
get
-
cacheSetPdf
public void cacheSetPdf(int n, int nt, long r, double pdf) -
canBeCached
public boolean canBeCached(int n, int nt) Is the number in the cache- Returns:
- true if it is
-
cdf
public org.apfloat.Apfloat cdf(int n, int nt, long r) Probability of getting a rank sum less or equal to 'r' when adding the ranks of 'nt' selected items. Items are ranked '1..n' (from 1 to 'n') Note: Approximated when 'n > 30'- Parameters:
n- : Maximum rank numbernt- : Number of elements in the sumr- : rank sum value- Returns:
-
cdfExact
public org.apfloat.Apfloat cdfExact(int n, int nt, long r) Cumulative density function (cdf)- Parameters:
n- : Maximum rank numbernt- : Number of elements in the sumr- : rank sum value- Returns:
- The probability that selecting 'nt' elements out of 'n' ranked elements, the rank sum is less or equal to 'r'
-
cdfNormal
public org.apfloat.Apfloat cdfNormal(int n, int nt, long r) Normal approximation to rankSum CDF- Parameters:
n- : Maximum rank numbernt- : Number of elements in the sumr- : rank sum value- Returns:
- The probability that selecting 'nt' elements out of 'n' ranked elements, the rank sum is less or equal to 'r'
-
cdfTriangle
public org.apfloat.Apfloat cdfTriangle(int n, int nt, long r) Uniform 'approximation' to rank sum statistic- Parameters:
n- : Maximum rank numbernt- : Number of elements in the sumdr- : rank sum value- Returns:
- The probability that selecting 'nt' elements out of 'n' ranked elements, the rank sum is equal to 'r'
-
cdfUniform
public org.apfloat.Apfloat cdfUniform(int n, int nt, long r) Uniform 'approximation' to rank sum statistic- Parameters:
n- : Maximum rank numbernt- : Number of elements in the sumr- : rank sum value- Returns:
- The probability that selecting 'nt' elements out of 'n' ranked elements, the rank sum is equal to 'r'
-
createCacheFile
public void createCacheFile()Create a cache file- Parameters:
fileName-
-
getCacheFile
-
maxRankSum
public long maxRankSum(int n, int nt) Maximum possible rank sum- Parameters:
n-nt-- Returns:
-
mean
public double mean(int n, int nt) Mean value for a given N and N_T- Parameters:
n-nt-- Returns:
-
minRankSum
public long minRankSum(int n, int nt) Minimum possible rank sum- Parameters:
n-nt-- Returns:
-
pdf
public org.apfloat.Apfloat pdf(int n, int nt, long r) Probability of getting a rank sum equal to 'r' when adding the ranks of 'nt' selected items. Items are ranked '1..n' (from 1 to 'n') Note: Approximated when 'n > 30'- Parameters:
n- : Maximum rank numbernt- : Number of elements in the sumr- : rank sum value- Returns:
-
pdfExact
public org.apfloat.Apfloat pdfExact(int n, int nt, long r) Probability of getting a rank sum equal to 'r' when adding the ranks of 'nt' selected items. Items are ranked '1..n' (from 1 to 'n') Note: Exact calculation Wrapper to 'real' pdf function- Parameters:
n- : Maximum rank numbernt- : Number of elements in the sumr- : rank sum value- Returns:
-
pdfExact
public org.apfloat.Apfloat pdfExact(int n, int nt, long r, long rmin, int out) Probability density function (pdf): Exact calculation- Parameters:
n- : Maximum rank numbernt- : Number of elements in the sumr- : rank sum value- Returns:
- The probability that selecting 'nt' elements out of 'n' ranked elements, the rank sum is equal to 'r'
-
pdfNormal
public org.apfloat.Apfloat pdfNormal(int n, int nt, long r) Normal approximation to rank sum statistic- Parameters:
n- : Maximum rank numbernt- : Number of elements in the sumr- : rank sum value- Returns:
- The probability that selecting 'nt' elements out of 'n' ranked elements, the rank sum is equal to 'r'
-
pdfTriangle
public org.apfloat.Apfloat pdfTriangle(int n, int nt, long r) Uniform 'approximation' to rank sum statistic- Parameters:
n- : Maximum rank numbernt- : Number of elements in the sumdr- : rank sum value- Returns:
- The probability that selecting 'nt' elements out of 'n' ranked elements, the rank sum is equal to 'r'
-
pdfUniform
public org.apfloat.Apfloat pdfUniform(int n, int nt, long r) Uniform 'approximation' to rank sum statistic- Parameters:
n- : Maximum rank numbernt- : Number of elements in the sumr- : rank sum value- Returns:
- The probability that selecting 'nt' elements out of 'n' ranked elements, the rank sum is equal to 'r'
-
readCacheFile
public void readCacheFile()Read cache file -
setCacheFile
-
sigma
public double sigma(int n, int nt) Wrapper to Sqrt(variance)- Parameters:
n-nt-- Returns:
-
toStringCache
Some cache statistics- Returns:
-
variance
public double variance(int n, int nt) Variance for a given N and N_T- Parameters:
n-nt-- Returns:
-
varianceSlow
public double varianceSlow(int n, int nt) Variance for a given N and N_T (slow method, only used for debugging)- Parameters:
n-nt-- Returns:
-