object.common
Class HypDistanceCalculator
java.lang.Object
object.common.HypDistanceCalculator
public class HypDistanceCalculator
- extends java.lang.Object
This class calculates cumulative Hypergeometric distances, used for p-value
calculations.
|
Field Summary |
static int |
ROUNDING_STRATEGY
The rounding strategy for the calculations. |
static int |
SCALE
The number of digits after the first non-zero digit in the decimal part of
a number. |
|
Method Summary |
protected static int |
approximateScale(java.math.BigDecimal divisor,
java.math.BigDecimal dividend)
|
static double |
calculateHypDistance(int population,
int population_true,
int sample,
int sample_true,
boolean fast)
|
static java.math.BigDecimal |
combinations(int n,
int k)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SCALE
public static final int SCALE
- The number of digits after the first non-zero digit in the decimal part of
a number. This is used for division calculations.
- See Also:
- Constant Field Values
ROUNDING_STRATEGY
public static final int ROUNDING_STRATEGY
- The rounding strategy for the calculations. The options are described in
java.math.BigDecimal.
- See Also:
- Constant Field Values
HypDistanceCalculator
public HypDistanceCalculator()
calculateHypDistance
public static double calculateHypDistance(int population,
int population_true,
int sample,
int sample_true,
boolean fast)
- Parameters:
population - the total populationpopulation_true - the population that is truesample - the sample sizesample_true - the items in sample that are in population_truefast - whether the calculation should be done fast, at
expense of some precision
- Returns:
- the hypergeometric distance for the given parameters
approximateScale
protected static int approximateScale(java.math.BigDecimal divisor,
java.math.BigDecimal dividend)
combinations
public static java.math.BigDecimal combinations(int n,
int k)
- Returns:
- n choose k