SSJ  3.3.1 Stochastic Simulation in Java
Package umontreal.ssj.probdist

Probability distributions. More...

## Classes

class  AndersonDarlingDist
Extends the class ContinuousDistribution for the Anderson–Darling distribution (see [6], [165], [173], [225] ). More...

class  AndersonDarlingDistQuick
Extends the class AndersonDarlingDist for the Anderson–Darling distribution (see [6], [165], [225] ). More...

class  BernoulliDist
Extends the class DiscreteDistributionInt for the Bernoulli distribution [118]  with parameter $$p$$, where $$0\le p\le1$$. More...

Extends the class ContinuousDistribution for the beta distribution [100]  (page 210) with shape parameters $$\alpha> 0$$ and $$\beta> 0$$, over the interval $$[a,b]$$, where $$a < b$$. More...

class  BetaSymmetricalDist
Specializes the class BetaDist to the case of a symmetrical beta distribution over the interval $$[0,1]$$, with shape parameters $$\alpha= \beta$$. More...

class  BinomialDist
Extends the class DiscreteDistributionInt for the binomial distribution [118]  (page 321) with parameters $$n$$ and $$p$$, where $$n$$ is a positive integer and $$0\le p\le1$$. More...

class  CauchyDist
Extends the class ContinuousDistribution for the Cauchy distribution [99]  (page 299) with location parameter $$\alpha$$ and scale parameter $$\beta> 0$$. More...

class  ChiDist
Extends the class ContinuousDistribution for the chi distribution [99]  (page 417) with shape parameter $$\nu > 0$$, where the number of degrees of freedom $$\nu$$ is a positive integer. More...

class  ChiSquareDist
Extends the class ContinuousDistribution for the chi-square distribution with $$n$$ degrees of freedom, where $$n$$ is a positive integer [99]  (page 416). More...

class  ChiSquareDistQuick
Provides a variant of ChiSquareDist with faster but less accurate methods. More...

class  ChiSquareNoncentralDist
Extends the class ContinuousDistribution for the noncentral chi-square distribution with $$\nu$$ degrees of freedom and noncentrality parameter $$\lambda$$, where $$\nu> 0$$ and $$\lambda> 0$$ [100]  (page 436). More...

class  ConstantDist
Represents a constant discrete distribution taking a single real value with probability 1. More...

class  ConstantIntDist
Represents a constant discrete distribution taking a single integer value with probability 1. More...

class  ContinuousDistribution
Classes implementing continuous distributions should inherit from this base class. More...

class  CramerVonMisesDist
Extends the class ContinuousDistribution for the Cramér-von Mises distribution (see [55], [224], [225] ). More...

class  DiscreteDistribution
This class implements discrete distributions over a finite set of real numbers (also over integers as a particular case). More...

class  DiscreteDistributionInt
Classes implementing discrete distributions over the integers should inherit from this class. More...

interface  Distribution
This interface should be implemented by all classes supporting discrete and continuous distributions. More...

class  DistributionFactory
This class implements a string API for the package probdist. More...

class  EmpiricalDist
Extends DiscreteDistribution to an empirical distribution function, based on the observations $$X_{(1)},…,X_{(n)}$$ (sorted by increasing order). More...

class  ErlangDist
Extends the class GammaDist for the special case of the Erlang distribution with shape parameter $$k > 0$$ and scale parameter $$\lambda> 0$$. More...

class  ExponentialDist
Extends the class ContinuousDistribution for the exponential distribution [99]  (page 494) with mean $$1/\lambda$$ where $$\lambda> 0$$. More...

class  ExponentialDistFromMean
Extends the ExponentialDist class with a constructor accepting as argument the mean $$1/\lambda$$ instead of the rate $$\lambda$$. More...

class  ExtremeValueDist
This class has been replaced by GumbelDist . More...

class  FatigueLifeDist
Extends the class ContinuousDistribution for the fatigue life distribution [20]  with location parameter $$\mu$$, scale parameter $$\beta$$ and shape parameter $$\gamma$$. More...

class  FisherFDist
Extends the class ContinuousDistribution for the Fisher F distribution with $$n_1$$ and $$n_2$$ degrees of freedom, where $$n_1$$ and $$n_2$$ are positive integers. More...

class  FoldedNormalDist
Extends the class ContinuousDistribution for the folded normal distribution with parameters $$\mu\ge0$$ and $$\sigma> 0$$. More...

