Algorithm Search⌘K

Theoremadvanced

Dvoretzky-Kiefer-Wolfowitz inequality

Also called DKW inequality, Massart's inequality.

The probability that the empirical CDF is more than epsilon from the true CDF anywhere is at most 2 exp(-2 n epsilon^2), with Massart's tight constant. It gives a confidence band.

The Dvoretzky-Kiefer-Wolfowitz (DKW) inequality bounds the chance that the empirical distribution function FnF_n of nn independent observations is far from the true distribution function FF anywhere on the line. In the sharp form of Massart, 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} for every nn, every ε>0\varepsilon > 0 and every FF. This is the same bound that Hoeffding's inequality gives for ∣Fn(t)−F(t)∣\lvert F_n(t) - F(t) \rvert at one fixed point tt, so taking the sup over all points costs nothing. It turns the Glivenko-Cantelli theorem into a finite-sample statement, and it gives the confidence band Fn±ln⁡(2/α)/(2n)F_n \pm \sqrt{\ln(2/\alpha)/(2n)} for the whole function FF.

Statement

Let X1,…,XnX_1, \ldots, X_n be independent with distribution function FF, let FnF_n be their empirical distribution function, and put

Dn=sup⁡t∣Fn(t)−F(t)∣,Dn+=sup⁡t(Fn(t)−F(t)),Dn−=sup⁡t(F(t)−Fn(t)).D_n = \sup_t \lvert F_n(t) - F(t) \rvert, \qquad D_n^+ = \sup_t (F_n(t) - F(t)), \qquad D_n^- = \sup_t (F(t) - F_n(t)).

Theorem (Dvoretzky, Kiefer and Wolfowitz 1956; Massart 1990). For every FF, every n≥1n \ge 1 and every ε>0\varepsilon > 0:

  1. (two-sided) P(Dn>ε)≤2e−2nε2P(D_n > \varepsilon) \le 2e^{-2n\varepsilon^2};
  2. (one-sided) P(Dn+>ε)≤e−2nε2P(D_n^+ > \varepsilon) \le e^{-2n\varepsilon^2} and P(Dn−>ε)≤e−2nε2P(D_n^- > \varepsilon) \le e^{-2n\varepsilon^2}, proved by Massart when e−2nε2≤1/2e^{-2n\varepsilon^2} \le 1/2.

Dvoretzky, Kiefer and Wolfowitz proved part 1 with an unspecified constant CC in place of 2. The side condition in part 2 belongs to the one-sided bound only. Part 1 needs no condition: when e−2nε2>1/2e^{-2n\varepsilon^2} > 1/2 its right side is above 1. Reeve (2024) proved the one-sided bound with no condition on ε\varepsilon.

Confidence band. Setting 2e−2nε2=α2e^{-2n\varepsilon^2} = \alpha gives εα=ln⁡(2/α)/(2n)\varepsilon_\alpha = \sqrt{\ln(2/\alpha)/(2n)}, and P(Fn(t)−εα≤F(t)≤Fn(t)+εα for all t)≥1−αP(F_n(t) - \varepsilon_\alpha \le F(t) \le F_n(t) + \varepsilon_\alpha \text{ for all } t) \ge 1 - \alpha.

In plain words

Draw a sample and plot the share of the sample below each value. The inequality says how likely it is that this staircase is far from the true curve at even one place. The chance falls very fast as the sample grows: doubling the sample squares a small chance, roughly.

The surprise is the size of the bound. Checking a single place already gives a bound of this form. The inequality says that checking every place at the same time costs only a factor of two. So one simple formula gives a band around the staircase that holds the whole true curve with a chosen confidence, for every distribution, with no table.

Proof

We prove a weaker form completely: the right exponent 2nε22n\varepsilon^2 with an extra factor in front. The sharp constant needs a longer argument, and we cite it.

Theorem A. For every FF, nn and ε\varepsilon with nε2≥1n\varepsilon^2 \ge 1, P(Dn>ε)≤2e4nε e−2nε2P(D_n > \varepsilon) \le 2e^4 n\varepsilon \, e^{-2n\varepsilon^2}.

Proof. Take ε≤1\varepsilon \le 1, since Dn≤1D_n \le 1. Let k=⌊nε⌋+1k = \lfloor n\varepsilon \rfloor + 1, so k−1≤nε<kk - 1 \le n\varepsilon < k. Because nε≥1/ε≥1n\varepsilon \ge 1/\varepsilon \ge 1, k≥2k \ge 2 and 1/k<ε1/k < \varepsilon. Use the grid of the Glivenko-Cantelli proof: qj=inf⁡{t:F(t)≥j/k}q_j = \inf\{t : F(t) \ge j/k\} for j=1,…,k−1j = 1, \ldots, k - 1, with q0=−∞q_0 = -\infty and qk=+∞q_k = +\infty. There it is shown that F(qj−)−F(qj−1)≤1/kF(q_j-) - F(q_{j-1}) \le 1/k, and that for t∈[qj−1,qj)t \in [q_{j-1}, q_j),

