org.apache.commons.math.distribution
Interface IntegerDistribution

All Superinterfaces:
DiscreteDistribution, Distribution
All Known Subinterfaces:
BinomialDistribution, HypergeometricDistribution, PascalDistribution, PoissonDistribution, ZipfDistribution
All Known Implementing Classes:
AbstractIntegerDistribution, BinomialDistributionImpl, HypergeometricDistributionImpl, PascalDistributionImpl, PoissonDistributionImpl, ZipfDistributionImpl

public interface IntegerDistribution
extends DiscreteDistribution

Interface for discrete distributions of integer-valued random variables.

Version:
$Id: IntegerDistribution.java 1178295 2011-10-03 04:36:27Z psteitz $

Method Summary
 double cumulativeProbability(int x)
          For a random variable X whose values are distributed according to this distribution, this method returns P(X <= x).
 double cumulativeProbability(int x0, int x1)
          For this distribution, X, this method returns P(x0 <= X <= x1).
 int inverseCumulativeProbability(double p)
          For this distribution, X, this method returns the largest x such that P(X <= x) <= p.
 double probability(int x)
          For a random variable X whose values are distributed according to this distribution, this method returns P(X = x).
 void reseedRandomGenerator(long seed)
          Reseed the random generator used to generate samples.
 int sample()
          Generate a random value sampled from this distribution.
 int[] sample(int sampleSize)
          Generate a random sample from the distribution.
 
Methods inherited from interface org.apache.commons.math.distribution.DiscreteDistribution
probability
 
Methods inherited from interface org.apache.commons.math.distribution.Distribution
cumulativeProbability, cumulativeProbability, getNumericalMean, getNumericalVariance, isSupportConnected, isSupportLowerBoundInclusive, isSupportUpperBoundInclusive
 

Method Detail

probability

double probability(int x)
For a random variable X whose values are distributed according to this distribution, this method returns P(X = x). In other words, this method represents the probability mass function for the distribution.

Parameters:
x - Value at which the probability density function is evaluated.
Returns:
the value of the probability density function at x.

cumulativeProbability

double cumulativeProbability(int x)
For a random variable X whose values are distributed according to this distribution, this method returns P(X <= x). In other words, this method represents the probability distribution function, or PDF for the distribution.

Parameters:
x - Value at which the PDF is evaluated.
Returns:
PDF for this distribution.

cumulativeProbability

double cumulativeProbability(int x0,
                             int x1)
For this distribution, X, this method returns P(x0 <= X <= x1).

Parameters:
x0 - the inclusive, lower bound
x1 - the inclusive, upper bound
Returns:
the cumulative probability.
Throws:
java.lang.IllegalArgumentException - if x0 > x1.

inverseCumulativeProbability

int inverseCumulativeProbability(double p)
For this distribution, X, this method returns the largest x such that P(X <= x) <= p.
Note that this definition implies:

Parameters:
p - Cumulative probability.
Returns:
the largest x such that P(X < x) <= p.
Throws:
java.lang.IllegalArgumentException - if p is not between 0 and 1 (inclusive).

reseedRandomGenerator

void reseedRandomGenerator(long seed)
Reseed the random generator used to generate samples.

Parameters:
seed - New seed.
Since:
3.0

sample

int sample()
Generate a random value sampled from this distribution.

Returns:
a random value.
Since:
3.0

sample

int[] sample(int sampleSize)
Generate a random sample from the distribution.

Parameters:
sampleSize - number of random values to generate.
Returns:
an array representing the random sample.
Throws:
NotStrictlyPositiveException - if sampleSize is not positive.
Since:
3.0


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