class  FrechetDist
Extends the class ContinuousDistribution for the Fréchet distribution [100]  (page 3), with location parameter $$\delta$$, scale parameter $$\beta> 0$$, and shape parameter $$\alpha> 0$$, where we use the notation $$z = (x-\delta)/\beta$$. More...

Extends the class ContinuousDistribution for the gamma distribution [99]  (page 337) with shape parameter $$\alpha> 0$$ and scale parameter $$\lambda> 0$$. More...

Extends the GammaDist distribution with constructors accepting the mean $$\mu$$ and variance $$\sigma^2$$ as arguments instead of a shape parameter $$\alpha$$ and a scale parameter $$\lambda$$. More...

class  GeometricDist
Extends the class DiscreteDistributionInt for the geometric distribution [118]  (page 322) with parameter $$p$$, where $$0 < p < 1$$. More...

class  GumbelDist
Extends the class ContinuousDistribution for the Gumbel distribution [100]  (page 2), with location parameter $$\delta$$ and scale parameter $$\beta\neq0$$. More...

class  HalfNormalDist
Extends the class ContinuousDistribution for the half-normal distribution with parameters $$\mu$$ and $$\sigma> 0$$. More...

class  HyperbolicSecantDist
Extends the class ContinuousDistribution for the hyperbolic secant distribution with location parameter $$\mu$$ and scale parameter $$\sigma> 0$$. More...

class  HypergeometricDist
Extends the class DiscreteDistributionInt for the hypergeometric distribution [66]  (page 101) with $$k$$ elements chosen among $$l$$, $$m$$ being of one type, and $$l-m$$ of the other. More...

class  HypoExponentialDist
This class implements the hypoexponential distribution, also called the generalized Erlang distribution. More...

class  HypoExponentialDistEqual
This class implements the hypoexponential distribution for the case of equidistant $$\lambda_i = (n+1-i)h$$. More...

class  HypoExponentialDistQuick
This class is a subclass of HypoExponentialDist and also implements the hypoexponential distribution. More...

class  InverseDistFromDensity
Implements a method for computing the inverse of an arbitrary continuous distribution function when only the probability density is known [43] . More...

Extends the class ContinuousDistribution for the inverse gamma distribution with shape parameter $$\alpha> 0$$ and scale parameter $$\beta> 0$$, also known as the Pearson type V distribution. More...

class  InverseGaussianDist
Extends the class ContinuousDistribution for the inverse Gaussian distribution with location parameter $$\mu> 0$$ and scale parameter $$\lambda> 0$$. More...

class  JohnsonSBDist
Extends the class ContinuousDistribution for the Johnson $$S_B$$ distribution [101], [118], [63]  with shape parameters $$\gamma$$ and $$\delta> 0$$, location parameter $$\xi$$, and scale parameter $$\lambda>0$$. More...

class  JohnsonSLDist
Extends the class ContinuousDistribution for the Johnson $$S_L$$ distribution (see [101], [99] ). More...

class  JohnsonSUDist
Extends the class ContinuousDistribution for the Johnson $$S_U$$ distribution (see [118]  (page 316)). More...

class  JohnsonSystem
This class contains common parameters and methods for the Johnson system of distributions [101], [99]  with shape parameters $$\gamma$$ and $$\delta> 0$$, location parameter $$\xi$$, and scale parameter $$\lambda>0$$. More...

class  KolmogorovSmirnovDist
Extends the class ContinuousDistribution for the Kolmogorov-Smirnov distribution with parameter $$n$$ [55] . More...

class  KolmogorovSmirnovDistQuick
Extends the class KolmogorovSmirnovDist for the Kolmogorov–Smirnov distribution. More...

class  KolmogorovSmirnovPlusDist
Extends the class ContinuousDistribution for the Kolmogorov–Smirnov+ distribution (see [40], [55], [27] ). More...

class  LaplaceDist
Extends the class ContinuousDistribution for the Laplace distribution (see, e.g., [100]  (page 165)). More...

class  LogarithmicDist
Extends the class DiscreteDistributionInt for the logarithmic distribution. More...

class  LogisticDist
Extends the class ContinuousDistribution for the logistic distribution (e.g., [100]  (page 115)). More...

class  LoglogisticDist
Extends the class ContinuousDistribution for the Log-Logistic distribution with shape parameter $$\alpha> 0$$ and scale parameter $$\beta> 0$$. More...

class  LognormalDist
Extends the class ContinuousDistribution for the lognormal distribution [99] . More...

class  LognormalDistFromMoments
Extends the LognormalDist class with a constructor accepting the mean $$m$$ and the variance $$v$$ of the distribution as arguments. More...

class  NakagamiDist
Extends the class ContinuousDistribution for the Nakagami distribution with location parameter $$a$$, scale parameter $$\lambda> 0$$ and shape parameter $$c > 0$$. More...

class  NegativeBinomialDist
Extends the class DiscreteDistributionInt for the negative binomial distribution [118]  (page 324) with real parameters $$n$$ and $$p$$, where $$n > 0$$ and $$0\le p\le1$$. More...

class  NormalDist
Extends the class ContinuousDistribution for the normal distribution (e.g., [99]  (page 80)). More...

class  NormalDistQuick
A variant of the class NormalDist (for the normal distribution with mean $$\mu$$ and variance $$\sigma^2$$). More...

class  NormalInverseGaussianDist
Extends the class ContinuousDistribution for the normal inverse gaussian distribution with location parameter $$\mu$$, scale parameter $$\delta> 0$$, tail heavyness $$\alpha> 0$$, and asymmetry parameter $$\beta$$ such that $$0 \le|\beta| < \alpha$$. More...

class  ParetoDist
Extends the class ContinuousDistribution for a distribution from the Pareto family, with shape parameter $$\alpha> 0$$ and location parameter $$\beta> 0$$ [99]  (page 574). More...

class  PascalDist
The Pascal distribution is a special case of the negative binomial distribution [118]  (page 324) with parameters $$n$$ and $$p$$, where $$n$$ is a positive integer and $$0\le p\le1$$. More...

class  Pearson5Dist
THIS CLASS HAS BEEN RENAMED InverseGammaDist . More...

class  Pearson6Dist
Extends the class ContinuousDistribution for the Pearson type VI distribution with shape parameters $$\alpha_1 > 0$$ and $$\alpha_2 > 0$$, and scale parameter $$\beta> 0$$. More...

class  PiecewiseLinearEmpiricalDist
Extends the class ContinuousDistribution for a piecewise-linear approximation of the empirical distribution function, based on the observations $$X_{(1)},…,X_{(n)}$$ (sorted by increasing order), and defined as follows (e.g., [118]  (page 318)). More...

class  PoissonDist
Extends the class DiscreteDistributionInt for the Poisson distribution [118]  (page 325) with mean $$\lambda\ge0$$. More...

class  PowerDist
Extends the class ContinuousDistribution for the power distribution [57]  (page 161) with shape parameter $$c > 0$$, over the interval $$[a,b]$$, where $$a < b$$. More...

class  RayleighDist
This class extends the class ContinuousDistribution for the Rayleigh distribution [57]  with location parameter $$a$$, and scale parameter $$\beta> 0$$. More...

class  StudentDist
Extends the class ContinuousDistribution for the Student $$t$$-distribution [100]  (page 362) with $$n$$ degrees of freedom, where $$n$$ is a positive integer. More...

class  StudentDistQuick
Extends the class StudentDist for the Student $$t$$-distribution. More...

class  TriangularDist
Extends the class ContinuousDistribution for the triangular distribution (see [100]  (page 297) and [118]  (page 317)) with domain $$[a,b]$$ and mode (or shape parameter) $$m$$, where $$a\le m\le b$$. More...

class  TruncatedDist
This container class takes an arbitrary continuous distribution and truncates it to an interval $$[a,b]$$, where $$a$$ and $$b$$ can be finite or infinite. More...

class  UniformDist
Extends the class ContinuousDistribution for the uniform distribution [100]  (page 276) over the interval $$[a,b]$$. More...

class  UniformIntDist
Extends the class DiscreteDistributionInt for the discrete uniform distribution over the range $$[i,j]$$. More...

class  WatsonGDist
Extends the class ContinuousDistribution for the Watson $$G$$ distribution (see [41], [238] ). More...

class  WatsonUDist
Extends the class ContinuousDistribution for the Watson U distribution (see [55], [224], [225] ). More...

class  WeibullDist
This class extends the class ContinuousDistribution for the Weibull distribution [99]  (page 628) with shape parameter $$\alpha> 0$$, location parameter $$\delta$$, and scale parameter $$\lambda> 0$$. More...

## Detailed Description

Probability distributions.

This package contains Java classes that implement discrete and continuous univariate probability distributions. These classes provide methods to evaluate the probability density (or mass) function (pdf), the cumulative distribution function (cdf), the complementary cdf, the inverse cdf, some moments, etc. It also offers methods to estimate the parameters of some distributions from empirical data. It does not generate random variates; for that, see the package umontreal.ssj.randvar. One can plot the density or the cdf of a distribution either on screen, or in a LaTeX file, by using the package umontreal.ssj.charts.