Fn(t)−F(t)≤(Fn(qj−)−F(qj−))+1k,F(t)−Fn(t)≤(F(qj−1)−Fn(qj−1))+1k,F_n(t) - F(t) \le \left(F_n(q_j-) - F(q_j-)\right) + \frac{1}{k}, \qquad F(t) - F_n(t) \le \left(F(q_{j-1}) - F_n(q_{j-1})\right) + \frac{1}{k},

where the first bracket is 0 for j=kj = k and the second is 0 for j=1j = 1. So Dn>εD_n > \varepsilon implies that one of the 2(k−1)2(k - 1) events Fn(qj−)−F(qj−)>δF_n(q_j-) - F(q_j-) > \delta or F(qj)−Fn(qj)>δF(q_j) - F_n(q_j) > \delta, 1≤j≤k−11 \le j \le k - 1, happens, with δ=ε−1/k>0\delta = \varepsilon - 1/k > 0. Each Fn(qj−)F_n(q_j-) and Fn(qj)F_n(q_j) is the mean of nn independent indicators with mean F(qj−)F(q_j-) or F(qj)F(q_j), so by Hoeffding's inequality each event has probability at most e−2nδ2e^{-2n\delta^2}. Now δ2≥ε2−2ε/k\delta^2 \ge \varepsilon^2 - 2\varepsilon/k, so 2nδ2≥2nε2−4nε/k>2nε2−42n\delta^2 \ge 2n\varepsilon^2 - 4n\varepsilon/k > 2n\varepsilon^2 - 4. The union bound gives

P(Dn>ε)≤2(k−1)e−2nδ2≤2nε⋅e4e−2nε2.■P(D_n > \varepsilon) \le 2(k - 1) e^{-2n\delta^2} \le 2n\varepsilon \cdot e^4 e^{-2n\varepsilon^2}. \qquad \blacksquare

Reduction to the uniform law. For the sharp form one may take FF continuous. Let U1,…,UnU_1, \ldots, U_n be independent uniforms with empirical distribution function GnG_n, and let Xi=F−1(Ui)X_i = F^{-1}(U_i) with the generalized inverse F−1(u)=inf⁡{t:F(t)≥u}F^{-1}(u) = \inf\{t : F(t) \ge u\}. Then Xi≤tX_i \le t exactly when Ui≤F(t)U_i \le F(t), so Fn(t)=Gn(F(t))F_n(t) = G_n(F(t)), and Dn=sup⁡t∣Gn(F(t))−F(t)∣D_n = \sup_t \lvert G_n(F(t)) - F(t) \rvert is a sup over a subset of [0,1][0, 1]. So DnD_n is at most the statistic of the uniforms, with equality in law when FF is continuous. The same holds for Dn+D_n^+ and Dn−D_n^-. A bound proved for the uniform law therefore holds for every FF.

The sharp constant. By the reduction, the sharp bounds are statements about uniform samples. Massart (1990) proved them in a long paper, and Reeve (2024) gave a shorter proof; we do not reproduce either argument. For uniform samples the exact law of Dn+D_n^+ has the finite form P(Dn+≥ε)=ε∑j=0⌊n(1−ε)⌋(nj)(1−ε−j/n)n−j(ε+j/n)j−1P(D_n^+ \ge \varepsilon) = \varepsilon \sum_{j=0}^{\lfloor n(1-\varepsilon) \rfloor} \binom{n}{j} (1 - \varepsilon - j/n)^{n-j} (\varepsilon + j/n)^{j-1}, and the exact two-sided law is a matrix power (see the Kolmogorov-Smirnov test). We checked the bounds against these exact laws, computed with the code of the Kolmogorov-Smirnov page: for n≤40n \le 40 and ε\varepsilon on a grid of step 1/4001/400, P(Dn+≥ε)P(D_n^+ \ge \varepsilon) never exceeded e−2nε2e^{-2n\varepsilon^2}, and for n≤20n \le 20 and ε\varepsilon on a grid of step 1/1001/100, P(Dn≥ε)P(D_n \ge \varepsilon) never exceeded 2e−2nε22e^{-2n\varepsilon^2}.

Consequences

A band with no table. At α=0.05\alpha = 0.05, εα=ln⁡40/(2n)\varepsilon_\alpha = \sqrt{\ln 40/(2n)}, which is 0.13580.1358 for n=100n = 100 and 0.042950.04295 for n=1000n = 1000. The exact probability that the band misses FF for a continuous FF is below 0.050.05, and close to it for large nn:

nn ε0.05\varepsilon_{0.05} exact P(Dn>ε0.05)P(D_n > \varepsilon_{0.05})
5 0.6074 0.02703
10 0.4295 0.03429
20 0.3037 0.03919
50 0.1921 0.04332
100 0.1358 0.04533

