com.aliasi.stats
Interface DiscreteDistribution

All Known Implementing Classes:
AbstractDiscreteDistribution, BernoulliConstant, BernoulliDistribution, BernoulliEstimator, BinomialDistribution, MultivariateConstant, MultivariateDistribution, MultivariateEstimator, PoissonConstant, PoissonDistribution, PoissonEstimator, ZipfDistribution

public interface DiscreteDistribution

A DiscreteDistribution provides a probability distribution over long integer outcomes. Mathematically, such a distribution defines a discrete-valued random variable.

Discrete probability distributions return values between 0.0 and 1.0 inclusive for outcomes. The sum of the probabilities over all integers should be 1.0, but it may be less than 1.0 for the sum of all integers representable as longs (64 bits). Discrete distributions are also required to return log (base 2) probabilities to support probabilities very close to 0.0 or 1.0.

Cumulative probabilities may be calculated over discrete distributions. A cumulative probabilty is a sum of probabilities within a given range.

Discrete distributions optionally implement methods to return their mean, variance and entropy. Discrete distributions are required to indicate the minimum and maximum outcome with non-zero probability. This allows cumulative probabilities, means, variances and entropies to be computed by iterating over values in range. If there are no minimum or maximum values, these methods should return the minimum and maximum long values respectively.

For more information, see:

Since:
LingPipe2.0
Version:
2.0
Author:
Bob Carpenter

Method Summary
 double cumulativeProbability(long lowerBound, long upperBound)
          Returns the probability that an outcome will fall in the range between the specified lower and upper bounds inclusive.
 double cumulativeProbabilityGreater(long lowerBound)
          Returns the probability an outcome will be greater than or equal to the specified outcome.
 double cumulativeProbabilityLess(long upperBound)
          Returns the probability an outcome will be less than or equal to the specified outcome.
 double entropy()
          Returns the entropy of this distribution.
 double log2Probability(long outcome)
          Returns the log (base 2) probability of the specified outcome.
 long maxOutcome()
          Returns the maximum outcome with non-zero probability.
 double mean()
          Returns the mean of this distribution.
 long minOutcome()
          Returns the minimum outcome with non-zero probability.
 double probability(long outcome)
          Returns the probability of the specified outcome.
 double variance()
          Returns the variance of this distribution.
 

Method Detail

probability

double probability(long outcome)
Returns the probability of the specified outcome.

Parameters:
outcome - The discrete outcome.
Returns:
The probability of the outcome in this distribution.

log2Probability

double log2Probability(long outcome)
Returns the log (base 2) probability of the specified outcome.

Parameters:
outcome - The discrete outcome.
Returns:
The log (base 2) probability of the outcome in this distribution.

cumulativeProbabilityLess

double cumulativeProbabilityLess(long upperBound)
Returns the probability an outcome will be less than or equal to the specified outcome. Implemented by calling the cumulative probability method with the minimum long value as lower bound and specified outcome as upper bound.

Parameters:
upperBound - Upper bound of the outcome.
Returns:
The cumulative probability of numbers less than or equal to the upper bound.

cumulativeProbabilityGreater

double cumulativeProbabilityGreater(long lowerBound)
Returns the probability an outcome will be greater than or equal to the specified outcome. This method is implemented by calling the two-argument cumulative probability method with the maximum long value as upper bound and specified outcome as lower bound.

Parameters:
lowerBound - Lower bound of outcomes considered.
Returns:
The cumulative probability of numbers greater than or equal to the lower bound.

cumulativeProbability

double cumulativeProbability(long lowerBound,
                             long upperBound)
Returns the probability that an outcome will fall in the range between the specified lower and upper bounds inclusive.

Parameters:
lowerBound - Lower bound of outcomes considered.
upperBound - Upper bound of the outcome.
Returns:
Probability that an outcome will be between the specified minium and maximum inclusive.

minOutcome

long minOutcome()
Returns the minimum outcome with non-zero probability. Distributions with no minimum outcome should return Long.MIN_VALUE.

Returns:
The minimum outcome with non-zero probability.

maxOutcome

long maxOutcome()
Returns the maximum outcome with non-zero probability. Distributions with no maximum should return Long.MAX_VALUE.

Returns:
The minimum outcome with non-zero probability.

mean

double mean()
Returns the mean of this distribution. Optional operation.

Returns:
The mean of this distribution.
Throws:
UnsupportedOperationException - If this operation is not supported.

variance

double variance()
Returns the variance of this distribution. Optional operation.

Returns:
The variance of this distribution.
Throws:
UnsupportedOperationException - If this operation is not supported.

entropy

double entropy()
Returns the entropy of this distribution. Optional operation.

Returns:
The entropy of this distribution.
Throws:
UnsupportedOperationException - If this operation is not supported.