SSJ  3.3.1
Stochastic Simulation in Java
Public Member Functions | Static Public Member Functions | List of all members

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

Inheritance diagram for PoissonDist:
[legend]
Collaboration diagram for PoissonDist:
[legend]

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)
 
double cdf (int x)
 
double barF (int x)
 
int inverseFInt (double u)
 
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 DiscreteDistributionInt
abstract double prob (int x)
 Returns \(p(x)\), the probability of \(x\). More...
 
double cdf (double x)
 Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )). More...
 
abstract double cdf (int x)
 Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )). More...
 
double barF (double x)
 Returns \(\bar{F}(x)\), the complementary distribution function. More...
 
double barF (int x)
 Returns \(\bar{F}(x)\), the complementary distribution function. More...
 
int getXinf ()
 Returns the lower limit \(x_a\) of the support of the probability mass function. More...
 
int getXsup ()
 Returns the upper limit \(x_b\) of the support of the probability mass function. More...
 
double inverseF (double u)
 Returns the inverse distribution function \(F^{-1}(u)\), where. More...
 
int inverseFInt (double u)
 Returns the inverse distribution function \(F^{-1}(u)\), where. More...
 

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 ). More...
 
static double cdf (double lambda, int x)
 Computes and returns the value of the Poisson distribution function \(F(x)\) for \(\lambda= \) lambda, as defined in ( FPoisson ). More...
 
static double barF (double lambda, int x)
 Computes and returns the value of the complementary Poisson distribution function, for \(\lambda= \) lambda. More...
 
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 \(x[i]\), \(i = 0, 1, …, n-1\). More...
 
static PoissonDist getInstanceFromMLE (int[] x, int n)
 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\). More...
 
static double getMean (double lambda)
 Computes and returns the mean \(E[X] = \lambda\) of the Poisson distribution with parameter \(\lambda\). More...
 
static double getVariance (double lambda)
 Computes and returns the variance \(= \lambda\) of the Poisson distribution with parameter \(\lambda\). More...
 
static double getStandardDeviation (double lambda)
 Computes and returns the standard deviation of the Poisson distribution with parameter \(\lambda\). More...
 

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 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. More...
 

Additional Inherited Members

- Protected Attributes inherited from DiscreteDistributionInt
double cdf [] = null
 
double pdf [] = null
 
int xmin = 0
 
int xmax = 0
 
int xmed = 0
 
int supportA = Integer.MIN_VALUE
 
int supportB = Integer.MAX_VALUE
 
- Static Protected Attributes inherited from DiscreteDistributionInt
static final double EPS_EXTRA = 1.0e-6
 

Detailed Description

Extends the class DiscreteDistributionInt for the Poisson distribution [118]  (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)\).

Member Function Documentation

◆ barF()

static double 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]\).

◆ cdf()

static double 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 ).

◆ getInstanceFromMLE()

static 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

◆ getMean()

static double 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\)

◆ getMLE()

static double [] 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 [118]  (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}\)]

◆ getStandardDeviation()

static double 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

◆ getVariance()

static double 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\)

◆ prob()

static double 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.


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