1 Definition and basic properties

An empirical distribution function (EDF) is a nonparametric estimate of an unknown cumulative distribution function (CDF) constructed directly from a finite sample. It accumulates probability mass as a stepwise function over the observed data values, producing a monotone, right-continuous curve that only increases at points where sample observations occur.

1.1 Formal construction from a sample

Given an i.i.d. sample \(X_1,\dots,X_n\) from an unknown distribution \(F\), the EDF \(F_n\) is defined by \[ F_n(x)=\frac{1}{n}\sum_{i=1}^n \mathbf{1}\{X_i\le x\}, \] where \(\mathbf{1}\{\cdot\}\) is the indicator function. For each real number \(x\), \(F_n(x)\) equals the fraction of sample points not exceeding \(x\).

1.2 Step-function behavior and right-continuity

Because \(F_n(x)\) counts how many observations are \(\le x\), it changes only when \(x\) crosses an observed value. Between consecutive distinct observations, the fraction remains constant, so the EDF is a step function. With the definition using \(\le x\), the function is right-continuous: at an observed value \(x_0\), the jump includes observations equal to \(x_0\), so the value immediately to the right reflects that jump.

1.3 Interpretation as an estimator of the CDF

The target CDF is \[ F(x)=\mathbb{P}(X\le x). \] The EDF replaces the unknown probability by a sample proportion. For fixed \(x\), \(F_n(x)\) behaves like a binomial proportion: it is the average of i.i.d. Bernoulli indicators \(\mathbf{1}\{X_i\le x\}\).

1.4 Relationship to sample ranks and order statistics

Let the ordered sample be \(X_{(1)}\le \cdots \le X_{(n)}\). Then for \(x\in [X_{(k)}, X_{(k+1)})\) (with appropriate conventions at the ends), \[ F_n(x)=\frac{k}{n}. \] Equivalently, the EDF can be expressed in terms of order statistics: it jumps by \(m/n\) at a value where \(m\) observations are equal, and its level after the \(k\)-th order statistic is \(k/n\).

2 Empirical distribution function under the hood

Although the definition is simple, practical use depends on how the ordered sample is handled, how ties are treated, and how equivalent notations are translated into code.

2.1 Computation from ordered data

