Empirical distribution function

From testwiki
Revision as of 15:05, 27 February 2025 by imported>Howardcorn33 (shortened)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:Short description Template:See also

Template:CSS image crop

In statistics, an empirical distribution function (Template:Aka an empirical cumulative distribution function, eCDF) is the distribution function associated with the empirical measure of a sample.[1] This cumulative distribution function is a step function that jumps up by Template:Math at each of the Template:Math data points. Its value at any specified value of the measured variable is the fraction of observations of the measured variable that are less than or equal to the specified value.

The empirical distribution function is an estimate of the cumulative distribution function that generated the points in the sample. It converges with probability 1 to that underlying distribution, according to the Glivenko–Cantelli theorem. A number of results exist to quantify the rate of convergence of the empirical distribution function to the underlying cumulative distribution function.

Definition

Let Template:Math be independent, identically distributed real random variables with the common cumulative distribution function Template:Math. Then the empirical distribution function is defined as[2]

F^n(t)=number of elements in the sampletn=1ni=1n𝟏Xit,

where 𝟏A is the indicator of event Template:Math. For a fixed Template:Math, the indicator 𝟏Xit is a Bernoulli random variable with parameter Template:Math; hence nF^n(t) is a binomial random variable with mean Template:Math and variance Template:Math. This implies that F^n(t) is an unbiased estimator for Template:Math.

However, in some textbooks, the definition is given as

F^n(t)=1n+1i=1n𝟏Xit[3][4]

Asymptotic properties

Since the ratio Template:Math approaches 1 as Template:Math goes to infinity, the asymptotic properties of the two definitions that are given above are the same.

By the strong law of large numbers, the estimator F^n(t) converges to Template:Math as Template:Math almost surely, for every value of Template:Math:[2]

F^n(t) a.s. F(t);

thus the estimator F^n(t) is consistent. This expression asserts the pointwise convergence of the empirical distribution function to the true cumulative distribution function. There is a stronger result, called the Glivenko–Cantelli theorem, which states that the convergence in fact happens uniformly over Template:Math:[5]

F^nFsupt|F^n(t)F(t)|  0.

The sup-norm in this expression is called the Kolmogorov–Smirnov statistic for testing the goodness-of-fit between the empirical distribution F^n(t) and the assumed true cumulative distribution function Template:Math. Other norm functions may be reasonably used here instead of the sup-norm. For example, the L2-norm gives rise to the Cramér–von Mises statistic.

The asymptotic distribution can be further characterized in several different ways. First, the central limit theorem states that pointwise, F^n(t) has asymptotically normal distribution with the standard n rate of convergence:[2]

n(F^n(t)F(t))  d  𝒩(0,F(t)(1F(t))).

This result is extended by the Donsker’s theorem, which asserts that the empirical process n(F^nF), viewed as a function indexed by t, converges in distribution in the Skorokhod space D[,+] to the mean-zero Gaussian process GF=BF, where Template:Math is the standard Brownian bridge.[5] The covariance structure of this Gaussian process is

E[GF(t1)GF(t2)]=F(t1t2)F(t1)F(t2).

The uniform rate of convergence in Donsker’s theorem can be quantified by the result known as the Hungarian embedding:[6]

lim supnnln2nn(F^nF)GF,n<,a.s.

Alternatively, the rate of convergence of n(F^nF) can also be quantified in terms of the asymptotic behavior of the sup-norm of this expression. Number of results exist in this venue, for example the Dvoretzky–Kiefer–Wolfowitz inequality provides bound on the tail probabilities of nF^nF:[6]

Pr(nF^nF>z)2e2z2.

In fact, Kolmogorov has shown that if the cumulative distribution function Template:Math is continuous, then the expression nF^nF converges in distribution to B, which has the Kolmogorov distribution that does not depend on the form of Template:Math.

Another result, which follows from the law of the iterated logarithm, is that [6]

lim supnnF^nF2lnlnn12,a.s.

and

lim infn2nlnlnnF^nF=π2,a.s.

Confidence intervals

Empirical CDF, CDF and confidence interval plots for various sample sizes of normal distribution
Empirical CDF, CDF and confidence interval plots for various sample sizes of Cauchy distribution
Empirical CDF, CDF and confidence interval plots for various sample sizes of triangle distribution

As per Dvoretzky–Kiefer–Wolfowitz inequality the interval that contains the true CDF, F(x), with probability 1α is specified as

Fn(x)εF(x)Fn(x)+ε where ε=ln2α2n.

As per the above bounds, we can plot the Empirical CDF, CDF and confidence intervals for different distributions by using any one of the statistical implementations.

Statistical implementation

A non-exhaustive list of software implementations of Empirical Distribution function includes:

  • In R software, we compute an empirical cumulative distribution function, with several methods for plotting, printing and computing with such an “ecdf” object.
  • In MATLAB we can use Empirical cumulative distribution function (cdf) plot
  • jmp from SAS, the CDF plot creates a plot of the empirical cumulative distribution function.
  • Minitab, create an Empirical CDF
  • Mathwave, we can fit probability distribution to our data
  • Dataplot, we can plot Empirical CDF plot
  • Scipy, we can use scipy.stats.ecdf
  • Statsmodels, we can use statsmodels.distributions.empirical_distribution.ECDF
  • Matplotlib, using the matplotlib.pyplot.ecdf function (new in version 3.8.0)[7]
  • Seaborn, using the seaborn.ecdfplot function
  • Plotly, using the plotly.express.ecdf function
  • Excel, we can plot Empirical CDF plot
  • ArviZ, using the az.plot_ecdf function

See also

References

Template:Reflist

Further reading

Template:- Template:Statistics

  1. Template:Cite book
  2. 2.0 2.1 2.2 Template:Cite book
  3. Coles, S. (2001) An Introduction to Statistical Modeling of Extreme Values. Springer, p. 36, Definition 2.4. Template:ISBN.
  4. Madsen, H.O., Krenk, S., Lind, S.C. (2006) Methods of Structural Safety. Dover Publications. p. 148-149. Template:ISBN
  5. 5.0 5.1 Template:Cite book
  6. 6.0 6.1 6.2 Template:Cite book
  7. Template:Cite web