Algorithm Search⌘K

Definitionintro

Empirical distribution function

Also called ECDF, empirical CDF.

The step function that gives, at each x, the fraction of the sample at most x. It is the nonparametric MLE of the distribution function.

The empirical distribution function of a sample x1,…,xnx_1, \ldots, x_n is the function Fn(t)=1n#{i:xi≤t}F_n(t) = \frac{1}{n} \#\{i : x_i \le t\}, the fraction of the sample at most tt. It is a step function that starts at 0, rises by 1/n1/n at each data point, and ends at 1. For an independent sample from a distribution function FF, each value Fn(t)F_n(t) is an unbiased estimate of F(t)F(t), and by the Glivenko-Cantelli theorem the whole function converges to FF uniformly. It is the distribution function of the empirical measure, which puts mass 1/n1/n on each data point. It is the basis of the Kolmogorov-Smirnov test, of the bootstrap, and of every plug-in estimator that applies a functional of FF to FnF_n.

Definition

Let x1,…,xnx_1, \ldots, x_n be real numbers. The empirical distribution function is

Fn(t)=1n∑i=1n1{xi≤t},t∈R.F_n(t) = \frac{1}{n} \sum_{i=1}^{n} \mathbf{1}\{x_i \le t\}, \qquad t \in \mathbb{R}.

With the sorted values x(1)≤⋯≤x(n)x_{(1)} \le \cdots \le x_{(n)}, the order statistics, Fn(t)=i/nF_n(t) = i/n for x(i)≤t<x(i+1)x_{(i)} \le t < x_{(i+1)}, with x(0)=−∞x_{(0)} = -\infty and x(n+1)=+∞x_{(n+1)} = +\infty. A value that occurs kk times gives one jump of size k/nk/n. FnF_n is nondecreasing and right-continuous, with limits 0 and 1, so it is a distribution function: that of the empirical measure Pn=1n∑iδxiP_n = \frac{1}{n} \sum_i \delta_{x_i}.

When X1,…,XnX_1, \ldots, X_n are random with distribution function FF, FnF_n is a random function, and:

  • Pointwise law. For independent XiX_i, nFn(t)nF_n(t) is Binomial(n,F(t))(n, F(t)). So EFn(t)=F(t)E F_n(t) = F(t) and VarFn(t)=F(t)(1−F(t))/n\mathrm{Var} F_n(t) = F(t)(1 - F(t))/n, and Fn(t)F_n(t) is asymptotically normal for each tt with 0<F(t)<10 < F(t) < 1.
  • Joint law. For s<ts < t, Cov(Fn(s),Fn(t))=F(s)(1−F(t))/n\mathrm{Cov}(F_n(s), F_n(t)) = F(s)(1 - F(t))/n. As a process, n(Fn−F)\sqrt{n}(F_n - F) converges to a Brownian bridge composed with FF.
  • Nonparametric maximum likelihood. Among all probability measures QQ, the product ∏iQ({xi})\prod_i Q(\{x_i\}) is largest for Q=PnQ = P_n. If the distinct values vjv_j occur cjc_j times, the product is ∏jqjcj\prod_j q_j^{c_j} with qj=Q({vj})q_j = Q(\{v_j\}) and ∑jqj≤1\sum_j q_j \le 1, and Gibbs' inequality gives the maximum at qj=cj/nq_j = c_j/n. So FnF_n is the nonparametric MLE of FF.

Examples and non-examples

A small sample. For x=3.1,1.4,2.2,1.4,5.0x = 3.1, 1.4, 2.2, 1.4, 5.0, n=5n = 5 and the value 1.41.4 occurs twice. Then Fn(1.0)=0F_n(1.0) = 0, Fn(1.4)=2/5F_n(1.4) = 2/5 (one jump of 2/52/5), Fn(2.0)=2/5F_n(2.0) = 2/5, Fn(2.2)=3/5F_n(2.2) = 3/5, Fn(3.1)=4/5F_n(3.1) = 4/5, Fn(4.0)=4/5F_n(4.0) = 4/5 and Fn(5.0)=1F_n(5.0) = 1. The sample median is 2.22.2, the smallest tt with Fn(t)≥1/2F_n(t) \ge 1/2.

