Probability distribution in 3D

A 3D bell curve with shaded standard deviation regions on either side of a marked mean, mounted on a base.Drag to turn

A probability distribution is a function that describes how probability is spread across the possible values of a random variable. It tells you which outcomes are likely, which are rare, and how the total probability of 1 is shared among them.

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.
PDF
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.

Common questions

What is the difference between a PMF and a PDF?

A PMF gives the probability of each exact value of a discrete variable. A PDF gives a density for a continuous variable, and probabilities are found as areas under it.

Why must probabilities in a distribution add to 1?

The variable must take some value, so the total probability of all outcomes is certain. For continuous variables the total area under the PDF equals 1.

How do I choose which distribution fits my data?

Start with the type of data, such as counts, yes or no outcomes, or positive continuous values. Then compare a histogram with candidate shapes and check the fit with a suitable test or plot.

Learn this with a tutor

Sidechair's AI tutor will teach this topic in 3D. Join the waitlist for early access.

We'll only email you about Sidechair. Read our privacy policy.