jhplot.math.num.pdf
Class Hypergeometric

java.lang.Object
  extended by jhplot.math.num.pdf.DiscreteDistribution
      extended by jhplot.math.num.pdf.Hypergeometric
All Implemented Interfaces:
Distribution

public class Hypergeometric
extends DiscreteDistribution

The Hypergeometric distribution.

References:

  1. Eric W. Weisstein. "Hypergeometric Distribution." From MathWorld--A Wolfram Web Resource. http://mathworld.wolfram.com/Hypergeometric.html

Since:
1.2

Constructor Summary
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
 double cumulativeProbability(int x)
          The CDF for this distribution.
 int getNumberOfFailures()
          Access the number of failures.
 int getNumberOfSuccesses()
          Access the number of successes.
 int getSampleSize()
          Access the sample size.
 int inverseCumulativeProbability(double p)
          The inverse CDF for this distribution.
 double probability(int x)
          The PMF for this distribution.
 void setNumberOfFailures(int n)
          Modify the number of failures.
 void setNumberOfSuccesses(int n)
          Modify the number of successes.
 void setSampleSize(int n)
          Modify the sample size.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 NumericException
The CDF for this distribution. This method returns P(X ≤ x).

Specified by:
cumulativeProbability in class DiscreteDistribution
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 NumericException
The 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:
inverseCumulativeProbability in class DiscreteDistribution
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:
probability in class DiscreteDistribution
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.


jHepWork 3.0 ©