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 int
Cache size roughly (N * NT)^2static String
static int
-
Method Summary
Modifier and TypeMethodDescriptionvoid
cacheSetPdf
(int n, int nt, long r, double pdf) boolean
canBeCached
(int n, int nt) Is the number in the cacheorg.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.org.apfloat.Apfloat
cdfExact
(int n, int nt, long r) Cumulative density function (cdf)org.apfloat.Apfloat
cdfNormal
(int n, int nt, long r) Normal approximation to rankSum CDForg.apfloat.Apfloat
cdfTriangle
(int n, int nt, long r) Uniform 'approximation' to rank sum statisticorg.apfloat.Apfloat
cdfUniform
(int n, int nt, long r) Uniform 'approximation' to rank sum statisticvoid
Create a cache filestatic RankSumNoReplacementPdf
get()
long
maxRankSum
(int n, int nt) Maximum possible rank sumdouble
mean
(int n, int nt) Mean value for a given N and N_Tlong
minRankSum
(int n, int nt) Minimum possible rank sumorg.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.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.org.apfloat.Apfloat
pdfExact
(int n, int nt, long r, long rmin, int out) Probability density function (pdf): Exact calculationorg.apfloat.Apfloat
pdfNormal
(int n, int nt, long r) Normal approximation to rank sum statisticorg.apfloat.Apfloat
pdfTriangle
(int n, int nt, long r) Uniform 'approximation' to rank sum statisticorg.apfloat.Apfloat
pdfUniform
(int n, int nt, long r) Uniform 'approximation' to rank sum statisticvoid
Read cache filevoid
setCacheFile
(String cacheFile) double
sigma
(int n, int nt) Wrapper to Sqrt(variance)Some cache statisticsdouble
variance
(int n, int nt) Variance for a given N and N_Tdouble
varianceSlow
(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:
-