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

\[\begin{align} f(y;\theta) = (1-\theta)^y \, \theta. \end{align}\]

Cumulative distribution function

The CDF for nonnegative integer \(y\) is

\[\begin{align} F(y;\theta) = 1 - (1 - \theta)^{y+1}. \end{align}\]

Moments

Mean: \(\displaystyle{\frac{1-\theta}{\theta}}\)

Variance: \(\displaystyle{\frac{1-\theta}{\theta^2}}\)


Usage

Package

Syntax

NumPy

rng.geometric(theta) - 1

SciPy

scipy.stats.geom(theta, loc=-1)

Distributions.jl

Geometric(theta)

Stan

neg_binomial(1, theta/(1-theta))



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