Discrete distribution
Discrete uniform distribution
Each of the integers is equally likely: the roll of a fair die, a random draw from numbered tickets, the serial number of a captured tank. Estimating from a few observed values is the German tank problem, one of the best-known pieces of wartime statistics.
Discrete uniform probability calculator
P(X ≤ 3) = 0.5
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
CDF
mean 3.5 · variance 2.917 · sd 1.708 · entropy 1.792 nats
Formulas
| Parameters |
|
|---|---|
| Support | |
| PMF | |
| CDF | |
| Mean | |
| Variance | |
| Mode | |
| MGF | |
| Entropy |
Worked example
Tanks are numbered . Four captured tanks have serial numbers 19, 40, 42 and 60. Estimate .
With serials and largest , the minimum-variance unbiased estimate is The idea: the gaps below and between the observed serials average , so add one such gap above the largest. (The tests check by exact summation that this estimator's average is .) answer checked by code
How it relates to others
- Limit→ Uniform: If is uniform on , tends to Uniform() as . checked by code
- Special case← Beta-binomial: Beta-binomial() is the discrete uniform on . checked by code
- Special case← Zipf: Zipf with is the discrete uniform on . checked by code
All the relationships, as a diagram →
In Python
from scipy import stats
import numpy as np
X = stats.randint(low=1, high=7)
X.pmf(3) # P(X = 3) = 0.1667
X.cdf(3) # P(X ≤ 3) = 0.5
X.mean(), X.var() # 3.5, 2.917
X.ppf(0.95) # 95th percentile
X.rvs(size=10, random_state=0)
rng = np.random.default_rng(0)
rng.integers(low=1, high=7, size=10)Both take the upper end exclusive: high = b + 1.
Choosing between this and its neighbours? Which distribution for count data?