DKW Simultaneous CDF Band
Build one distribution-free confidence band for an entire empirical CDF.
By Riano · Published · Updated · Report a correction
DKW Simultaneous CDF Band
The Dvoretzky-Kiefer-Wolfowitz (DKW) inequality provides a rigorous way to bound the difference between an empirical cumulative distribution function (CDF) and the true underlying CDF. It yields a distribution-free confidence band that holds simultaneously for all values in the domain, which is a much stronger guarantee than constructing individual confidence intervals at separate points.
Calculation of the Band and Gap
Consider a sample of size n = 8 with points evenly spaced according to the "Spread" pattern: [0.1, 0.2, 0.3, 0.4, 0.6, 0.7, 0.8, 0.9]. The true benchmark CDF is Uniform[0, 1], meaning F(x) = x for 0 ≤ x ≤ 1. We construct a 95% confidence band (α = 0.05).
- Calculate the epsilon radius for the band: ε = √(ln(2 / α) / (2n)). Here n = 8 and α = 0.05.
- ε = √(ln(40) / 16) ≈ √(3.688879 / 16) ≈ √0.230555 ≈ 0.480161.
- For probe x = 0.5, the empirical CDF counts points ≤ 0.5. Four points (0.1, 0.2, 0.3, 0.4) are ≤ 0.5, so Fn(0.5) = 4 / 8 = 0.5.
- The pointwise interval at x = 0.5 is bounded by max(0, Fn(0.5) - ε) and min(1, Fn(0.5) + ε).
- Lower bound: max(0, 0.5 - 0.480161) = 0.019839. Upper bound: min(1, 0.5 + 0.480161) = 0.980161.
- To find the supremum gap D, we check differences at the step edges. The sorted values xi (1-based) have empirical CDF stepping from (i-1)/n to i/n at xi. Since x1=0.1, F(x1)=0.1. The gap before the step is 0 - 0.1 = -0.1. The gap after is 1/8 - 0.1 = 0.025. Evaluating all points, the maximum absolute difference occurs at points like x4=0.4 (before step: Fn=3/8=0.375, F=0.4, gap=0.025; after: Fn=4/8=0.5, F=0.4, gap=0.1). The supremum CDF gap D is exactly 0.1.
- Because D = 0.1 ≤ ε ≈ 0.480, the entire true CDF is successfully covered by the simultaneous band.
Investigating the Confidence Band
Open the DKW Simultaneous CDF Band module to visualize how different datasets interact with the confidence band.
- Set Sample to "Spread" and Size to 8. The blue empirical CDF steps along the true orange curve, with D = 0.1.
- Set Sample to "Clustered" (points 0.10 through 0.17). The empirical CDF climbs to 1.0 very early, while the true CDF continues linearly. The gap D reaches 0.83 at x = 0.17, which exceeds the band radius of 0.480, so the true CDF escapes the band.
- Set Size to 1. The band radius widens significantly (ε ≈ 1.358), forcing the clipped band bounds to their logical limits of 0 and 1.
- Change Alpha to 0.01. Notice the required epsilon increases to guarantee the higher 99% simultaneous coverage probability.
- Use Probe x to inspect specific points; notice how the gap at any single point is just one local cross-section of the total supremum distance D.
Assumptions and Limitations
The exact DKW inequality bound holds for independent and identically distributed (iid) samples, and the confidence level α describes the long-run probability over repeated random samples that the entire band covers the true CDF. In this module, the data points are illustrative fixed fixtures (e.g., uniformly spread or heavily clustered) rather than true random draws, which is why coverage can deterministically fail (as with the Clustered sample). When Size is 0, the statistics are undefined and presented as "Unavailable". Also, while the mathematical formula for ε can yield values greater than 1 for small n, empirical probabilities are strictly bounded, so the final visible band is clipped to [0, 1].
Primary References
The strict constant for the inequality was proved in: Pascal Massart. "The tight constant in the Dvoretzky-Kiefer-Wolfowitz inequality," The Annals of Probability, 1990. Massart showed that the constant 2 in the exponent is sharp, ensuring the bound holds for all n and ε without asymptotic approximations.
Experience it interactively
Adjust parameters, observe in real time, and build deep intuition with Riano’s interactive DKW Simultaneous CDF Band module.
Try DKW Simultaneous CDF Band on Riano →