## 8 Probability Distributions## 8.1 OverviewThe distributions package provides a framework and implementations for some commonly used probability distributions. Continuous univariate distributions are represented by implementations of the RealDistribution interface. Discrete distributions implement IntegerDistribution (values must be mapped to integers) and there is an EnumeratedDistribution class representing discrete distributions with a finite, enumerated set of values. Finally, multivariate real-valued distributions can be represented via the MultivariateRealDistribution interface.
An overview of available continuous distributions: ## 8.2 Distribution Framework
The distribution framework provides the means to compute probability density
functions (
For an instance TDistribution t = new TDistribution(29); double lowerTail = t.cumulativeProbability(-2.656); // P(T(29) <= -2.656) double upperTail = 1.0 - t.cumulativeProbability(2.75); // P(T(29) >= 2.75)
All distributions implement a
Inverse distribution functions can be computed using the
```
``` where `X` is distributed as `f` .For discrete `f` , the definition is the same, with `Z` (the integers)
in place of `R` . Note that in the discrete case, the ≥ in the definition
can make a difference when `p` is an attained value of the distribution.
## 8.3 User Defined DistributionsUser-defined distributions can be implemented using RealDistribution, IntegerDistribution and MultivariateRealDistribution interfaces serve as base types. These serve as the basis for all the distributions directly supported by Apache Commons Math. To aid in implementing distributions, the AbstractRealDistribution, AbstractIntegerDistribution and AbstractMultivariateRealDistribution provide implementation building blocks and offer basic distribution functionality. By extending these abstract classes directly, much of the repetitive distribution implementation is already developed and should save time and effort in developing user-defined distributions. |