The Empirical Distribution Function
The step-function version of a cumulative distribution built directly from your data — at any point x it just reports the fraction of your sample at or below x, and it converges to the true CDF as your sample grows.
Prerequisites: Random Variables & Distributions, Confidence Intervals
You have 500 historical daily returns for a stock and want to know: what fraction of days had a return below -1%? You don't need to assume the returns are normally distributed, fit a model, or estimate any parameters — you can just count. The empirical distribution function does exactly this, systematically, for every possible threshold at once, and it turns out that this simple counting exercise is itself a legitimate estimator of the true, unknown distribution the data came from.
An analogy: ranking your class by test score
Imagine lining up every student in a class by their test score and, for any score you name, reading off what fraction of the class scored at or below . With no model of "how test scores are distributed" required, this ranking directly answers the question for any you could ask about. As you add more students to the class, this fraction-below- becomes a more and more reliable estimate of the fraction you'd see in the entire population of students who could have taken the test, even though you never assumed a bell curve or any other shape to begin with.
The idea, one symbol at a time
Given a sample , the empirical distribution function is
where is 1 if observation is at or below and 0 otherwise. In plain English: is simply the fraction of your data points that fall at or below the value , and as sweeps from to , traces out a staircase that jumps up by at each observed data point and is flat everywhere else. The Glivenko-Cantelli theorem guarantees that converges to the true, unknown CDF uniformly — meaning the worst-case gap between the staircase and the true curve, over all simultaneously, shrinks to zero as grows — not just at each individual point separately, but everywhere at once.
Worked example 1: five daily returns by hand
Suppose five sorted daily returns (in %): . The ECDF is a staircase: for , ; for , ; for , ; for , ; for , ; and for , . So the answer to "what fraction of days had a return below -1%?" is read directly off the step at : , since only the observation is below .
Worked example 2: watching convergence
Now suppose the true, unknown distribution is standard normal, and you draw increasingly large samples. With , the ECDF's staircase might deviate from the true normal CDF by as much as 0.15 at some point (a coarse, jumpy staircase from few observations). With , that maximum deviation typically shrinks to around — a much finer staircase hugging the smooth curve closely. This shrinking maximum gap, on the order of , is exactly what the Kolmogorov-Smirnov test (see The Kolmogorov-Smirnov Test) later formalizes into a hypothesis test.
Drag the sample size in the explorer above and watch the running estimate settle onto the truth — the same logic applies to the ECDF: watch how the staircase's largest deviation from the true CDF shrinks as more data accumulates, exactly the Glivenko-Cantelli guarantee in action.
What this means in practice
The ECDF is the foundation underneath most of nonparametric statistics: it's what a QQ plot compares against a theoretical distribution, what the Kolmogorov-Smirnov test measures deviations from, and what the bootstrap implicitly resamples from when it treats your data as a stand-in for the whole population. Whenever you plot "percent of days with a drawdown worse than X" or build a historical value-at-risk estimate by reading a percentile off your data, you are using the ECDF, whether or not you name it.
The empirical distribution function estimates the whole cumulative distribution just by counting: at any point x, it's the fraction of your sample at or below x. It requires no distributional assumption, and by the Glivenko-Cantelli theorem it converges uniformly to the true CDF as the sample grows.
The ECDF is a step function with visible jumps at every observed data point, and it is easy to mistake those individual jump sizes ( each) for meaningful signal — especially in the tails, where a single extreme observation can create a jump that looks dramatic but reflects one data point, not a robust feature of the underlying distribution. Tail behavior of the ECDF is the least reliable part of it precisely where you have the fewest observations to estimate from.
Related concepts
Practice in interviews
Further reading
- van der Vaart, Asymptotic Statistics, ch. 19
- Casella & Berger, Statistical Inference, ch. 10