What a distribution describes
A random variable is a quantity whose value depends on chance, such as the number of heads in 10 coin flips or the height of a randomly chosen adult. A distribution assigns probabilities to the values that variable can take. The probabilities are never negative and they sum or integrate to 1.
Distributions are usually split into two kinds. A discrete distribution covers values that can be counted, such as 0, 1, 2. A continuous distribution covers values on a range, such as any weight between 50 and 100 kilograms.
PMF, PDF and CDF: three ways to write one distribution
For a discrete variable, the probability mass function (PMF) gives the probability of each exact value. For a continuous variable, the probability density function (PDF) gives density, and probability comes from the area under the curve between two points. A single exact value of a continuous variable has probability 0.
The cumulative distribution function (CDF) gives the probability that the variable is less than or equal to a value x. It applies to both kinds and rises from 0 to 1. Common families include the Bernoulli, binomial, Poisson, uniform, normal and exponential distributions, each defined by a few parameters.
Worked example: heads in four coin flips
Let X be the number of heads in 4 fair flips. X follows a binomial distribution with n = 4 and p = 0.5. The PMF is P(X = k) = C(4,k) x 0.5^4, and 0.5^4 = 1/16.
The counts C(4,k) for k = 0 to 4 are 1, 4, 6, 4, 1. So the probabilities are 1/16, 4/16, 6/16, 4/16 and 1/16. They add to 16/16 = 1. The probability of at most 1 head is 1/16 + 4/16 = 5/16, which is 0.3125. The mean is n x p = 4 x 0.5 = 2.
Common misconceptions
A frequent error is to read the height of a PDF as a probability. Density can exceed 1 when the range is narrow. A uniform distribution on 0 to 0.5 has density 2, yet its total area is 2 x 0.5 = 1.
Another error is to assume that data are normal. Many real quantities, such as waiting times or incomes, are skewed, and the normal model fits them poorly. The normal distribution is also prominent partly because sums of many independent effects tend toward it, a result called the central limit theorem, which has conditions.
Where distributions are used
Data scientists use distributions to model noise, simulate data and quantify uncertainty. Many models assume a distribution for errors, and likelihood-based fitting chooses parameters that make the observed data most probable under that assumption. Histograms are the usual way to compare real data with a candidate distribution.
Distributions also appear in hypothesis tests, confidence intervals, anomaly detection and the random initialisation of machine learning models.
Key terms
- Random variable
- A quantity whose value depends on a chance process.
- PMF
- The probability mass function, giving the probability of each exact value of a discrete variable.
- The probability density function, whose area between two points gives the probability for a continuous variable.
- CDF
- The cumulative distribution function, giving the probability that the variable is at most a chosen value.
- Parameter
- A number, such as a mean or a success probability, that fixes one member of a distribution family.
- Expected value
- The probability-weighted average of the values a random variable can take.
