Geometric Distribution
Geometric Distribution
๐ฒ Geometric Distribution
The Geometric distribution models the number of trials until the first success in a sequence of independent Bernoulli trials.
๐ Definition
Let $X \sim \text{Geometric}(p)$. Then:
\[P(X = k) = (1 - p)^{k - 1} p, \quad k = 1, 2, 3, \dots\]๐ Key Properties
Property | Value |
---|---|
Parameter | $p \in (0, 1]$ |
Support | $k \in {1, 2, 3, \dots}$ |
Mean | $\mathbb{E}[X] = \frac{1}{p}$ |
Variance | $\text{Var}(X) = \frac{1 - p}{p^2}$ |
Mode | $1$ |
MGF | $M_X(t) = \frac{pe^t}{1 - (1 - p)e^t}$, for $t < -\log(1 - p)$ |
๐ Real-World Examples
Sales Calls
Number of calls until the first sale is made, where each has a success rate of 10%.Dice Rolls
Number of rolls until the first six appears.
Notes
- Memoryless: $P(X > m + n \mid X > m) = P(X > n)$.
- Models โwait timeโ for first success.
- Special case of the negative binomial with $r = 1$.
- Can be shifted to start from $0$ (alternative definition).
๐ Python Example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from scipy.stats import geom
p = 0.3
rv = geom(p)
# PMF at a specific value
print("P(X=4):", rv.pmf(4))
# Sample 10 values
print("Samples:", rv.rvs(size=10))
# Mean and variance
print("Mean:", rv.mean())
print("Variance:", rv.var())
This post is licensed under CC BY 4.0 by the author.