# Class RankSumNoReplacementPdf

java.lang.Object
org.snpeff.probablility.RankSumNoReplacementPdf

public class RankSumNoReplacementPdf extends Object
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

Fields
Modifier and Type
Field
Description
`static int`
`CACHE_MAX_N`
Cache size roughly (N * NT)^2
`static String`
`DEFAULT_CACHE_FILE`
`static int`
`warnCDF`

## Method Summary

Modifier and Type
Method
Description
`void`
`cacheSetPdf(int n, int nt, long r, double pdf)`
`boolean`
`canBeCached(int n, int nt)`
Is the number in the cache
`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.
`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 CDF
`org.apfloat.Apfloat`
`cdfTriangle(int n, int nt, long r)`
Uniform 'approximation' to rank sum statistic
`org.apfloat.Apfloat`
`cdfUniform(int n, int nt, long r)`
Uniform 'approximation' to rank sum statistic
`void`
`createCacheFile()`
Create a cache file
`static RankSumNoReplacementPdf`
`get()`
`String`
`getCacheFile()`
`long`
`maxRankSum(int n, int nt)`
Maximum possible rank sum
`double`
`mean(int n, int nt)`
Mean value for a given N and N_T
`long`
`minRankSum(int n, int nt)`
Minimum possible rank sum
`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.
`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 calculation
`org.apfloat.Apfloat`
`pdfNormal(int n, int nt, long r)`
Normal approximation to rank sum statistic
`org.apfloat.Apfloat`
`pdfTriangle(int n, int nt, long r)`
Uniform 'approximation' to rank sum statistic
`org.apfloat.Apfloat`
`pdfUniform(int n, int nt, long r)`
Uniform 'approximation' to rank sum statistic
`void`
`readCacheFile()`
Read cache file
`void`
`setCacheFile(String cacheFile)`
`double`
`sigma(int n, int nt)`
Wrapper to Sqrt(variance)
`String`
`toStringCache()`
Some cache statistics
`double`
`variance(int n, int nt)`
Variance for a given N and N_T
`double`
`varianceSlow(int n, int nt)`
Variance for a given N and N_T (slow method, only used for debugging)

### Methods inherited from class Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### CACHE_MAX_N

public static int CACHE_MAX_N
Cache size roughly (N * NT)^2

### DEFAULT_CACHE_FILE

public static String DEFAULT_CACHE_FILE

### warnCDF

public static int warnCDF

## Method Details

### get

public static RankSumNoReplacementPdf 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 number
  `nt` - : Number of elements in the sum
  `r` - : rank sum value
Returns:

### cdfExact

public org.apfloat.Apfloat cdfExact(int n, int nt, long r)
Cumulative density function (cdf)

Parameters:
  `n` - : Maximum rank number
  `nt` - : Number of elements in the sum
  `r` - : 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 number
  `nt` - : Number of elements in the sum
  `r` - : 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 number
  `nt` - : Number of elements in the sum
  `dr` - : 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 number
  `nt` - : Number of elements in the sum
  `r` - : 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

public String 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 number
  `nt` - : Number of elements in the sum
  `r` - : 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 number
  `nt` - : Number of elements in the sum
  `r` - : 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 number
  `nt` - : Number of elements in the sum
  `r` - : 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 number
  `nt` - : Number of elements in the sum
  `r` - : 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 number
  `nt` - : Number of elements in the sum
  `dr` - : 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 number
  `nt` - : Number of elements in the sum
  `r` - : 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

public void setCacheFile(String cacheFile)

### sigma

public double sigma(int n, int nt)
Wrapper to Sqrt(variance)

Parameters:
  `n` -
  `nt` -
Returns:

### toStringCache

public String 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: