com.aliasi.stats

## Class PoissonDistribution

• All Implemented Interfaces:
DiscreteDistribution
Direct Known Subclasses:
PoissonConstant, PoissonEstimator

```public abstract class PoissonDistribution
extends AbstractDiscreteDistribution```
The `PoissonDistribution` abstract class is used for calculating Poisson distributions. Poisson distributions are limits of Poisson processes, and are used to model rates of occurrences of events within a fixed period (of time, space, etc.). Poisson distributions are good models of lengths of texts or the rate of occurrence of words in text, as well as many other natural phenomena.

The Poisson distribution is a parametric discrete distribution with a single parameter `λ > 0` which is the average rate of occurrence of events in a period. The resulting distribution provides a likelihood for each non-negative number of outcomes. Specifically, the Poisson distribution with rate parameter λ is defined for `k > 0` by:

``` Poissonλ(k) = e-λ λk / k! ```
Note that this definition produces a properly normalized probability distribution over natural numbers; if ```λ > 0```, then:
``` Σk >= 0 Poissonλ(k) = 1.0 ```
The expected value of a Poisson distribution is equal to the rate parameter:
``` E(Poissonλ) = λ ```
The variance is also equal to the rate parameter:
``` Var(Poissonλ) =def E([Poissonλ - E(Poissonλ)]2) = λ ```

Concrete subclasses need only implement the abstract `mean()` method; the method `log2Probability(long)` computes the log (base 2) of the Poisson probability estimate for a given number of outcomes in terms of the value of the rate parameter `lambda()`. Logarithms are used to prevent over- and underflow in calculations.

Since:
LingPipe2.0
Version:
2.0
Author:
Bob Carpenter
• ### Constructor Summary

Constructors
Modifier Constructor and Description
`protected ` `PoissonDistribution()`
Construct an abstract Poisson distribution.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`double` `log2Probability(long outcome)`
Returns the log (base 2) probability estimate in this Poisson distribution for the specified outcome.
`abstract double` `mean()`
Returns the mean of this Poisson distribution, which is equal to the rate parameter λ.
`long` `minOutcome()`
Returns the minimum outcome with non-zero probability, `0`.
`double` `probability(long outcome)`
Returns the probability estimate in this Poisson distribution for the specified outcome.
`double` `variance()`
Returns the variance of this Poisson distribution, which is equal to the mean.
• ### Methods inherited from class com.aliasi.stats.AbstractDiscreteDistribution

`cumulativeProbability, cumulativeProbabilityGreater, cumulativeProbabilityLess, entropy, maxOutcome`
• ### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### PoissonDistribution

`protected PoissonDistribution()`
Construct an abstract Poisson distribution.
• ### Method Detail

• #### mean

`public abstract double mean()`
Returns the mean of this Poisson distribution, which is equal to the rate parameter λ. Concrete implementations are responsible for ensuring that the mean is positive and finite.
Specified by:
`mean` in interface `DiscreteDistribution`
Overrides:
`mean` in class `AbstractDiscreteDistribution`
Returns:
The mean of this distribution.
• #### variance

`public double variance()`
Returns the variance of this Poisson distribution, which is equal to the mean.
Specified by:
`variance` in interface `DiscreteDistribution`
Overrides:
`variance` in class `AbstractDiscreteDistribution`
Returns:
The variance of this distribution.
• #### minOutcome

`public long minOutcome()`
Returns the minimum outcome with non-zero probability, `0`.
Specified by:
`minOutcome` in interface `DiscreteDistribution`
Overrides:
`minOutcome` in class `AbstractDiscreteDistribution`
Returns:
Zero.
• #### log2Probability

`public final double log2Probability(long outcome)`
Returns the log (base 2) probability estimate in this Poisson distribution for the specified outcome. This method will throw an illegal state exception if the mean implementation returns a non-positive number. If the outcome is negative, the result will be negative-infinity.
Specified by:
`log2Probability` in interface `DiscreteDistribution`
Overrides:
`log2Probability` in class `AbstractDiscreteDistribution`
Parameters:
`outcome` - The outcome being estimated.
Returns:
The log (base 2) probability of finding the specified number of outcomes given this distribution's rate parameter.
Throws:
`IllegalStateException` - if the mean is not a positive finite value.
• #### probability

`public final double probability(long outcome)`
Returns the probability estimate in this Poisson distribution for the specified outcome. Note that if the outcome is negative, the result will be zero.
Specified by:
`probability` in interface `DiscreteDistribution`
Specified by:
`probability` in class `AbstractDiscreteDistribution`
Parameters:
`outcome` - The outcome whose probability is returned.
Returns:
The log (base 2) probability of finding the specified number of outcomes given this distribution's rate parameter.
Throws:
`IllegalStateException` - If the mean is not a positive finite value.