Probability & Statistics

Empirical CDF

Calculate the step CDF for a finite sample with ties and observe right-continuity.

By Riano · Published · Updated · Report a correction

Empirical CDF

Concept Overview

The Empirical Cumulative Distribution Function (ECDF) is a step function that estimates the true cumulative distribution function of the population that generated the sample. For a dataset of n observations, the empirical CDF at any value x is the proportion of the sample that is less than or equal to x.

Worked Example

Let's calculate the Empirical CDF for the sample [1, 2, 2, 4] at different thresholds.

First, the sample size is n = 4. We can denote our ordered observations as:
X1 = 1, X2 = 2, X3 = 2, X4 = 4.

  1. At x = 1.5: The only observation less than or equal to 1.5 is 1. Thus, the count is 1. The result is 1 / 4 = 0.25.
  2. At x = 2: The observations less than or equal to 2 are 1, 2, and 2. The count is 3. Note that the CDF includes equality at the threshold, meaning both 2s are counted. The jump at the value 2 is therefore 2/4. The expected result is 3 / 4 = 0.75.
  3. At x = 4: All observations (1, 2, 2, 4) are less than or equal to 4. The result is 4 / 4 = 1.0.

Experiment

You can use the Empirical CDF interactive module to observe how the step plot changes based on your data.

  1. Select the Ties preset to load the sample 1, 2, 2, 4.
  2. Set the threshold slider to exactly 2.0.
  3. Observe that the calculated CDF value F_n(2.0) is exactly 0.75, showing that the function counts the tied values up to and including the threshold.
  4. Select the Single observation preset to observe how a single data point creates a single unit jump from 0 to 1 at its location.

Limitations and Boundaries

The Empirical CDF has specific behaviors at its extremes and points of discontinuity:

  • Below minimum: For any threshold strictly less than the minimum observed value, the CDF is exactly 0.
  • At or above maximum: For any threshold greater than or equal to the maximum observed value, the CDF is exactly 1.
  • Right-continuity: At any observed value, the step function jumps to include the new data point(s). If multiple observations have the exact same value (ties), they share a single, larger jump in the function. The function is mathematically "right-continuous", meaning the value of the function exactly at the step is equal to the higher value after the jump.

The observations are unweighted, uncensored sample data. A sample of at most twenty values does not identify the population CDF exactly; no confidence interval is estimated here. JavaScript stores numbers at finite precision. The plot rescales its horizontal coordinates to handle large finite values, while tick labels show the original units and CDF counts still compare the original observations.

References

The following reference describes the empirical CDF plot and details its properties and interpretation, which provides the mathematical foundation for this module.

Experience it interactively

Adjust parameters, observe in real time, and build deep intuition with Riano’s interactive Empirical CDF module.

Try Empirical CDF on Riano →

More in Probability & Statistics