public abstract class DiscreteDistributionInt extends java.lang.Object implements Distribution
WARNING: the complementary distribution function is defined as bar(F)(j) = P[X >= j] (for integers j, so that for discrete distributions in SSJ, F(j) + bar(F)(j)≠1 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 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.
| Modifier and Type | Field and Description |
|---|---|
static double |
EPSILON
Environment variable that determines what probability terms can
be considered as negligible when building precomputed tables for
distribution and mass functions.
|
| Constructor and Description |
|---|
DiscreteDistributionInt() |
| Modifier and Type | Method and Description |
|---|---|
double |
barF(double x)
Returns bar(F)(x), the complementary distribution function.
|
double |
barF(int x)
Returns bar(F)(x), the complementary
distribution function.
|
double |
cdf(double x)
Returns the distribution function F evaluated at x
(see).
|
abstract double |
cdf(int x)
Returns the distribution function F evaluated at x
(see).
|
int |
getXinf()
Returns the lower limit xa of the support of the probability
mass function.
|
int |
getXsup()
Returns the upper limit xb of the support of the probability
mass function.
|
double |
inverseF(double u)
Returns the inverse distribution function
F-1(u), where
0 <= u <= 1.
|
int |
inverseFInt(double u)
Returns the inverse distribution function
F-1(u), where
0 <= u <= 1.
|
abstract double |
prob(int x)
Returns p(x), the probability of x,
which should be a real number in the interval [0, 1].
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetMean, getParams, getStandardDeviation, getVariancepublic static double EPSILON
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.public abstract double prob(int x)
x - value at which the mass function must be evaluatedpublic double cdf(double x)
cdf(int) method.cdf in interface Distributionx - value at which the distribution function must be evaluatedpublic abstract double cdf(int x)
x - value at which the distribution function must be evaluatedpublic double barF(double x)
barF(int) method.barF in interface Distributionx - value at which the complementary distribution function
must be evaluatedpublic double barF(int x)
x - value at which the complementary distribution function
must be evaluatedpublic int getXinf()
public int getXsup()
public double inverseF(double u)
inverseF in interface Distributionu - value in the interval (0, 1) for which
the inverse distribution function is evaluatedjava.lang.IllegalArgumentException - if u is not in the interval (0, 1)java.lang.ArithmeticException - if the inverse cannot be computed,
for example if it would give infinity in a theoritical contextpublic int inverseFInt(double u)
u - value in the interval (0, 1) for which
the inverse distribution function is evaluatedjava.lang.IllegalArgumentException - if u is not in the interval (0, 1)java.lang.ArithmeticException - if the inverse cannot be computed,
for example if it would give infinity in a theoritical contextTo submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.