Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.commons.math.distribution
Class HypergeometricDistributionImpl

    java.lang.Object
      org.apache.commons.math.distribution.AbstractDistribution
          org.apache.commons.math.distribution.AbstractIntegerDistribution
              org.apache.commons.math.distribution.HypergeometricDistributionImpl

All Implemented Interfaces:
  DiscreteDistribution, Distribution, HypergeometricDistribution, IntegerDistribution, Serializable

public class HypergeometricDistributionImpl
extends AbstractIntegerDistribution
implements HypergeometricDistribution, Serializable

The default implementation of `HypergeometricDistribution`.

Version:
  $Revision: 1.16 $ $Date: 2004/11/07 03:32:48 $
See Also:
  Serialized Form

Field Summary
`(package private) static long` | `serialVersionUID` Serializable version identifier

Constructor Summary
`HypergeometricDistributionImpl(int populationSize, int numberOfSuccesses, int sampleSize)` Construct a new hypergeometric distribution with the given the population size, the number of successes in the population, and the sample size.

Method Summary
`double` | `cumulativeProbability(int x)` For this disbution, X, this method returns P(X ≤ x).
`protected int` | `getDomainLowerBound(double p)` Access the domain value lower bound, based on `p`, used to bracket a PDF root.
`protected int` | `getDomainUpperBound(double p)` Access the domain value upper bound, based on `p`, used to bracket a PDF root.
`int` | `getNumberOfSuccesses()` Access the number of successes.
`int` | `getPopulationSize()` Access the population size.
`int` | `getSampleSize()` Access the sample size.
`double` | `probability(int x)` For this disbution, X, this method returns P(X = x).
`void` | `setNumberOfSuccesses(int num)` Modify the number of successes.
`void` | `setPopulationSize(int size)` Modify the population size.
`void` | `setSampleSize(int size)` Modify the sample size.

Methods inherited from class org.apache.commons.math.distribution.AbstractIntegerDistribution
`cumulativeProbability, cumulativeProbability, inverseCumulativeProbability, probability`

Methods inherited from class org.apache.commons.math.distribution.AbstractDistribution
`cumulativeProbability`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.apache.commons.math.distribution.IntegerDistribution
`cumulativeProbability, inverseCumulativeProbability`

Methods inherited from interface org.apache.commons.math.distribution.DiscreteDistribution
`probability`

Methods inherited from interface org.apache.commons.math.distribution.Distribution
`cumulativeProbability, cumulativeProbability`

Field Detail

### serialVersionUID

    static final long serialVersionUID

  Serializable version identifier

  See Also:
    Constant Field Values

Constructor Detail

### HypergeometricDistributionImpl

    public HypergeometricDistributionImpl(int populationSize,
                                          int numberOfSuccesses,
                                          int sampleSize)

  Construct a new hypergeometric distribution with the given the population size, the number of successes in the population, and the sample size.

Parameters:
  `populationSize` - the population size.
  `numberOfSuccesses` - number of successes in the population.
  `sampleSize` - the sample size.

Method Detail

### cumulativeProbability

    public double cumulativeProbability(int x)
                                 throws MathException

  For this disbution, X, this method returns P(X ≤ x).

  Specified by:
    `cumulativeProbability` in interface `IntegerDistribution`
  Specified by:
    `cumulativeProbability` in class `AbstractIntegerDistribution`
  Parameters:
    `x` - the value at which the PDF is evaluated.
  Returns:
    PDF for this distribution.
  Throws:
    `MathException` - if the cumulative probability can not be computed due to convergence or other numerical errors.

### getDomainLowerBound

    protected int getDomainLowerBound(double p)

  Access the domain value lower bound, based on `p`, used to bracket a PDF root.

  Specified by:
    `getDomainLowerBound` in class `AbstractIntegerDistribution`
  Parameters:
    `p` - the desired probability for the critical value
  Returns:
    domain value lower bound, i.e. P(X < lower bound) < `p`

### getDomainUpperBound

    protected int getDomainUpperBound(double p)

  Access the domain value upper bound, based on `p`, used to bracket a PDF root.

  Specified by:
    `getDomainUpperBound` in class `AbstractIntegerDistribution`
  Parameters:
    `p` - the desired probability for the critical value
  Returns:
    domain value upper bound, i.e. P(X < upper bound) > `p`

### getNumberOfSuccesses

    public int getNumberOfSuccesses()

  Access the number of successes.

  Specified by:
    `getNumberOfSuccesses` in interface `HypergeometricDistribution`
  Returns:
    the number of successes.

### getPopulationSize

    public int getPopulationSize()

  Access the population size.

  Specified by:
    `getPopulationSize` in interface `HypergeometricDistribution`
  Returns:
    the population size.

### getSampleSize

    public int getSampleSize()

  Access the sample size.

  Specified by:
    `getSampleSize` in interface `HypergeometricDistribution`
  Returns:
    the sample size.

### probability

    public double probability(int x)

  For this disbution, X, this method returns P(X = x).

  Specified by:
    `probability` in interface `IntegerDistribution`
  Parameters:
    `x` - the value at which the PMF is evaluated.
  Returns:
    PMF for this distribution.

### setNumberOfSuccesses

    public void setNumberOfSuccesses(int num)

  Modify the number of successes.

  Specified by:
    `setNumberOfSuccesses` in interface `HypergeometricDistribution`
  Parameters:
    `num` - the new number of successes.
  Throws:
    `IllegalArgumentException` - if `num` is negative.

### setPopulationSize

    public void setPopulationSize(int size)

  Modify the population size.

  Specified by:
    `setPopulationSize` in interface `HypergeometricDistribution`
  Parameters:
    `size` - the new population size.
  Throws:
    `IllegalArgumentException` - if `size` is not positive.

### setSampleSize

    public void setSampleSize(int size)

  Modify the sample size.

  Specified by:
    `setSampleSize` in interface `HypergeometricDistribution`
  Parameters:
    `size` - the new sample size.
  Throws:
    `IllegalArgumentException` - if `size` is negative.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2004 The Apache Software Foundation. All Rights Reserved.