Geometric distribution
Story
We perform a series of Bernoulli trials with probability of success \(\theta\) until we get a success. The number of failures \(y\) before the success is Geometrically distributed.
Example
Consider polymerization of an actin filament. At each time step, an actin monomer may add to the end of the filament (“failure”), or an actin monomer may fall off the end (“success”) with (usually very low) probability \(\theta\). The length of actin filaments, measured in number of constitutive monomers, is Geometrically distributed.
Parameters
The Geometric distribution is parametrized by a single value, \(\theta\), the probability that the Bernoulli trial is successful.
Support
The Geometric distribution, as defined here, has support on the nonnegative integers.
Probability mass function
Moments
Mean: \(\displaystyle{\frac{1-\theta}{\theta}}\)
Variance: \(\displaystyle{\frac{1-\theta}{\theta^2}}\)
Usage
Package |
Syntax |
---|---|
NumPy |
|
SciPy |
|
Stan |
|
Notes
The Geometric distribution is not implemented in Stan. You can instead use a Negative Binomial distribution fixing the parameter \(\alpha\) to be unity and relating the parameter \(\beta\) of the Negative Binomial distribution to \(\theta\) as \(\theta = \beta/(1+\beta)\).
The Geometric distribution is defined differently in Numpy and SciPy, replacing \(y\) with \(y-1\). In this parametrization the Geometric distribution describes the number of successive Bernoulli trials (not just the failures; the success is included) necessary to get a success. To adjust for this while still using the PMF defined here, we use the
loc=-1
keyword argument in the SciPy implementation and we subtract one from the random numbers generated using Numpy.