Distribution Sampler & ECDF Visualizer

Generate random samples from various distributions and visualize the empirical cumulative distribution function (ECDF) against the true CDF. See how confidence bands capture uncertainty in the empirical estimate.

True CDF
Empirical CDF
-
Sample Size
-
Sample Mean
-
Sample Std Dev
-
KS Statistic

Understanding the Visualization

Empirical CDF (Red): The step function shows the proportion of samples ≤ x. Each jump represents a data point. For n samples, F̂ₙ(x) = (1/n) × Σ I(Xᵢ ≤ x)

True CDF (Blue): The theoretical cumulative distribution function F(x) for the selected distribution.

Pointwise Confidence Bands (Orange): At each x, these bands have the specified probability of containing the true CDF value.
Formula: F̂ₙ(x) ± zα/2 × √[F̂ₙ(x)(1 - F̂ₙ(x))/n]
where zα/2 is the (1 - α/2) quantile of the standard normal distribution

Uniform Confidence Bands (Purple): The Dvoretzky-Kiefer-Wolfowitz (DKW) inequality guarantees these bands contain the entire true CDF with the specified probability.
Formula: F̂ₙ(x) ± ε, where ε = √[ln(2/α)/(2n)]
This ensures P(supx |F̂ₙ(x) - F(x)| > ε) ≤ α

KS Statistic: Dₙ = supx |F̂ₙ(x) - F(x)|
The maximum vertical distance between the empirical and true CDFs across all x values.