Interface IntegerDistribution
- All Superinterfaces:
DiscreteDistribution,Distribution
- All Known Subinterfaces:
BinomialDistribution,HypergeometricDistribution,PascalDistribution,PoissonDistribution,ZipfDistribution
- All Known Implementing Classes:
AbstractIntegerDistribution,BinomialDistributionImpl,HypergeometricDistributionImpl,PascalDistributionImpl,PoissonDistributionImpl,ZipfDistributionImpl
Interface for discrete distributions of integer-valued random variables.
-
Method Summary
Modifier and TypeMethodDescriptiondoublecumulativeProbability(int x) For a random variable X whose values are distributed according to this distribution, this method returns P(X ≤ x).doublecumulativeProbability(int x0, int x1) For this distribution, X, this method returns P(x0 ≤ X ≤ x1).intinverseCumulativeProbability(double p) For this distribution, X, this method returns the largest x such that P(X ≤ x) invalid input: '<'= p.doubleprobability(int x) For a random variable X whose values are distributed according to this distribution, this method returns P(X = x).Methods inherited from interface org.apache.commons.math.distribution.DiscreteDistribution
probabilityMethods inherited from interface org.apache.commons.math.distribution.Distribution
cumulativeProbability, cumulativeProbability
-
Method Details
-
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- the value at which the probability density function is evaluated.- Returns:
- the value of the probability density function at x
-
cumulativeProbability
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- 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.
-
cumulativeProbability
For this distribution, X, this method returns P(x0 ≤ X ≤ x1).- Parameters:
x0- the inclusive, lower boundx1- the inclusive, upper bound- Returns:
- the cumulative probability.
- Throws:
MathException- if the cumulative probability can not be computed due to convergence or other numerical errors.IllegalArgumentException- if x0 > x1
-
inverseCumulativeProbability
For this distribution, X, this method returns the largest x such that P(X ≤ x) invalid input: '<'= p.Note that this definition implies:
- If there is a minimum value,
m, with positive probability under (the density of) X, thenm - 1is returned byinverseCumulativeProbability(0).If there is no such valuem, Integer.MIN_VALUEis returned. - If there is a maximum value,
M, such that P(X ≤ M) =1, thenMis returned byinverseCumulativeProbability(1).If there is no such value,M, Integer.MAX_VALUEis returned.
- Parameters:
p- the cumulative probability.- Returns:
- the largest x such that P(X ≤ x) invalid input: '<'= p
- Throws:
MathException- if the inverse cumulative probability can not be computed due to convergence or other numerical errors.IllegalArgumentException- if p is not between 0 and 1 (inclusive)
- If there is a minimum value,
-