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

Extends the class DiscreteDistributionInt for the geometric distribution [114]  (page 322) with parameter \(p\), where \(0 < p < 1\). More...

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

Public Member Functions

 GeometricDist (double p)
 Constructs a geometric distribution with parameter \(p\).
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 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 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 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.
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.
static GeometricDist getInstanceFromMLE (int[] x, int n)
 Creates a new instance of a geometric distribution with parameter.
static double getMean (double p)
 Computes and returns the mean \(E[X] = (1 - p)/p\) of the geometric distribution with parameter \(p\).
static double getVariance (double p)
 Computes and returns the variance \(\mbox{Var}[X] = (1 - p)/p^2\) of the geometric distribution with parameter \(p\).
static double getStandardDeviation (double p)
 Computes and returns the standard deviation of the geometric distribution with parameter \(p\).

Additional Inherited Members

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 geometric distribution [114]  (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} \]

Definition at line 46 of file GeometricDist.java.

Constructor & Destructor Documentation

◆ GeometricDist()

umontreal.ssj.probdist.GeometricDist.GeometricDist ( double p)

Constructs a geometric distribution with parameter \(p\).

Definition at line 54 of file GeometricDist.java.

Member Function Documentation

◆ barF() [1/2]

double umontreal.ssj.probdist.GeometricDist.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]\).

Definition at line 132 of file GeometricDist.java.

◆ barF() [2/2]

double umontreal.ssj.probdist.GeometricDist.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 66 of file GeometricDist.java.

◆ cdf() [1/2]

double umontreal.ssj.probdist.GeometricDist.cdf ( double p,
int x )
static

Computes the distribution function \(F(x)\).

Definition at line 115 of file GeometricDist.java.

◆ cdf() [2/2]

double umontreal.ssj.probdist.GeometricDist.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 62 of file GeometricDist.java.

◆ getInstanceFromMLE()

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

Definition at line 202 of file GeometricDist.java.

◆ getMean() [1/2]

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

Returns the mean of the distribution function.

Implements umontreal.ssj.probdist.Distribution.

Definition at line 84 of file GeometricDist.java.

◆ getMean() [2/2]

double umontreal.ssj.probdist.GeometricDist.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\)

Definition at line 215 of file GeometricDist.java.

◆ getMLE()

double[] umontreal.ssj.probdist.GeometricDist.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 [114]  (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}\)]

Definition at line 178 of file GeometricDist.java.

◆ getP()

double umontreal.ssj.probdist.GeometricDist.getP ( )

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

Definition at line 249 of file GeometricDist.java.

◆ getParams()

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

Return a table containing the parameters of the current distribution.

Implements umontreal.ssj.probdist.Distribution.

Definition at line 267 of file GeometricDist.java.

◆ getStandardDeviation() [1/2]

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

Returns the standard deviation of the distribution function.

Implements umontreal.ssj.probdist.Distribution.

Definition at line 92 of file GeometricDist.java.

◆ getStandardDeviation() [2/2]

double umontreal.ssj.probdist.GeometricDist.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

Definition at line 242 of file GeometricDist.java.

◆ getVariance() [1/2]

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

Returns the variance of the distribution function.

Implements umontreal.ssj.probdist.Distribution.

Definition at line 88 of file GeometricDist.java.

◆ getVariance() [2/2]

double umontreal.ssj.probdist.GeometricDist.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\)

Definition at line 229 of file GeometricDist.java.

◆ inverseF()

int umontreal.ssj.probdist.GeometricDist.inverseF ( double p,
double u )
static

Computes the inverse of the geometric distribution, given by ( FInvgeom ).

Definition at line 149 of file GeometricDist.java.

◆ inverseFInt()

int umontreal.ssj.probdist.GeometricDist.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 70 of file GeometricDist.java.

◆ prob() [1/2]

double umontreal.ssj.probdist.GeometricDist.prob ( double p,
int x )
static

Computes the geometric probability \(p(x)\) given in ( fgeom ) .

Definition at line 100 of file GeometricDist.java.

◆ prob() [2/2]

double umontreal.ssj.probdist.GeometricDist.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 58 of file GeometricDist.java.

◆ setP()

void umontreal.ssj.probdist.GeometricDist.setP ( double p)

Resets the value of \(p\) associated with this object.

Definition at line 256 of file GeometricDist.java.

◆ toString()

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

Returns a String containing information about the current distribution.

Definition at line 275 of file GeometricDist.java.


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