ParaMonte Fortran 2.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation. |
This module contains classes and procedures for computing various statistical quantities related to the Geometric distribution. More...
Data Types | |
type | distGeom_type |
This is the derived type for signifying distributions that are of type Geometric as defined in the description of pm_distGeom. More... | |
interface | getGeomCDF |
Generate and return the Cumulative Distribution Function (CDF) of the Geometric distribution for an input stepSuccess within the discrete integer support of the distribution \([1, +\infty)\). More... | |
interface | getGeomLogPMF |
Generate and return the natural logarithm of the Probability Mass Function (PMF) of the Geometric distribution for an input stepSuccess within the discrete integer support of the distribution \([0, +\infty)\). More... | |
interface | getGeomRand |
Generate and return a scalar (or array of arbitrary rank of) random value(s) from the Geometric distribution. More... | |
interface | setGeomCDF |
Return the Cumulative Distribution Function (CDF) of the Geometric distribution. More... | |
interface | setGeomLogPMF |
Return the natural logarithm of the Probability Mass Function (PMF) of the Geometric distribution for an input stepSuccess within the discrete integer support of the distribution \([0, +\infty)\). More... | |
interface | setGeomRand |
Return a scalar (or array of arbitrary rank of) random value(s) from the Geometric distribution. More... | |
Variables | |
character(*, SK), parameter | MODULE_NAME = "@pm_distGeom" |
This module contains classes and procedures for computing various statistical quantities related to the Geometric distribution.
Specifically, this module contains routines for computing the following quantities of the Geometric distribution:
The Geometric distribution is either one of two discrete probability distributions:
Which of these is called the Geometric distribution is a matter of convention and convenience.
These two different Geometric distributions should not be confused with each other.
Frequently, the name shifted Geometric distribution is adopted for the former (distribution of the number \(X\)).
However, to avoid ambiguity, it is considered wise to indicate which is intended, by mentioning the support explicitly.
The generic interfaces of this module return the probability mass function of the number \(X\), i.e., the probability of the \(X\) number of Bernoulli trials needed to get one success.
The Geometric distribution gives the probability that the first occurrence of success requires \(k\) independent trials, each with success probability \(p\).
If the probability of success on each trial is \(p\), then the probability that the \(k\)th trial is the first success is
\begin{equation} \pi(X = k | p) = (1 - p)^{k - 1} p ~,~ k = 1, 2, 3, 4, \ldots ~. \end{equation}
The above form of the Geometric distribution is used for modeling the number of trials up to and including the first success.
This is the form implemented in this module.
By contrast, the following form of the geometric distribution is used for modeling the number of failures until the first success:
\begin{equation} \pi(Y = k) = \pi(X = k + 1) = (1 - p)^k p ~,~ k = 0, 1, 2, 3, \ldots ~. \end{equation}
In either case, the sequence of probabilities is a geometric sequence.
Cumulative Distribution Function (CDF)
The CDF of the Geometric distribution with parameter \(\ms{probSuccess}\) (representing the probability of success) is defined as,
\begin{equation} \ms{CDF}(\ms{stepSuccess} ~|~ \ms{probSuccess}) = 1 - (1 - \ms{probSuccess})^{\ms{stepSuccess}} ~,~ 0 < \ms{stepSuccess} ~, \end{equation}
where
Random Number Generation (RNG)
The exponential distribution is the continuous analogue of the geometric distribution.
If \(X\) is an exponentially distributed random variable with parameter \(\lambda\), then
\begin{equation} Y = \lfloor X \rfloor ~, \end{equation}
where \(\lfloor\quad\rfloor\) is the floor()
(or greatest integer) function, is a geometrically distributed random variable with parameter \(\ms{probSuccess} = 1 − e^{−\lambda}\) (thus \(\lambda = −ln(1 − \ms{probSuccess})\)) and taking values in the set \(\{0, 1, 2, \ldots\}\).
This can be used to generate geometrically distributed pseudorandom numbers.
If \(U\) is uniformly distributed in \((0,1]\), then \(1 + \lfloor\ln(U)/\ln(1 - \ms{probSuccess})\rfloor\) is geometrically distributed with parameter \(\ms{probSuccess}\).
Final Remarks ⛓
If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.
This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.
character(*, SK), parameter pm_distGeom::MODULE_NAME = "@pm_distGeom" |
Definition at line 103 of file pm_distGeom.F90.