A common implementation sorts the sample to obtain \(X_{(1)},\dots,X_{(n)}\). One then evaluates the EDF at a set of query points. If evaluating specifically at the observed order statistics, the EDF values are simply \[ F_n(X_{(k)})=\frac{1}{n}\cdot \#\{i: X_i\le X_{(k)}\}=\frac{k}{n} \] when all observations are distinct. With ties, the mapping is by cumulative counts at each distinct value.

2.2 Handling ties and repeated observations

When the sample includes repeated values, the EDF still follows the same definition, but the jump sizes at those points increase. If a distinct value \(v\) occurs \(m\) times, then the EDF increases by \(m/n\) at \(x=v\). In step-plot representations, it is important to ensure that the jump is positioned so that right-continuity is respected (i.e., the height after the jump corresponds to including observations equal to \(v\)).

2.3 Equivalent formulations and notation variants

Different texts use slightly different conventions (for example, defining the step to include or exclude points exactly at \(x\)). With the standard form \(F_n(x)=\frac{1}{n}\sum \mathbf{1}\{X_i\le x\}\), the EDF is right-continuous. Some software packages use “empirical CDF” routines that return a pair of arrays (support points and cumulative probabilities), implicitly encoding the step behavior. The EDF can also be described as the CDF of the discrete distribution that places mass \(1/n\) at each observed observation.

2.4 Multidimensional extension overview (conceptual)

For multivariate data \(X_i\in\mathbb{R}^d\), the direct analogue of the EDF becomes less straightforward because “\(\le\)” is not a total order. Conceptually, one can define an empirical CDF as a function of hyperrectangles (e.g., \(\mathbf{1}\{X_i\le x\}\) interpreted componentwise), but many properties and computational aspects require additional machinery from multivariate empirical process theory. As a result, practical multidimensional generalizations often focus on rank-based methods, kernel estimates, or simulation-based comparisons rather than a literal stepwise curve.

3 Sampling behavior and convergence

EDFs are valuable because they behave well as the sample size increases. Their accuracy can be analyzed pointwise and uniformly over the real line.

3.1 Unbiasedness and consistency

For any fixed \(x\), \[ \mathbb{E}[F_n(x)] = \mathbb{P}(X_1\le x)=F(x), \] so the EDF is unbiased at every predetermined evaluation point. Moreover, by the law of large numbers, \[ F_n(x)\to F(x)\quad \text{almost surely as } n\to\infty, \] which yields pointwise consistency.

3.2 Pointwise convergence to the true CDF

Pointwise convergence means that for each fixed \(x\), the empirical step height stabilizes around the true CDF value as more data are gathered. This does not directly guarantee good behavior simultaneously for all \(x\), because the number of evaluation points can effectively grow with the sample size.

3.3 Uniform convergence and the role of the Glivenko–Cantelli theorem

Uniform convergence addresses the discrepancy across the entire real line. The Glivenko–Cantelli theorem states that \[

\sup_xF_n(x)-F(x)\to 0 \quad \text{almost surely}.

\] Thus, the entire EDF curve converges to the true CDF, not just at individual points. This property underpins many EDF-based goodness-of-fit tools that examine maximum deviations.

3.4 Fluctuations and the Kolmogorov–Smirnov statistic

Beyond convergence, one studies random fluctuations around the limit. The Kolmogorov–Smirnov (KS) statistic is based on the supremum deviation, typically of the form \[

D_n = \sup_xF_n(x)-F(x).

\] Under appropriate conditions, the distribution of \(D_n\) (after scaling) approaches a non-degenerate limiting distribution. This makes KS test thresholds possible without knowing the underlying \(F\).

4 Asymptotic theory connections

EDF-based methods connect naturally to broader asymptotic frameworks, including empirical processes, quantile asymptotics, and functional approximation.

4.1 Empirical process perspective

Rather than studying \(F_n\) alone, empirical process theory examines the stochastic process \[ \sqrt{n}\,(F_n - F). \] This rescaled process captures how deviations from the CDF behave across \(x\). In many settings, the process converges in distribution to a Gaussian process, which provides a unified basis for analyzing EDF-based statistics.

4.2 Limiting distributions of EDF-based functionals

Many statistics are functionals of the EDF, such as suprema or integrals of squared deviations. Once the underlying process converges, the distribution of these functionals can often be derived using continuous mapping ideas. The result is that a wide family of EDF-based test statistics share asymptotic laws driven by the same limiting Gaussian structure.

4.3 Quantile process and ties to order statistics

Quantiles derived from the EDF rely on the inverse relationship between CDF values and data ranks. The quantile process characterizes the joint asymptotic behavior of the empirical quantile function across levels. When ties occur, the mapping from probabilities to data values becomes piecewise constant, which can slightly change how approximations behave at finite \(n\), though large-sample results often remain valid under mild regularity conditions.

4.4 Functional delta method for EDF transformations

The functional delta method extends the idea of Taylor expansion to functionals of random functions. If one applies a smooth transformation to the EDF (for instance, converting CDF values to quantiles), then asymptotic distributions can be obtained from the asymptotic behavior of \(\sqrt{n}(F_n-F)\). This tool helps justify the limiting distributions of many EDF-derived estimators.

5 Statistical inference using EDFs

EDFs support inference by converting distributional comparisons into statements about how far \(F_n\) departs from a hypothesized CDF \(F_0\).

5.1 Goodness-of-fit tests (EDF-based)

Goodness-of-fit procedures ask whether the observed sample could plausibly arise from a specified model distribution. EDF-based tests compare the EDF to the model CDF \(F_0\) by measuring discrepancies across \(x\). Because the EDF is distribution-free after transformation through \(F_0\) (under the null), the tests can often be calibrated using universal reference distributions.

5.2 Kolmogorov–Smirnov framework

In the KS approach, the test statistic is the maximum absolute difference between the EDF and \(F_0\). Variants include one-sample KS tests, as well as two-sample KS tests that compare two EDFs directly. The appeal is simplicity: computation involves sorting and then evaluating a max gap between cumulative curves. The inferential logic follows from the asymptotic distribution of the scaled KS statistic.

Other EDF-based tests replace the supremum criterion with integrated measures of deviation. Cramér–von Mises-type statistics aggregate squared differences over the line, while Anderson–Darling-type criteria emphasize tail behavior more strongly through weighting schemes. Conceptually, these are different ways of summarizing the same underlying discrepancy process \(F_n-F_0\).

5.4 Confidence bands and simultaneous inference

Beyond single-number tests, confidence bands aim to quantify uncertainty in the EDF curve itself. Simultaneous bands provide regions that, with a prescribed probability, contain the true CDF for all \(x\) in a range. Such bands translate empirical variability into an interpretable graphical and numerical summary, aiding exploratory checks and supporting claims about distributional form.

EDFs naturally produce empirical quantile estimates, which are central in both descriptive statistics and inference.

6.1 Plug-in quantiles from the EDF

A quantile at probability level \(p\) can be estimated by the inverse of the EDF. If \(F_n\) is the EDF, then an empirical \(p\)-quantile is commonly taken as \[ \hat{q}_p = F_n^{-1}(p), \] where the inverse is defined in a generalized sense because \(F_n\) is stepwise and not strictly increasing. Operationally, \(\hat{q}_p\) corresponds to a data value at a particular rank determined by \(p\).

6.2 Median, empirical quantile function, and interpolation

The median corresponds to \(p=0.5\). With discrete steps and possible ties, the empirical median may select one of the observed values rather than a continuous interpolant. Some implementations offer interpolation between adjacent order statistics, effectively smoothing the step function. While interpolation can improve numerical stability for continuous data, it can also obscure distributional discreteness when the underlying variable is genuinely discrete.

6.3 Asymptotic distribution of empirical quantiles

Under regularity conditions (such as a positive and continuous density near the target quantile), empirical quantiles have asymptotic normal behavior. The asymptotic variance depends on the slope of the CDF at the quantile, linking quantile uncertainty to local behavior of \(F\). For higher quantiles or distributions with flat regions, variability can increase and convergence can be slower.

6.4 Robustness considerations in practice

Empirical quantiles inherit robustness from the EDF’s nonparametric nature: they do not rely on fitting a parametric family. However, they are sensitive to sample size and to extreme observations when estimating tail quantiles. For small \(n\), quantiles near 0 or 1 can be unstable; practitioners often use moderated levels, bootstrap resampling, or tailored confidence procedures.

7 Practical considerations and implementation

Good practice involves careful choices in evaluation points, attention to scaling, and correct handling of boundary behavior.

7.1 Choosing evaluation points and thresholds

When plotting or computing distances between EDFs and reference distributions, users must select evaluation points. Evaluating at all unique sample values is often sufficient for stepwise EDF behavior. For integrated statistics, one typically uses grid points or sums over intervals determined by order statistics. The choice affects both computational cost and numerical accuracy.

7.2 Computational efficiency for large samples

Computing the EDF itself requires sorting or maintaining order statistics, typically the dominant cost at \(O(n\log n)\). Once sorted, many EDF-related quantities (like cumulative fractions or max deviations) can be updated efficiently with linear passes. For extremely large datasets, approximate methods or streaming variants may be used, though they trade exactness for speed.

7.3 Visualization: EDF plots and interpretation

EDF plots show how the empirical cumulative probability accumulates across the sample range. Compared with a model CDF plotted on the same axes, the EDF reveals systematic deviations: persistent gaps suggest misfit, while near-overlap suggests adequacy. Because the EDF is a step function, interpretation should consider that jumps correspond to sample observations, not measurement error.

7.4 Common pitfalls (scaling, indexing, edge handling)

Common mistakes include off-by-one indexing when mapping ranks to cumulative fractions, confusion between \(k/n\) and \((k-1)/n\), and incorrect handling of ties. Another pitfall is failing to match the statistical convention used by a test: KS-type statistics depend on whether one compares to the EDF from the left or right of a step. Finally, axis scaling issues can create misleading visual impressions, especially when comparing distributions with different support ranges.

8 Worked examples (illustrative)

The following examples illustrate how the EDF is constructed and how it can be used for exploratory checks and conceptual test statistics.

8.1 Simple discrete sample example

Suppose a sample consists of observations \(\{1,1,3,4\}\), so \(n=4\). For \(x<1\), no data satisfy \(X_i\le x\), so \(F_n(x)=0\). For \(1\le x<3\), two points satisfy the condition, giving \(F_n(x)=2/4=0.5\). For \(3\le x<4\), three points satisfy it, so \(F_n(x)=3/4=0.75\). For \(x\ge 4\), all four points satisfy it, so \(F_n(x)=1\). The EDF is thus a step function with jumps at \(1,3,\) and \(4\).

8.2 Continuous sample example and comparison to a model CDF

Consider a continuous sample drawn from an unknown distribution, with sorted values \(X_{(1)}&lt;\cdots&lt;X_{(n)}\). The EDF takes value \(k/n\) after the \(k\)-th ordered observation. To compare with a hypothesized model CDF \(F_0\), one plots both curves: the EDF increases in steps while \(F_0\) varies smoothly. Regions where the EDF lies consistently above \(F_0\) indicate the sample places more mass in those intervals than the model predicts, whereas consistent under-lying suggests the opposite.

8.3 EDF-based visual check for distributional fit

A visual fit check often overlays the EDF with the model CDF and highlights the size of discrepancies. For example, if the EDF deviates near the tails, this may indicate tail mis-specification even if the central mass aligns closely. While a plot does not provide formal error control, it can guide subsequent choices among EDF-based goodness-of-fit tests or tail-weighted statistics.

8.4 Example of an EDF-derived test statistic (conceptual)

In the conceptual KS one-sample setting, compute \(D_n=\sup_xF_n(x)-F_0(x)\). Practically, it suffices to evaluate differences at points where the EDF changes (unique observations) and sometimes just to the left of those points, depending on the convention. The largest absolute gap becomes the test statistic. Under the null hypothesis that the sample follows \(F_0\), the statistic’s distribution (after appropriate scaling) is used to determine whether the observed deviation is unusually large.