smile.stat.distribution
Class HyperGeometricDistribution
- java.lang.Object
-
- smile.stat.distribution.AbstractDistribution
-
- smile.stat.distribution.DiscreteDistribution
-
- smile.stat.distribution.HyperGeometricDistribution
-
- All Implemented Interfaces:
- Distribution
public class HyperGeometricDistribution extends DiscreteDistribution
The hypergeometric distribution is a discrete probability distribution that describes the number of successes in a sequence of n draws from a finite population without replacement, just as the binomial distribution describes the number of successes for draws with replacement.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) = ---------------- NCnwhere nCk is n choose k.
-
-
Constructor Summary
Constructors Constructor and Description HyperGeometricDistribution(int N, int m, int n)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublecdf(double k)Cumulative distribution function.doubleentropy()Shannon entropy of the distribution.doublelogp(int k)The probability mass function in log scale.doublemean()The mean of distribution.intnpara()The number of parameters of the distribution.doublep(int k)The probability mass function.doublequantile(double p)The quantile, the probability to the left of quantile is p.doublerand()Uses inversion by chop-down search from the mode when the mean < 20 and the patchwork-rejection method when the mean > 20.doublesd()The standard deviation of distribution.java.lang.StringtoString()doublevar()The variance of distribution.-
Methods inherited from class smile.stat.distribution.DiscreteDistribution
likelihood, logLikelihood, logp, p
-
Methods inherited from class smile.stat.distribution.AbstractDistribution
likelihood, logLikelihood
-
-
-
-
Constructor Detail
-
HyperGeometricDistribution
public HyperGeometricDistribution(int N, int m, int n)Constructor.- Parameters:
N- the number of total samples.m- the number of defects.n- the number of draws.
-
-
Method Detail
-
npara
public int npara()
Description copied from interface:DistributionThe number of parameters of the distribution.
-
mean
public double mean()
Description copied from interface:DistributionThe mean of distribution.
-
var
public double var()
Description copied from interface:DistributionThe variance of distribution.
-
sd
public double sd()
Description copied from interface:DistributionThe standard deviation of distribution.
-
entropy
public double entropy()
Description copied from interface:DistributionShannon entropy of the distribution.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
p
public double p(int k)
Description copied from class:DiscreteDistributionThe probability mass function.- Specified by:
pin classDiscreteDistribution
-
logp
public double logp(int k)
Description copied from class:DiscreteDistributionThe probability mass function in log scale.- Specified by:
logpin classDiscreteDistribution
-
cdf
public double cdf(double k)
Description copied from interface:DistributionCumulative distribution function. That is the probability to the left of x.
-
quantile
public double quantile(double p)
Description copied from interface:DistributionThe quantile, the probability to the left of quantile is p. It is actually the inverse of cdf.
-
rand
public double rand()
Uses inversion by chop-down search from the mode when the mean < 20 and the patchwork-rejection method when the mean > 20.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG