SSJ API Documentation
Stochastic Simulation in Java
Loading...
Searching...
No Matches
umontreal.ssj.probdist.DiscreteDistributionInt Class Referenceabstract

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

Inheritance diagram for umontreal.ssj.probdist.DiscreteDistributionInt:
umontreal.ssj.probdist.Distribution umontreal.ssj.probdist.BernoulliDist umontreal.ssj.probdist.BinomialDist umontreal.ssj.probdist.GeometricDist umontreal.ssj.probdist.HypergeometricDist umontreal.ssj.probdist.LogarithmicDist umontreal.ssj.probdist.NegativeBinomialDist umontreal.ssj.probdist.PoissonDist umontreal.ssj.probdist.UniformIntDist

Public Member Functions

abstract double prob (int x)
 Returns \(p(x)\), the probability of \(x\).
double cdf (double x)
 Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )).
abstract double cdf (int x)
 Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )).
double barF (double x)
 Returns \(\bar{F}(x)\), the complementary distribution function.
double barF (int x)
 Returns \(\bar{F}(x)\), the complementary distribution function.
int getXinf ()
 Returns the lower limit \(x_a\) of the support of the probability mass function.
int getXsup ()
 Returns the upper limit \(x_b\) of the support of the probability mass function.
double inverseF (double u)
 Returns the inverse distribution function \(F^{-1}(u)\), where.
int inverseFInt (double u)
 Returns the inverse distribution function \(F^{-1}(u)\), where.
Public Member Functions inherited from umontreal.ssj.probdist.Distribution
double getMean ()
 Returns the mean of the distribution function.
double getVariance ()
 Returns the variance of the distribution function.
double getStandardDeviation ()
 Returns the standard deviation of the distribution function.
double[] getParams ()
 Returns the parameters of the distribution function in the same order as in the constructors.

Static Public Attributes

static double EPSILON = 1.0e-16
 Environment variable that determines what probability terms can be considered as negligible when building precomputed tables for distribution and mass functions.

Detailed Description

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

It specifies the signatures of methods for computing the mass function (or probability) \(p(x) = P[X=x]\), distribution function \(F(x)\), complementary distribution function

\(\bar{F}(x)\), and inverse distribution function \(F^{-1}(u)\), for a random variable \(X\) with a discrete distribution over the integers.

WARNING: the complementary distribution function is defined as \(\bar{F}(j) = P[X \ge j]\) (for integers \(j\), so that for discrete distributions in SSJ, \(F(j) + \bar{F}(j) \neq1\) since both include the term \(P[X = j]\).

The implementing classes provide both static and non-static methods to compute the above functions. The non-static methods require the creation of an object of class umontreal.ssj.probdist.DiscreteDistributionInt; all the non-negligible terms of the mass and distribution functions will be precomputed by the constructor and kept in arrays. Subsequent accesses will be very fast. The static methods do not require the construction of an object. These static methods are not specified in this abstract class because the number and types of their parameters depend on the distribution. When methods have to be called several times with the same parameters for the distributions, it is usually more efficient to create an object and use its non-static methods instead of the static ones. This trades memory for speed.

Definition at line 62 of file DiscreteDistributionInt.java.

Member Function Documentation

◆ barF() [1/2]

double umontreal.ssj.probdist.DiscreteDistributionInt.barF ( double x)

Returns \(\bar{F}(x)\), the complementary distribution function.

Calls the barF(int) method.

Parameters
xvalue at which the complementary distribution function must be evaluated
Returns
the complementary distribution function evaluated at x

Implements umontreal.ssj.probdist.Distribution.

Definition at line 132 of file DiscreteDistributionInt.java.

◆ barF() [2/2]

double umontreal.ssj.probdist.DiscreteDistributionInt.barF ( int x)

Returns \(\bar{F}(x)\), the complementary distribution function.

See the WARNING above. The default implementation returns 1.0 - cdf(x - 1), which is not accurate when \(F(x)\) is near 1.

Parameters
xvalue at which the complementary distribution function must be evaluated
Returns
the complementary distribution function evaluated at x

Reimplemented in umontreal.ssj.probdist.BernoulliDist, umontreal.ssj.probdist.BinomialDist, umontreal.ssj.probdist.GeometricDist, umontreal.ssj.probdist.HypergeometricDist, umontreal.ssj.probdist.LogarithmicDist, umontreal.ssj.probdist.NegativeBinomialDist, umontreal.ssj.probdist.PoissonDist, and umontreal.ssj.probdist.UniformIntDist.

Definition at line 145 of file DiscreteDistributionInt.java.

◆ cdf() [1/2]

double umontreal.ssj.probdist.DiscreteDistributionInt.cdf ( double x)

Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )).

Calls the cdf(int) method.

Parameters
xvalue at which the distribution function must be evaluated
Returns
the distribution function evaluated at x

Implements umontreal.ssj.probdist.Distribution.

Definition at line 111 of file DiscreteDistributionInt.java.

◆ cdf() [2/2]

abstract double umontreal.ssj.probdist.DiscreteDistributionInt.cdf ( int x)
abstract

Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )).

Parameters
xvalue at which the distribution function must be evaluated
Returns
the distribution function evaluated at x

Reimplemented in umontreal.ssj.probdist.BernoulliDist, umontreal.ssj.probdist.BinomialDist, umontreal.ssj.probdist.GeometricDist, umontreal.ssj.probdist.HypergeometricDist, umontreal.ssj.probdist.LogarithmicDist, umontreal.ssj.probdist.NegativeBinomialDist, umontreal.ssj.probdist.PoissonDist, and umontreal.ssj.probdist.UniformIntDist.

◆ getXinf()

int umontreal.ssj.probdist.DiscreteDistributionInt.getXinf ( )

Returns the lower limit \(x_a\) of the support of the probability mass function.

The probability is 0 for all \(x < x_a\).

Returns
\(x\) lower limit of support

Definition at line 155 of file DiscreteDistributionInt.java.

◆ getXsup()

int umontreal.ssj.probdist.DiscreteDistributionInt.getXsup ( )

Returns the upper limit \(x_b\) of the support of the probability mass function.

The probability is 0 for all \(x > x_b\).

Returns
\(x\) upper limit of support

Definition at line 165 of file DiscreteDistributionInt.java.

◆ inverseF()

double umontreal.ssj.probdist.DiscreteDistributionInt.inverseF ( double u)

Returns the inverse distribution function \(F^{-1}(u)\), where.

\(0\le u\le1\). Calls the inverseFInt method.

Parameters
uvalue in the interval \((0,1)\) for which the inverse distribution function is evaluated
Returns
the inverse distribution function evaluated at u
Exceptions
IllegalArgumentExceptionif \(u\) is not in the interval \((0,1)\)
ArithmeticExceptionif the inverse cannot be computed, for example if it would give infinity in a theoritical context

Implements umontreal.ssj.probdist.Distribution.

Definition at line 183 of file DiscreteDistributionInt.java.

◆ inverseFInt()

int umontreal.ssj.probdist.DiscreteDistributionInt.inverseFInt ( double u)

Returns the inverse distribution function \(F^{-1}(u)\), where.

\(0\le u\le1\). The default implementation uses binary search.

Parameters
uvalue in the interval \((0,1)\) for which the inverse distribution function is evaluated
Returns
the inverse distribution function evaluated at u
Exceptions
IllegalArgumentExceptionif \(u\) is not in the interval \((0,1)\)
ArithmeticExceptionif the inverse cannot be computed, for example if it would give infinity in a theoritical context

Reimplemented in umontreal.ssj.probdist.BernoulliDist, umontreal.ssj.probdist.BinomialDist, umontreal.ssj.probdist.GeometricDist, umontreal.ssj.probdist.HypergeometricDist, umontreal.ssj.probdist.LogarithmicDist, umontreal.ssj.probdist.NegativeBinomialDist, umontreal.ssj.probdist.PoissonDist, and umontreal.ssj.probdist.UniformIntDist.

Definition at line 201 of file DiscreteDistributionInt.java.

◆ prob()

abstract double umontreal.ssj.probdist.DiscreteDistributionInt.prob ( int x)
abstract

Member Data Documentation

◆ EPSILON

double umontreal.ssj.probdist.DiscreteDistributionInt.EPSILON = 1.0e-16
static

Environment variable that determines what probability terms can be considered as negligible when building precomputed tables for distribution and mass functions.

Probabilities smaller than EPSILON are not stored in the umontreal.ssj.probdist.DiscreteDistribution objects (such as those of class PoissonDist, etc.), but are computed directly each time they are needed (which should be very seldom). The default value is set to \(10^{-16}\).

Definition at line 73 of file DiscreteDistributionInt.java.


The documentation for this class was generated from the following file: