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

Extends the class DiscreteDistributionInt for the Poisson distribution [114]  (page 325) with mean. More...

Inheritance diagram for umontreal.ssj.probdist.PoissonDist:
umontreal.ssj.probdist.DiscreteDistributionInt umontreal.ssj.probdist.Distribution

Public Member Functions

 PoissonDist (double lambda)
 Creates an object that contains the probability and distribution functions, for the Poisson distribution with parameter lambda, which are computed and stored in dynamic arrays inside that object.
double prob (int x)
 Returns \(p(x)\), the probability of \(x\).
double cdf (int x)
 Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )).
double barF (int x)
 Returns \(\bar{F}(x)\), the complementary distribution function.
int inverseFInt (double u)
 Returns the inverse distribution function \(F^{-1}(u)\), where.
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 getLambda ()
 Returns the \(\lambda\) associated with this object.
void setLambda (double lambda)
 Sets the \(\lambda\) associated with this object.
double[] getParams ()
 Return a table containing the parameter of the current distribution.
String toString ()
 Returns a String containing information about the current distribution.
Public Member Functions inherited from umontreal.ssj.probdist.DiscreteDistributionInt
double cdf (double x)
 Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )).
double barF (double 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.

Static Public Member Functions

static double prob (double lambda, int x)
 Computes and returns the Poisson probability \(p(x)\) for \(\lambda= \) lambda, as defined in ( fmass-Poisson ).
static double cdf (double lambda, int x)
 Computes and returns the value of the Poisson distribution function.
static double barF (double lambda, int x)
 Computes and returns the value of the complementary Poisson distribution function, for \(\lambda= \) lambda.
static int inverseF (double lambda, double u)
 Performs a linear search to get the inverse function without precomputed tables.
static double[] getMLE (int[] x, int n)
 Estimates the parameter \(\lambda\) of the Poisson distribution using the maximum likelihood method, from the \(n\) observations.
static PoissonDist getInstanceFromMLE (int[] x, int n)
 Creates a new instance of a Poisson distribution with parameter.
static double getMean (double lambda)
 Computes and returns the mean \(E[X] = \lambda\) of the Poisson distribution with parameter \(\lambda\).
static double getVariance (double lambda)
 Computes and returns the variance \(= \lambda\) of the Poisson distribution with parameter \(\lambda\).
static double getStandardDeviation (double lambda)
 Computes and returns the standard deviation of the Poisson distribution with parameter \(\lambda\).

Static Public Attributes

Constant @{
static double MAXLAMBDA = 100000
 The value of the parameter \(\lambda\) above which the tables are not precomputed by the constructor.
Static Public Attributes inherited from umontreal.ssj.probdist.DiscreteDistributionInt
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

Extends the class DiscreteDistributionInt for the Poisson distribution [114]  (page 325) with mean.

\(\lambda\ge0\). The mass function is

\begin{align} p(x) & = \frac{e^{-\lambda} \lambda^x}{x!}, \qquad\mbox{for } x=0,1,…\tag{fmass-Poisson} \end{align}

and the distribution function is

\begin{align} F(x) & = e^{-\lambda} \sum_{j=0}^x\; \frac{\lambda^j}{j!}, \qquad\mbox{for } x=0,1,…. \tag{FPoisson} \end{align}

If one has to compute \(p(x)\) and/or \(F(x)\) for several values of \(x\) with the same \(\lambda\), where \(\lambda\) is not too large, then it is more efficient to instantiate an object and use the non-static methods, since the functions will then be computed once and kept in arrays.

For the static methods that compute \(F(x)\) and \(\bar{F}(x)\), we exploit the relationship \(F(x) = 1 - G_{x+1}(\lambda)\), where \(G_{x+1}\) is the gamma distribution function with parameters \((\alpha,\lambda) = (x+1, 1)\).

Definition at line 56 of file PoissonDist.java.

Constructor & Destructor Documentation

◆ PoissonDist()

umontreal.ssj.probdist.PoissonDist.PoissonDist ( double lambda)

Creates an object that contains the probability and distribution functions, for the Poisson distribution with parameter lambda, which are computed and stored in dynamic arrays inside that object.

Definition at line 79 of file PoissonDist.java.

Member Function Documentation

◆ barF() [1/2]

double umontreal.ssj.probdist.PoissonDist.barF ( double lambda,
int x )
static

Computes and returns the value of the complementary Poisson distribution function, for \(\lambda= \) lambda.

WARNING: The complementary distribution function is defined as \(\bar{F}(x) = P[X \ge x]\).

Definition at line 285 of file PoissonDist.java.

◆ barF() [2/2]

double umontreal.ssj.probdist.PoissonDist.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 from umontreal.ssj.probdist.DiscreteDistributionInt.

Definition at line 139 of file PoissonDist.java.

◆ cdf() [1/2]

double umontreal.ssj.probdist.PoissonDist.cdf ( double lambda,
int x )
static

Computes and returns the value of the Poisson distribution function.

\(F(x)\) for \(\lambda= \) lambda, as defined in ( FPoisson ). To compute \(F(x)\), all non-negligible terms of the sum are added if \(\lambda\le200\); otherwise, the relationship \(F_{\lambda}(x) = 1 - G_{x + 1}(\lambda)\) is used, where \(G_{x+1}\) is the gamma distribution function with parameter \(\alpha= x+1\) (see GammaDist ).

Definition at line 234 of file PoissonDist.java.

◆ cdf() [2/2]

double umontreal.ssj.probdist.PoissonDist.cdf ( int x)

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 from umontreal.ssj.probdist.DiscreteDistributionInt.

Definition at line 93 of file PoissonDist.java.

◆ getInstanceFromMLE()

PoissonDist umontreal.ssj.probdist.PoissonDist.getInstanceFromMLE ( int[] x,
int n )
static

Creates a new instance of a Poisson distribution with parameter.

\(\lambda\) estimated using the maximum likelihood method based on the \(n\) observations \(x[i]\), \(i = 0, 1, …, n-1\).

Parameters
xthe list of observations to use to evaluate parameters
nthe number of observations to use to evaluate parameters

Definition at line 442 of file PoissonDist.java.

◆ getLambda()

double umontreal.ssj.probdist.PoissonDist.getLambda ( )

Returns the \(\lambda\) associated with this object.

Definition at line 490 of file PoissonDist.java.

◆ getMean() [1/2]

double umontreal.ssj.probdist.PoissonDist.getMean ( )

Returns the mean of the distribution function.

Implements umontreal.ssj.probdist.Distribution.

Definition at line 176 of file PoissonDist.java.

◆ getMean() [2/2]

double umontreal.ssj.probdist.PoissonDist.getMean ( double lambda)
static

Computes and returns the mean \(E[X] = \lambda\) of the Poisson distribution with parameter \(\lambda\).

Returns
the mean of the Poisson distribution \(E[X] = \lambda\)

Definition at line 453 of file PoissonDist.java.

◆ getMLE()

double[] umontreal.ssj.probdist.PoissonDist.getMLE ( int[] x,
int n )
static

Estimates the parameter \(\lambda\) of the Poisson distribution using the maximum likelihood method, from the \(n\) observations.

\(x[i]\), \(i = 0, 1, …, n-1\). The maximum likelihood estimator \(\hat{\lambda}\) satisfy the equation \(\hat{\lambda} = \bar{x}_n\), where \(\bar{x}_n\) is the average of \(x[0], …, x[n-1]\) (see [114]  (page 326)).

Parameters
xthe list of observations used to evaluate parameters
nthe number of observations used to evaluate parameters
Returns
returns the parameter [ \(\hat{\lambda}\)]

Definition at line 419 of file PoissonDist.java.

◆ getParams()

double[] umontreal.ssj.probdist.PoissonDist.getParams ( )

Return a table containing the parameter of the current distribution.

Implements umontreal.ssj.probdist.Distribution.

Definition at line 601 of file PoissonDist.java.

◆ getStandardDeviation() [1/2]

double umontreal.ssj.probdist.PoissonDist.getStandardDeviation ( )

Returns the standard deviation of the distribution function.

Implements umontreal.ssj.probdist.Distribution.

Definition at line 184 of file PoissonDist.java.

◆ getStandardDeviation() [2/2]

double umontreal.ssj.probdist.PoissonDist.getStandardDeviation ( double lambda)
static

Computes and returns the standard deviation of the Poisson distribution with parameter \(\lambda\).

Returns
the standard deviation of the Poisson distribution

Definition at line 480 of file PoissonDist.java.

◆ getVariance() [1/2]

double umontreal.ssj.probdist.PoissonDist.getVariance ( )

Returns the variance of the distribution function.

Implements umontreal.ssj.probdist.Distribution.

Definition at line 180 of file PoissonDist.java.

◆ getVariance() [2/2]

double umontreal.ssj.probdist.PoissonDist.getVariance ( double lambda)
static

Computes and returns the variance \(= \lambda\) of the Poisson distribution with parameter \(\lambda\).

Returns
the variance of the Poisson distribution \(\mbox{Var}[X] = \lambda\)

Definition at line 467 of file PoissonDist.java.

◆ inverseF()

int umontreal.ssj.probdist.PoissonDist.inverseF ( double lambda,
double u )
static

Performs a linear search to get the inverse function without precomputed tables.

Definition at line 334 of file PoissonDist.java.

◆ inverseFInt()

int umontreal.ssj.probdist.PoissonDist.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 from umontreal.ssj.probdist.DiscreteDistributionInt.

Definition at line 170 of file PoissonDist.java.

◆ prob() [1/2]

double umontreal.ssj.probdist.PoissonDist.prob ( double lambda,
int x )
static

Computes and returns the Poisson probability \(p(x)\) for \(\lambda= \) lambda, as defined in ( fmass-Poisson ).

If \(\lambda\ge20\), this (static) method uses the logarithm of the gamma function, defined in ( Gamma ), to estimate the density.

Definition at line 197 of file PoissonDist.java.

◆ prob() [2/2]

double umontreal.ssj.probdist.PoissonDist.prob ( int x)

Returns \(p(x)\), the probability of \(x\).

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

Reimplemented from umontreal.ssj.probdist.DiscreteDistributionInt.

Definition at line 83 of file PoissonDist.java.

◆ setLambda()

void umontreal.ssj.probdist.PoissonDist.setLambda ( double lambda)

Sets the \(\lambda\) associated with this object.

Definition at line 497 of file PoissonDist.java.

◆ toString()

String umontreal.ssj.probdist.PoissonDist.toString ( )

Returns a String containing information about the current distribution.

Definition at line 609 of file PoissonDist.java.

Member Data Documentation

◆ MAXLAMBDA

double umontreal.ssj.probdist.PoissonDist.MAXLAMBDA = 100000
static

The value of the parameter \(\lambda\) above which the tables are not precomputed by the constructor.

Definition at line 68 of file PoissonDist.java.


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