jhplot.math.num.pdf
Class Hypergeometric
- java.lang.Object
-
- jhplot.math.num.pdf.DiscreteDistribution
-
- jhplot.math.num.pdf.Hypergeometric
-
- All Implemented Interfaces:
- Distribution
public class Hypergeometric extends DiscreteDistribution
The Hypergeometric distribution.
References:
- Eric W. Weisstein. "Hypergeometric Distribution." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/Hypergeometric.html
- Since:
- 1.2
-
-
Constructor Summary
Constructors Constructor and Description Hypergeometric()Default constructor.Hypergeometric(int successes, int failures, int sample)Create a distribution with the given number of failures, number of successes, and sample size.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublecumulativeProbability(int x)The CDF for this distribution.intgetNumberOfFailures()Access the number of failures.intgetNumberOfSuccesses()Access the number of successes.intgetSampleSize()Access the sample size.intinverseCumulativeProbability(double p)The inverse CDF for this distribution.doubleprobability(int x)The PMF for this distribution.voidsetNumberOfFailures(int n)Modify the number of failures.voidsetNumberOfSuccesses(int n)Modify the number of successes.voidsetSampleSize(int n)Modify the sample size.
-
-
-
Constructor Detail
-
Hypergeometric
public Hypergeometric()
Default constructor. The number of failures, number of successes, and sample size are all set to one.
-
Hypergeometric
public Hypergeometric(int successes, int failures, int sample)Create a distribution with the given number of failures, number of successes, and sample size.- Parameters:
successes- the number of successes.failures- the number of failures.sample- the sample size.
-
-
Method Detail
-
cumulativeProbability
public double cumulativeProbability(int x) throws NumericExceptionThe CDF for this distribution. This method returns P(X ≤ x).- Specified by:
cumulativeProbabilityin classDiscreteDistribution- Parameters:
x- the value at which the CDF is evaluated.- Returns:
- CDF for this distribution.
- Throws:
NumericException- if the cumulative probability can not be computed.
-
getNumberOfFailures
public int getNumberOfFailures()
Access the number of failures.- Returns:
- the number of failures.
-
getNumberOfSuccesses
public int getNumberOfSuccesses()
Access the number of successes.- Returns:
- the number of successes.
-
getSampleSize
public int getSampleSize()
Access the sample size.- Returns:
- the sample size.
-
inverseCumulativeProbability
public int inverseCumulativeProbability(double p) throws NumericExceptionThe inverse CDF for this distribution. This method returns the largest x such that, P(X ≤ x) ≤ p. The return value must also satisfy P(X ≥ x) &ge 1 - p.- Specified by:
inverseCumulativeProbabilityin classDiscreteDistribution- Parameters:
p- the cumulative probability.- Returns:
- x
- Throws:
NumericException- if the inverse cumulative probability can not be computed.
-
probability
public double probability(int x)
The PMF for this distribution. This method returns P(X = x).- Specified by:
probabilityin classDiscreteDistribution- Parameters:
x- the value at which the probability is evaluated.- Returns:
- PMF for this distribution.
-
setNumberOfFailures
public void setNumberOfFailures(int n)
Modify the number of failures.- Parameters:
n- the new number of failures value.
-
setNumberOfSuccesses
public void setNumberOfSuccesses(int n)
Modify the number of successes.- Parameters:
n- the new number of successes value.
-
setSampleSize
public void setSampleSize(int n)
Modify the sample size.- Parameters:
n- the new sample size value.
-
-
DMelt 3.0 © DataMelt by jWork.ORG