public class HyperGeometricDistribution extends DiscreteDistribution
Suppose you are to draw "n" balls without replacement from an urn containing "N" balls in total, "m" of which are white. The hypergeometric distribution describes the distribution of the number of white balls drawn from the urn. A random variable X follows the hypergeometric distribution with parameters N, m and n if the probability is given by
mCk (N-m)C(n-k)
P(X = k) = ----------------
NCn
where nCk is n choose k.| Constructor and Description |
|---|
HyperGeometricDistribution(int N,
int m,
int n)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
double |
cdf(double k)
Cumulative distribution function.
|
double |
entropy()
Shannon entropy of the distribution.
|
double |
logp(int k)
The probability mass function in log scale.
|
double |
mean()
The mean of distribution.
|
int |
npara()
The number of parameters of the distribution.
|
double |
p(int k)
The probability mass function.
|
double |
quantile(double p)
The quantile, the probability to the left of quantile is p.
|
double |
rand()
Uses inversion by chop-down search from the mode when the mean < 20
and the patchwork-rejection method when the mean > 20.
|
double |
sd()
The standard deviation of distribution.
|
java.lang.String |
toString() |
double |
var()
The variance of distribution.
|
likelihood, logLikelihood, logp, p, quantileinverseTransformSampling, likelihood, logLikelihood, quantile, quantile, rejectionpublic HyperGeometricDistribution(int N,
int m,
int n)
N - the number of total samples.m - the number of defects.n - the number of draws.public int npara()
Distributionpublic double mean()
Distributionpublic double var()
Distributionpublic double sd()
Distributionpublic double entropy()
Distributionpublic java.lang.String toString()
toString in class java.lang.Objectpublic double p(int k)
DiscreteDistributionp in class DiscreteDistributionpublic double logp(int k)
DiscreteDistributionlogp in class DiscreteDistributionpublic double cdf(double k)
Distributionpublic double quantile(double p)
Distributionpublic double rand()