# Dvoretzky–Kiefer–Wolfowitz inequality

In the theory of probability and statistics, the Dvoretzky–Kiefer–Wolfowitz–Massart inequality (DKW inequality) provides a bound on the worst case distance of an empirically determined distribution function from its associated population distribution function. It is named after Aryeh Dvoretzky, Jack Kiefer, and Jacob Wolfowitz, who in 1956 proved the inequality
    $\Pr {\Bigl\sup _{x\in \mathbb {R} }|F_{n}(x)-F(x)|>\varepsilon {\Bigr )}\leq Ce^{-2n\varepsilon ^{2}}\qquad {\text{for every }}\varepsilon >0.$
with an unspecified multiplicative constant C in front of the exponent on the right-hand side.
In 1990, Pascal Massart proved the inequality with the sharp constant C = 2, confirming a conjecture due to Birnbaum and McCarty.

## The DKW inequality

Given a natural number n, let X$_1$, X$_2$, …, X$_n$ be real-valued independent and identically distributed random variables with cumulative distribution function F(·). Let F$_n$ denote the associated empirical distribution function defined by
    $F_{n}(x)={\frac {1}{n}}\sum _{i=1}^{n}\mathbf {1} _{\{X_{i}\leq x\}},\qquad x\in \mathbb {R} .$
so $F(x)$ is the probability that a single random variable $X$ is smaller than $x$, and $F_{n}(x)$ is the fraction of random variables that are smaller than $x$.
The Dvoretzky–Kiefer–Wolfowitz inequality bounds the probability that the random function F$_n$ differs from F by more than a given constant ε > 0 anywhere on the real line. More precisely, there is the one-sided estimate
    $\Pr {\Bigl\sup _{x\in \mathbb {R} }{\biglF_{n}(x)-F(x){\bigr )}>\varepsilon {\Bigr )}\leq e^{-2n\varepsilon ^{2}}\qquad {\text{for every }}\varepsilon \geq {\sqrt {{\tfrac {1}{2n}}\ln 2}},$
which also implies a two-sided estimate
    $\Pr {\Bigl\sup _{x\in \mathbb {R} }|F_{n}(x)-F(x)|>\varepsilon {\Bigr )}\leq 2e^{-2n\varepsilon ^{2}}\qquad {\text{for every }}\varepsilon >0.$
This strengthens the Glivenko–Cantelli theorem by quantifying the rate of convergence as n tends to infinity. It also estimates the tail probability of the Kolmogorov–Smirnov statistic. The inequalities above follow from the case where F corresponds to be the uniform distribution on [0,1] as F$_n$ has the same distributions as G$_n$(F) where G$_n$ is the empirical distribution of U$_1$, U$_2$, …, U$_n$ where these are independent and Uniform(0,1), and noting that
    $\sup _{x\in \mathbb {R} }|F_{n}(x)-F(x)|\;{\stackrel {d}{=}}\;\sup _{x\in \mathbb {R} }|G_{n}(F(x))-F(x)|\leq \sup _{0\leq t\leq 1}|G_{n}(t)-t|,$
with equality if and only if F is continuous.

## Kaplan–Meier estimator

The Dvoretzky–Kiefer–Wolfowitz inequality is obtained for the Kaplan–Meier estimator which is a right-censored data analog of the empirical distribution function
    $\Pr {\Bigl{\sqrt {n}}\sup _{t\in [0,\infty )}|(1-G(t))(F_{n}(t)-F(t))|>\varepsilon {\Bigr )}\leq 2.5e^{-2\varepsilon ^{2}+C\varepsilon }$
for every $\varepsilon >0$ and for some constant $C<\infty$, where $F_{n}$ is the Kaplan–Meier estimator, and $G$ is the censoring distribution function.

## Building CDF bands

The Dvoretzky–Kiefer–Wolfowitz inequality is one method for generating CDF-based confidence bounds and producing a confidence band, which is sometimes called the Kolmogorov–Smirnov confidence band. The purpose of this confidence interval is to contain the entire CDF at the specified confidence level, while alternative approaches attempt to only achieve the confidence level on each individual point, which can allow for a tighter bound. The DKW bounds runs parallel to, and is equally above and below, the empirical CDF. The equally spaced confidence interval around the empirical CDF allows for different rates of violations across the support of the distribution. In particular, it is more common for a CDF to be outside of the CDF bound estimated using the DKW inequality near the median of the distribution than near the endpoints of the distribution.
The interval that contains the true CDF, $F(x)$, with probability $1-\alpha$ is often specified as
    $F_{n}(x)-\varepsilon \leq F(x)\leq F_{n}(x)+\varepsilon \;{\text{ where }}\varepsilon ={\sqrt {\frac {\ln {\frac {2}{\alpha }}}{2n}}}.$