Discrete distribution

Geometric distribution

The number of independent trials needed to get the first success, counting the success itself: rolls of a die until the first six, calls until someone answers. It is the only discrete distribution without memory: having failed ten times does not make success any more due.

Geometric probability calculator

P(X ≤ 3) = 0.578125

At the parameters set by the sliders. The shaded region on the plot is the probability; the dots on the CDF mark F at its ends. For a discrete distribution, < and ≤ differ.

PMF

00.10.25101520P(X = k)mean

CDF

00.250.50.7515101520F(x)

mean 4 · variance 12 · sd 3.464 · mode 1 · entropy 2.249 nats

Formulas

Parameters
  • , the probability of success on each trial
Support
PMF
CDF
Mean
Variance
Mode
MGF
Entropy

Some books count the failures before the first success instead, on , with mean . SciPy and NumPy both use the trials version shown here.

Worked example

You roll a fair die until a six appears. What is the probability that it takes more than 3 rolls?

It takes more than 3 rolls exactly when the first three are not sixes, so . On average it takes rolls. answer checked by code

How it relates to others

All the relationships, as a diagram →

In Python

from scipy import stats
import numpy as np

X = stats.geom(p=0.25)
X.pmf(3)  # P(X = 3) = 0.1406
X.cdf(3)  # P(X ≤ 3) = 0.5781
X.mean(), X.var()  # 4, 12
X.ppf(0.95)  # 95th percentile
X.rvs(size=10, random_state=0)

rng = np.random.default_rng(0)
rng.geometric(p=0.25, size=10)

Choosing between this and its neighbours? Which distribution for count data? · Which distribution for waiting times and lifetimes?

← Beta-binomialNegative binomial →