#### Definitions

The cumulative distribution function (cdf) of a continuous random variable $$X$$ with probability density function (pdf) $$f$$ over the real line is

$F(x) = P[X\le x] = \int_{-\infty}^x f(s)ds \tag{FDist}$

while the cdf of a discrete random variable $$X$$ with probability mass function $$p$$ over a fixed set of real numbers $$x_0 < x_1 < x_2 < \cdots$$ is

$F(x) = P[X\le x] = \sum_{x_i\le x} p(x_i), \tag{FDistDisc}$

where $$p(x_i) = P[X = x_i]$$. Sometimes, the mass function is just called the pdf as well. It is the density with respect to a discrete measure.

We define $$\bar{F}$$, the complementary distribution function of $$X$$, by

$\bar{F} (x) = P[X\ge x].$

With this definition of $$\bar{F}$$, one has $$\bar{F}(x) = 1 - F (x)$$ for continuous distributions and $$\bar{F}(x) = 1 - F (x-1)$$ for discrete distributions over the integers. This definition is non-standard for the discrete case: we have $$\bar{F} (x) = P[X\ge x]$$ instead of $$\bar{F} (x) = P[X > x] = 1-F(x)$$. We find it more convenient especially for computing $$p$$-values in goodness-of-fit tests.

The inverse cumulative distribution function is defined as

$F^{-1}(u) = \inf\{x\in\mathbb{R}: F (x)\ge u\}, \tag{inverseF}$

for $$0\le u\le1$$. This function $$F^{-1}$$ is used among other things to generate the random variable $$X$$ by inversion, by passing a $$U (0,1)$$ random variate as the value of $$u$$.

### Distribution objects and static methods

The package probdist offers two types of tools for computing $$p$$, $$f$$, $$F$$, $$\bar{F}$$, and $$F^{-1}$$: static methods, for which no object needs to be created, and methods associated with distribution objects. Standard distributions are implemented each in their own class. Constructing an object from one of these classes can be convenient if $$F$$, $$\bar{F}$$, etc., has to be evaluated several times for the same distribution. In certain cases, creating the distribution object would precompute tables that would speed up significantly all subsequent method calls for computing $$F$$, $$\bar{F}$$, etc. This trades memory, plus a one-time setup cost, for speed. In addition to the non-static methods, the distribution classes also provide static methods that do not require the creation of an object.

The distribution classes extend one of the (abstract) classes umontreal.ssj.probdist.DiscreteDistribution and umontreal.ssj.probdist.ContinuousDistribution (which both implement the interface umontreal.ssj.probdist.Distribution ) for discrete and continuous distributions over the real numbers, or umontreal.ssj.probdist.DiscreteDistributionInt, for discrete distributions over the non-negative integers.

For example, the class umontreal.ssj.probdist.PoissonDist extends umontreal.ssj.probdist.DiscreteDistributionInt. Calling a static method from this class will compute the corresponding probability from scratch. Constructing a umontreal.ssj.probdist.PoissonDist object, on the other hand, will precompute tables that contain the probability terms and the distribution function for a given parameter $$\lambda$$ (the mean of the Poisson distribution). These tables will then be used whenever a method is called for the corresponding object. This second approach is recommended if some of $$F$$, $$\bar{F}$$, etc., has to be computed several times for the same parameter $$\lambda$$. As a rule of thumb, creating objects and using their methods is faster than just using static methods as soon as two or three calls are made, unless the parameters are large.

Only the non-negligible probability terms (those that exceed the threshold umontreal.ssj.probdist.DiscreteDistributionInt.EPSILON ) are stored in the tables. For $$F$$ and $$\bar{F}$$, a single table actually contains $$F (x)$$ for $$F (x) \le1/2$$ and $$1-F (x)$$ for $$F (x) > 1/2$$. When the distribution parameters are so large that the tables would take too much space, these are not created and the methods automatically call their static equivalents instead of using tables.

Objects that implement the interface umontreal.ssj.probdist.Distribution (and sometimes the abstract class umontreal.ssj.probdist.ContinuousDistribution ) are required by some methods in package umontreal.ssj.randvar and also in classes umontreal.ssj.gof.GofStat and umontreal.ssj.gof.GofFormat of package umontreal.ssj.gof.

Some of the classes in probdist also provide methods that compute parameter estimations of the corresponding distribution from a set of empirical observations, in most cases based on the maximum likelihood method.