Sample size. To estimate FF everywhere within ε\varepsilon with probability 1−α1 - \alpha, n≥ln⁡(2/α)/(2ε2)n \ge \ln(2/\alpha)/(2\varepsilon^2) is enough. For α=0.05\alpha = 0.05 this is n≥738n \ge 738 for ε=0.05\varepsilon = 0.05 and n≥18445n \ge 18445 for ε=0.01\varepsilon = 0.01.

Quantiles. The band for FF gives simultaneous intervals for all quantiles at once: with probability at least 1−α1 - \alpha, F−1(p)F^{-1}(p) lies between Fn−1(p−εα)F_n^{-1}(p - \varepsilon_\alpha) and Fn−1(p+εα)F_n^{-1}(p + \varepsilon_\alpha) for every pp where these are defined.

Almost sure convergence with a rate. ∑n2e−2nε2<∞\sum_n 2e^{-2n\varepsilon^2} < \infty for each ε>0\varepsilon > 0, so by the Borel-Cantelli lemma Dn>εD_n > \varepsilon happens only finitely often. This proves the Glivenko-Cantelli theorem again, and also shows Dn=O(ln⁡n/n)D_n = O(\sqrt{\ln n / n}) almost surely.

A conservative Kolmogorov-Smirnov test. Rejecting when Dn>εαD_n > \varepsilon_\alpha is a valid test of level α\alpha with no table. It is slightly conservative: at n=100n = 100 its size is 0.045330.04533, and the exact 5% critical value is 0.1340.134 against ε0.05=0.1358\varepsilon_{0.05} = 0.1358.

Tightness

The constant 2 and the exponent 2 cannot be improved. By Kolmogorov's limit law, P(nDn>λ)→2∑k≥1(−1)k−1e−2k2λ2P(\sqrt{n} D_n > \lambda) \to 2\sum_{k \ge 1} (-1)^{k-1} e^{-2k^2\lambda^2}, and the first term of this sum is the bound 2e−2λ22e^{-2\lambda^2}. The ratio of the limit to the bound is 0.79460.7946 at λ=0.5\lambda = 0.5, 0.97850.9785 at 0.80.8, 0.997520.99752 at 1.01.0, 0.9999850.999985 at 1.361.36 and 0.999999999960.99999999996 at 2.02.0. So any bound Ce−cnε2Ce^{-c n \varepsilon^2} that holds for all nn needs C≥2C \ge 2 when c=2c = 2, and c≤2c \le 2.

The 5% point. The bound gives λ=ln⁡40/2=1.3581015\lambda = \sqrt{\ln 40/2} = 1.3581015 for the limit, and the exact 95% point of the Kolmogorov law is 1.35809861.3580986. The limit tail at the bound's point is 0.04999920.0499992. For large nn the band is as narrow as the exact one to four digits.

The one-sided condition. Massart's proof of the one-sided bound used e−2nε2≤1/2e^{-2n\varepsilon^2} \le 1/2. The grid check above found no exception for n≤40n \le 40, and Reeve (2024) proved the bound without the condition.

Independence is needed. If Xi=X1X_i = X_1 for all ii and FF is continuous, Dn≥1/2D_n \ge 1/2 always, while the bound tends to 0 for each ε<1/2\varepsilon < 1/2.

History

Aryeh Dvoretzky, Jack Kiefer and Jacob Wolfowitz (1956) proved the bound Ce−2nε2Ce^{-2n\varepsilon^2} with an unspecified constant CC, on the way to showing that the empirical distribution function is asymptotically minimax. Birnbaum and McCarty (1958) conjectured that C=1C = 1 works for the one-sided bound. Pascal Massart (1990) proved that C=2C = 2 works for the two-sided bound, which is the best constant, and C=1C = 1 for the one-sided bound when e−2nε2≤1/2e^{-2n\varepsilon^2} \le 1/2. Henry Reeve (2024) gave a short proof and removed the condition on the one-sided bound.

References

  1. A. Dvoretzky, J. Kiefer and J. Wolfowitz, Asymptotic minimax character of the sample distribution function and of the classical multinomial estimator, Annals of Mathematical Statistics 27(3), 1956, pp. 642 to 669 (the bound C exp(-2 n epsilon^2) with an unspecified constant C)
  2. P. Massart, The tight constant in the Dvoretzky-Kiefer-Wolfowitz inequality, Annals of Probability 18(3), 1990, pp. 1269 to 1283 (the two-sided bound with C = 2, and the one-sided bound with C = 1 when exp(-2 n epsilon^2) is at most 1/2)
  3. Wassily Hoeffding, Probability inequalities for sums of bounded random variables, Journal of the American Statistical Association 58(301), 1963, the bound exp(-2 n delta^2) for the mean of n independent variables with values in [0, 1], used at each grid point
  4. Henry W. J. Reeve, A short proof of the Dvoretzky-Kiefer-Wolfowitz-Massart inequality, arXiv:2403.16651, 2024, the abstract (the one-sided bound with no restriction on the failure probability, a conjecture of Birnbaum and McCarty)

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/MS1Y6V/text.yaml