Extends the class DiscreteDistributionInt for the geometric distribution [114] (page 322) with parameter \(p\), where \(0 < p < 1\). More...
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. | |
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} \]
\[ 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.
| umontreal.ssj.probdist.GeometricDist.GeometricDist | ( | double | p | ) |
Constructs a geometric distribution with parameter \(p\).
Definition at line 54 of file GeometricDist.java.
|
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.
| 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.
| x | value at which the complementary distribution function must be evaluated |
Reimplemented from umontreal.ssj.probdist.DiscreteDistributionInt.
Definition at line 66 of file GeometricDist.java.
|
static |
Computes the distribution function \(F(x)\).
Definition at line 115 of file GeometricDist.java.
| double umontreal.ssj.probdist.GeometricDist.cdf | ( | int | x | ) |
Returns the distribution function \(F\) evaluated at \(x\) (see ( FDistDisc )).
| x | value at which the distribution function must be evaluated |
Reimplemented from umontreal.ssj.probdist.DiscreteDistributionInt.
Definition at line 62 of file GeometricDist.java.
|
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\).
| x | the list of observations to use to evaluate parameters |
| n | the number of observations to use to evaluate parameters |
Definition at line 202 of file GeometricDist.java.
| 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.
|
static |
Computes and returns the mean \(E[X] = (1 - p)/p\) of the geometric distribution with parameter \(p\).
Definition at line 215 of file GeometricDist.java.
|
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]\).
| x | the list of observations used to evaluate parameters |
| n | the number of observations used to evaluate parameters |
Definition at line 178 of file GeometricDist.java.
| double umontreal.ssj.probdist.GeometricDist.getP | ( | ) |
Returns the \(p\) associated with this object.
Definition at line 249 of file GeometricDist.java.
| 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.
| 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.
|
static |
Computes and returns the standard deviation of the geometric distribution with parameter \(p\).
Definition at line 242 of file GeometricDist.java.
| 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.
|
static |
Computes and returns the variance \(\mbox{Var}[X] = (1 - p)/p^2\) of the geometric distribution with parameter \(p\).
Definition at line 229 of file GeometricDist.java.
|
static |
Computes the inverse of the geometric distribution, given by ( FInvgeom ).
Definition at line 149 of file GeometricDist.java.
| 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.
| u | value in the interval \((0,1)\) for which the inverse distribution function is evaluated |
| IllegalArgumentException | if \(u\) is not in the interval \((0,1)\) |
| ArithmeticException | if 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.
|
static |
Computes the geometric probability \(p(x)\) given in ( fgeom ) .
Definition at line 100 of file GeometricDist.java.
| double umontreal.ssj.probdist.GeometricDist.prob | ( | int | x | ) |
Returns \(p(x)\), the probability of \(x\).
| x | value at which the mass function must be evaluated |
Reimplemented from umontreal.ssj.probdist.DiscreteDistributionInt.
Definition at line 58 of file GeometricDist.java.
| 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.
| String umontreal.ssj.probdist.GeometricDist.toString | ( | ) |
Returns a String containing information about the current distribution.
Definition at line 275 of file GeometricDist.java.