|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.commons.math.distribution.AbstractDistribution
org.apache.commons.math.distribution.AbstractIntegerDistribution
org.apache.commons.math.distribution.HypergeometricDistributionImpl
public class HypergeometricDistributionImpl
The default implementation of HypergeometricDistribution.
| Field Summary |
|---|
| Fields inherited from class org.apache.commons.math.distribution.AbstractIntegerDistribution |
|---|
randomData |
| Constructor Summary | |
|---|---|
HypergeometricDistributionImpl(int populationSize,
int numberOfSuccesses,
int sampleSize)
Construct a new hypergeometric distribution with the given the population size, the number of successes in the population, and the sample size. |
|
| Method Summary | |
|---|---|
protected double |
calculateNumericalMean()
Use this method to actually calculate the mean for the specific distribution. |
protected double |
calculateNumericalVariance()
Use this method to actually calculate the variance for the specific distribution. |
double |
cumulativeProbability(int x)
For this distribution, X, this method returns P(X <= x). |
protected int |
getDomainLowerBound(double p)
Access the domain value lower bound, based on p, used to
bracket a PDF root. |
protected int |
getDomainUpperBound(double p)
Access the domain value upper bound, based on p, used to
bracket a PDF root. |
int |
getNumberOfSuccesses()
Access the number of successes. |
int |
getPopulationSize()
Access the population size. |
int |
getSampleSize()
Access the sample size. |
int |
getSupportLowerBound()
Access the lower bound of the support. |
int |
getSupportUpperBound()
Access the upper bound of the support. |
double |
probability(int x)
For this distribution, X, this method returns P(X = x). |
double |
upperCumulativeProbability(int x)
For this distribution, X, this method returns P(X >= x). |
| Methods inherited from class org.apache.commons.math.distribution.AbstractIntegerDistribution |
|---|
cumulativeProbability, cumulativeProbability, cumulativeProbability, inverseCumulativeProbability, isSupportLowerBoundInclusive, isSupportUpperBoundInclusive, probability, reseedRandomGenerator, sample, sample |
| Methods inherited from class org.apache.commons.math.distribution.AbstractDistribution |
|---|
getNumericalMean, getNumericalVariance, isSupportConnected |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.commons.math.distribution.IntegerDistribution |
|---|
cumulativeProbability, inverseCumulativeProbability, reseedRandomGenerator, sample, sample |
| Methods inherited from interface org.apache.commons.math.distribution.DiscreteDistribution |
|---|
probability |
| Methods inherited from interface org.apache.commons.math.distribution.Distribution |
|---|
cumulativeProbability, cumulativeProbability, getNumericalMean, getNumericalVariance, isSupportConnected, isSupportLowerBoundInclusive, isSupportUpperBoundInclusive |
| Constructor Detail |
|---|
public HypergeometricDistributionImpl(int populationSize,
int numberOfSuccesses,
int sampleSize)
populationSize - Population size.numberOfSuccesses - Number of successes in the population.sampleSize - Sample size.
NotPositiveException - if numberOfSuccesses < 0.
NotStrictlyPositiveException - if populationSize <= 0.
NotPositiveException - if populationSize < 0.
NumberIsTooLargeException - if numberOfSuccesses > populationSize.
NumberIsTooLargeException - if sampleSize > populationSize.| Method Detail |
|---|
public double cumulativeProbability(int x)
X, this method returns P(X <= x).
cumulativeProbability in interface IntegerDistributioncumulativeProbability in class AbstractIntegerDistributionx - Value at which the PDF is evaluated.
protected int getDomainLowerBound(double p)
p, used to
bracket a PDF root.
getDomainLowerBound in class AbstractIntegerDistributionp - Desired probability for the critical value.
P(X < 'lower bound') < p.protected int getDomainUpperBound(double p)
p, used to
bracket a PDF root.
getDomainUpperBound in class AbstractIntegerDistributionp - Desired probability for the critical value
P(X < 'upper bound') > p.public int getNumberOfSuccesses()
getNumberOfSuccesses in interface HypergeometricDistributionpublic int getPopulationSize()
getPopulationSize in interface HypergeometricDistributionpublic int getSampleSize()
getSampleSize in interface HypergeometricDistributionpublic double probability(int x)
X, this method returns P(X = x).
probability in interface IntegerDistributionx - Value at which the PMF is evaluated.
public double upperCumulativeProbability(int x)
X, this method returns P(X >= x).
x - Value at which the CDF is evaluated.
public int getSupportLowerBound()
N,
number of successes m, and
sample size n,
the lower bound of the support is
max(0, n + m - N)
getSupportLowerBound in class AbstractIntegerDistributionpublic int getSupportUpperBound()
m and
sample size n,
the upper bound of the support is
min(m, n)
getSupportUpperBound in class AbstractIntegerDistributionprotected double calculateNumericalMean()
AbstractDistribution.getNumericalMean()
(which implements caching) to actually get the mean.
For population size N,
number of successes m, and
sample size n, the mean is
n * m / N
calculateNumericalMean in class AbstractDistributionprotected double calculateNumericalVariance()
AbstractDistribution.getNumericalVariance()
(which implements caching) to actually get the variance.
For population size N,
number of successes m, and
sample size n, the variance is
[ n * m * (N - n) * (N - m) ] / [ N^2 * (N - 1) ]
calculateNumericalVariance in class AbstractDistribution
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||