
public class HypergeometricDistribution extends Object implements DiscreteDistribution
The hypergeometric distribution applies to sampling without replacement from a finite population whose elements can be classified into two mutually exclusive categories like Pass/Fail. As random selections are made from the population, each subsequent draw decreases the population causing the probability of success to change with each draw.
| Modifier and Type | Field and Description |
|---|---|
private org.apache.commons.math3.distribution.HypergeometricDistribution |
dist |
| Constructor and Description |
|---|
HypergeometricDistribution(int popSize,
int sampleSize,
int numSuccesses)
A hypergeometric distribution gives the distribution of the number of successes in \(n\) draws from a population
of size \(N\) containing \(n_{succ}\) successes.
|
| Modifier and Type | Method and Description |
|---|---|
double |
getMean()
Get the numerical value of the mean of this distribution.
|
double |
getVariance()
Get the numerical value of the variance of this distribution.
|
int |
sample()
Generate a random value sampled from this distribution.
|
private final org.apache.commons.math3.distribution.HypergeometricDistribution dist
public HypergeometricDistribution(int popSize,
int sampleSize,
int numSuccesses)
popSize - the population size, \(N\).sampleSize - the number of draws, \(n\).numSuccesses - the number of successes, \(n_{succ}\).public int sample()
DiscreteDistributionsample in interface DiscreteDistributionpublic final double getMean()
For population size N, number of successes m, and sample size n, the mean is
n * m / N.
getMean in interface DiscreteDistributionpublic final double getVariance()
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)].
getVariance in interface DiscreteDistributionCopyright © 2015 University of Glasgow. All rights reserved.