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
Cumulative distribution function
The CDF for nonnegative integer \(y\) is
Moments
Mean: \(\displaystyle{\frac{1-\theta}{\theta}}\)
Variance: \(\displaystyle{\frac{1-\theta}{\theta^2}}\)
Usage
Package |
Syntax |
---|---|
NumPy |
|
SciPy |
|
Distributions.jl |
|
Stan |
|
Notes
The Geometric distribution sometimes defined by replacing \(y\) with \(y-1\) such that the PMF is \(f(y;\theta) = (1-\theta)^{y-1} \, \theta\). 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. This is the parametrization that NumPy and SciPy use. To adjust for this while still using the PMF defined above, we use the
loc=-1
keyword argument in the SciPy implementation and we subtract one from the random numbers generated using Numpy.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)\).
PMF and CDF plots
Links
Stan (Negative Binomial, from which Geometric may be generated)