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 geometric distribution [118]  (page 322) with parameter \(p\), where \(0 < p < 1\). More...

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

Public Member Functions

 GeometricDist (double p)
 Constructs a geometric distribution with parameter \(p\).
 
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 getP ()
 Returns the \(p\) associated with this object.
 
void setP (double p)
 Resets the value of \(p\) associated with this object.
 
double [] getParams ()
 Return a table containing the parameters 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 p, int x)
 Computes the geometric probability \(p(x)\) given in ( fgeom ) .
 
static double cdf (double p, int x)
 Computes the distribution function \(F(x)\).
 
static double barF (double p, int x)
 Computes the complementary distribution function. More...
 
static int inverseF (double p, double u)
 Computes the inverse of the geometric distribution, given by ( FInvgeom ).
 
static double [] getMLE (int[] x, int n)
 Estimates the parameter \(p\) of the geometric distribution using the maximum likelihood method, from the \(n\) observations \(x[i]\), \(i = 0, 1, …, n-1\). More...
 
static GeometricDist getInstanceFromMLE (int[] x, int n)
 Creates a new instance of a geometric distribution with parameter \(p\) estimated using the maximum likelihood method based on the \(n\) observations \(x[i]\), \(i = 0, 1, …, n-1\). More...
 
static double getMean (double p)
 Computes and returns the mean \(E[X] = (1 - p)/p\) of the geometric distribution with parameter \(p\). More...
 
static double getVariance (double p)
 Computes and returns the variance \(\mbox{Var}[X] = (1 - p)/p^2\) of the geometric distribution with parameter \(p\). More...
 
static double getStandardDeviation (double p)
 Computes and returns the standard deviation of the geometric distribution with parameter \(p\). More...
 

Additional Inherited Members

- 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...
 
- 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 geometric distribution [118]  (page 322) with parameter \(p\), where \(0 < p < 1\).

Its mass function is

\[ p (x) = p  (1-p)^x, \qquad\mbox{for } x = 0, 1, 2, …\tag{fgeom} \]

The distribution function is given by

\[ F (x) = 1 - (1-p)^{x+1}, \qquad\mbox{for } x = 0, 1, 2, …\tag{Fgeom} \]

and its inverse is

\[ F^{-1}(u) = \left\lfloor\frac{\ln(1 - u)}{\ln(1 - p)} \right\rfloor, \qquad\mbox{for } 0 \le u < 1. \tag{FInvgeom} \]

Member Function Documentation

◆ barF()

static double barF ( double  p,
int  x 
)
static

Computes the complementary distribution function.

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

◆ getInstanceFromMLE()

static GeometricDist getInstanceFromMLE ( int []  x,
int  n 
)
static

Creates a new instance of a geometric distribution with parameter \(p\) 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  p)
static

Computes and returns the mean \(E[X] = (1 - p)/p\) of the geometric distribution with parameter \(p\).

Returns
the mean of the geometric distribution \(E[X] = (1 - p) / p\)

◆ getMLE()

static double [] getMLE ( int []  x,
int  n 
)
static

Estimates the parameter \(p\) of the geometric distribution using the maximum likelihood method, from the \(n\) observations \(x[i]\), \(i = 0, 1, …, n-1\).

The estimate is returned in element 0 of the returned array. The maximum likelihood estimator \(\hat{p}\) satisfies the equation (see [118]  (page 323))

\begin{align*} \hat{p} = \frac{1}{\bar{x}_n + 1\Rule{0.0pt}{11.0pt}{0.0pt}} \end{align*}

where \(\bar{x}_n\) is the average of \(x[0], …, x[n-1]\).

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

◆ getStandardDeviation()

static double getStandardDeviation ( double  p)
static

Computes and returns the standard deviation of the geometric distribution with parameter \(p\).

Returns
the standard deviation of the geometric distribution

◆ getVariance()

static double getVariance ( double  p)
static

Computes and returns the variance \(\mbox{Var}[X] = (1 - p)/p^2\) of the geometric distribution with parameter \(p\).

Returns
the variance of the Geometric distribution \(\mbox{Var}[X] = (1 - p) / p^2\)

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