A confidence band. The DKW inequality gives P(sup⁡t∣Fn(t)−F(t)∣>ε)≤2e−2nε2P(\sup_t \lvert F_n(t) - F(t) \rvert > \varepsilon) \le 2e^{-2n\varepsilon^2}, so Fn±ln⁡(2/α)/(2n)F_n \pm \sqrt{\ln(2/\alpha)/(2n)} holds all of FF with probability at least 1−α1 - \alpha. At α=0.05\alpha = 0.05 the half-width is 0.13580.1358 for n=100n = 100 and 0.042950.04295 for n=1000n = 1000. A pointwise 95% interval at a point with F(t)=1/2F(t) = 1/2 has the half-width 1.96⋅12/100=0.0981.96 \cdot \frac{1}{2}/\sqrt{100} = 0.098 for n=100n = 100, narrower because it covers one point and not the whole function.

Sampling from it. Drawing from FnF_n by inverse transform sampling is the same as drawing one of the data points uniformly at random. This is the resampling step of the nonparametric bootstrap.

Non-example: the left-continuous version. 1n#{i:xi<t}\frac{1}{n} \#\{i : x_i < t\} agrees with FnF_n except at the data points, where it takes the value before the jump. It is the empirical version of P(X<t)P(X < t), not of the distribution function.

Non-example: plotting positions. Q-Q plots often place the ii-th order statistic at the level (i−1/2)/n(i - 1/2)/n or i/(n+1)i/(n+1). These levels are not values of FnF_n; they are chosen so that the extreme points do not land at levels 0 or 1.

Non-example: a smoothed estimate. Integrating a kernel density estimate gives a continuous estimate of FF. It is not a step function and it is not FnF_n, although it tends to FnF_n at every point other than the data points as the bandwidth tends to 0.

Non-example: censored data. With right-censored times, the fraction of observed times at most tt is biased. The Kaplan-Meier estimator is the nonparametric MLE in that case, and it equals 1−Fn1 - F_n when no time is censored.

  • Empirical measure. Pn(A)=1n#{i:xi∈A}P_n(A) = \frac{1}{n} \#\{i : x_i \in A\} for any set AA. Fn(t)=Pn((−∞,t])F_n(t) = P_n((-\infty, t]). It also makes sense for data in Rd\mathbb{R}^d or in any space.
  • Empirical quantile function. Fn−1(p)=inf⁡{t:Fn(t)≥p}=x(⌈np⌉)F_n^{-1}(p) = \inf\{t : F_n(t) \ge p\} = x_{(\lceil np \rceil)} for 0<p≤10 < p \le 1. Sample quantiles and the sample median are its values.
  • Empirical process. n(Fn(t)−F(t))\sqrt{n}(F_n(t) - F(t)) as a function of tt. Its sup is n\sqrt{n} times the Kolmogorov-Smirnov statistic.
  • Empirical survival function. 1−Fn(t)1 - F_n(t), the fraction of the sample above tt.

References

  1. A. W. van der Vaart, Asymptotic Statistics, Cambridge University Press, 1998, Chapter 19 (empirical processes), Section 19.1 (the empirical distribution function, its pointwise laws and the Glivenko-Cantelli theorem)
  2. A. N. Kolmogorov, Sulla determinazione empirica di una legge di distribuzione, Giornale dell'Istituto Italiano degli Attuari 4, 1933, pages 83 to 91, the empirical distribution function of a sample and its largest distance from the true distribution function
  3. V. Glivenko, Sulla determinazione empirica delle leggi di probabilità, Giornale dell'Istituto Italiano degli Attuari 4, 1933, pages 92 to 99, the uniform convergence of the empirical distribution function for a continuous distribution function
  4. P. Massart, The tight constant in the Dvoretzky-Kiefer-Wolfowitz inequality, Annals of Probability 18(3), 1990, pp. 1269 to 1283 (the bound 2 exp(-2 n epsilon^2) that gives the confidence band)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/8EGW3R/text.yaml