# Glivenko–Cantelli theorem

In the theory of probability, the Glivenko–Cantelli theorem (sometimes referred to as the Fundamental Theorem of Statistics), named after Valery Ivanovich Glivenko and Francesco Paolo Cantelli, describes the asymptotic behaviour of the empirical distribution function as the number of independent and identically distributed observations grows. Specifically, the empirical distribution function converges uniformly to the true distribution function almost surely.
The uniform convergence of more general empirical measures becomes an important property of the Glivenko–Cantelli classes of functions or sets. The Glivenko–Cantelli classes arise in Vapnik–Chervonenkis theory, with applications to machine learning. Applications can be found in econometrics making use of M-estimators.

## Statement

Assume that $X_{1},X_{2},\dots$ are independent and identically distributed random variables in $\mathbb {R}$ with common cumulative distribution function $F(x)$. The empirical distribution function for $X_{1},\dots ,X_{n}$ is defined by
    $F_{n}(x)={\frac {1}{n}}\sum _{i=1}^{n}I_{[X_{i},\infty )}(x)={\frac {1}{n}}\ {\bigl |}\left\{\ i\ \mid X_{i}\leq x,\ 1\leq i\leq n\right\}{\bigr |}$
where $I_{C}$ is the indicator function of the set $\ C~.$ For every (fixed) $\ x\ ,$ $\ F_{n}(x)\$ is a sequence of random variables which converge to $F(x)$ almost surely by the strong law of large numbers. Glivenko and Cantelli strengthened this result by proving uniform convergence of $\ F_{n}\$ to $\ F~.$
Theorem
    $\|F_{n}-F\|_{\infty }=\sup _{x\in \mathbb {R} }{\bigl |}F_{n}(x)-F(x){\bigr |}\longrightarrow 0$ almost surely.
This theorem originates with Valery Glivenko and Francesco Cantelli, in 1933.

### Remarks

* If $\ X_{n}\$ is a stationary ergodic process, then $F_{n}(x)$ converges almost surely to $\ F(x)=\operatorname {\mathbb {E} } {\bigl1_{X_{1}\leq x}{\bigr ]}~.$ The Glivenko–Cantelli theorem gives a stronger mode of convergence than this in the iid case.
* An even stronger uniform convergence result for the empirical distribution function is available in the form of an extended type of law of the iterated logarithm. See asymptotic properties of the empirical distribution function for this and related results.

## Proof

For simplicity, consider a case of continuous random variable $X$. Fix $-\infty =x_{0}<x_{1}<\cdots <x_{m-1}<x_{m}=\infty$ such that $F(x_{j})-F(x_{j-1})={\frac {1}{m}}$ for $j=1,\dots ,m$. Now for all $x\in \mathbb {R}$ there exists $j\in \{1,\dots ,m\}$ such that $x\in [x_{j-1},x_{j}]$.
    ${\begin{aligned}F_{n}(x)-F(x)&\leq F_{n}(x_{j})-F(x_{j-1})=F_{n}(x_{j})-F(x_{j})+{\frac {1}{m}},\\F_{n}(x)-F(x)&\geq F_{n}(x_{j-1})-F(x_{j})=F_{n}(x_{j-1})-F(x_{j-1})-{\frac {1}{m}}.\end{aligned}}$
Therefore,
    $\|F_{n}-F\|_{\infty }=\sup _{x\in \mathbb {R} }|F_{n}(x)-F(x)|\leq \max _{j\in \{1,\dots ,m\}}|F_{n}(x_{j})-F(x_{j})|+{\frac {1}{m}}.$
Since max$_{j∈{1, …, m}}$|F$_n$(x$_j$)−F(x$_j$)|→0 a.s.{\textstyle \max _{j\in \{1, \dots , m\}}|F_{n}(x_{j})-F(x_{j})|\to 0{\text{ a.s.}}} by strong law of large numbers, we can guarantee that for any positive ε{\textstyle \varepsilon } and any integer m{\textstyle m} such that 1/m<ε{\textstyle 1/m<\varepsilon }, we can find N{\textstyle N} such that for all $n\geq N$, we have max$_{j∈{1, …, m}}$|F$_n$(x$_j$)−F(x$_j$)|≤ε−1/m a.s.{\textstyle \max _{j\in \{1, \dots , m\}}|F_{n}(x_{j})-F(x_{j})|\leq \varepsilon -1/m{\text{ a.s.}}}. Combined with the above result, this further implies that ‖F$_n$−F‖$_∞$≤ε a.s.{\textstyle \|F_{n}-F\|_{\infty }\leq \varepsilon {\text{ a.s.}}}, which is the definition of almost sure convergence.

## Empirical measures

One can generalize the empirical distribution function by replacing the set $(-\infty ,x]$ by an arbitrary set C from a class of sets ${\mathcal {C}}$ to obtain an empirical measure indexed by sets $C\in {\mathcal {C}}.$
    $P_{n}(C)={\frac {1}{n}}\sum _{i=1}^{n}I_{C}(X_{i}),C\in {\mathcal {C}}$
Where $I_{C}(x)$ is the indicator function of each set $C$.
Further generalization is the map induced by $P_{n}$ on measurable real-valued functions f, which is given by
    $f\mapsto P_{n}f=\int _{S}f\,dP_{n}={\frac {1}{n}}\sum _{i=1}^{n}f(X_{i}),f\in {\mathcal {F}}.$
Then it becomes an important property of these classes whether the strong law of large numbers holds uniformly on ${\mathcal {F}}$ or ${\mathcal {C}}$.

## Glivenko–Cantelli class

Consider a set $\ {\mathcal {S}}\$ with a sigma algebra of Borel subsets A and a probability measure $\ \mathbb {P} ~.$ For a class of subsets,
    ${\mathcal {C}}\subset {\bigl \C:C{\text{ is measurable subset of }}{\mathcal {S}}{\bigr \}}$
and a class of functions
    ${\mathcal {F}}\subset {\bigl \f:{\mathcal {S}}\to \mathbb {R} ,f{\mbox{ is measurable}}\ {\bigr \}}$
define random variables
    ${\bigl \|}\mathbb {P} _{n}-\mathbb {P} {\bigr \|}_{\mathcal {C}}=\sup _{C\in {\mathcal {C}}}{\bigl |}\mathbb {P} _{n}(C)-\mathbb {P} (C){\bigr |}$
    ${\bigl \|}\mathbb {P} _{n}-\mathbb {P} {\bigr \|}_{\mathcal {F}}=\sup _{f\in {\mathcal {F}}}{\bigl |}\mathbb {P} _{n}f-\mathbb {P} f{\bigr |}$
where $\ \mathbb {P} _{n}(C)\$ is the empirical measure, $\ \mathbb {P} _{n}f\$ is the corresponding map, and
    $\ \mathbb {P} f=\int _{\mathcal {S}}f\ \mathrm {d} \mathbb {P} \ ,$ assuming that it exists.
Definitions
* A class $\ {\mathcal {C}}\$ is called a Glivenko–Cantelli class (or GC class, or sometimes strong GC class) with respect to a probability measure P if
       $\ {\bigl \|}\mathbb {P} _{n}-\mathbb {P} {\bigr \|}_{\mathcal {C}}\to 0\$ almost surely as $\ n\to \infty ~.$
* A class $\ {\mathcal {C}}\$ is a weak Glivenko-Cantelli class with respect to P if it instead satisfies the weaker condition
       $\ {\bigl \|}\mathbb {P} _{n}-\mathbb {P} {\bigr \|}_{\mathcal {C}}\to 0\$ in probability as $\ n\to \infty ~.$
* A class is called a universal Glivenko–Cantelli class if it is a GC class with respect to any probability measure $\mathbb {P}$ on $({\mathcal {S}},A)$.
* A class is a weak uniform Glivenko–Cantelli class if the convergence occurs uniformly over all probability measures $\mathbb {P}$ on $({\mathcal {S}},A)$: For every $\varepsilon >0$,
       $\ \sup _{\mathbb {P} \in \mathbb {P} ({\mathcal {S}},A)}\Pr \left({\bigl \|}\mathbb {P} _{n}-\mathbb {P} {\bigr \|}_{\mathcal {C}}>\varepsilon \right)\to 0\$ as $\ n\to \infty ~.$
* A class is a (strong) uniform Glivenko-Cantelli class if it satisfies the stronger condition that for every $\varepsilon >0$,
       $\ \sup _{\mathbb {P} \in \mathbb {P} ({\mathcal {S}},A)}\Pr \left(\sup _{m\geq n}{\bigl \|}\mathbb {P} _{m}-\mathbb {P} {\bigr \|}_{\mathcal {C}}>\varepsilon \right)\to 0\$ as $\ n\to \infty ~.$
Glivenko–Cantelli classes of functions (as well as their uniform and universal forms) are defined similarly, replacing all instances of ${\mathcal {C}}$ with ${\mathcal {F}}$.
The weak and strong versions of the various Glivenko-Cantelli properties often coincide under certain regularity conditions. The following definition commonly appears in such regularity conditions:
* A class of functions ${\mathcal {F}}$ is image-admissible Suslin if there exists a Suslin space $\Omega$ and a surjection $T:\Omega \rightarrow {\mathcal {F}}$ such that the map $(x,y)\mapsto [T(y)](x)$ is measurable ${\mathcal {X}}\times \Omega$.
* A class of measurable sets ${\mathcal {C}}$ is image-admissible Suslin if the class of functions $\{\mathbf {1} _{C}\mid C\in {\mathcal {C}}\}$ is image-admissible Suslin, where $\mathbf {1} _{C}$ denotes the indicator function for the set $C$.
Theorems
The following two theorems give sufficient conditions for the weak and strong versions of the Glivenko-Cantelli property to be equivalent.
Theorem (Talagrand, 1987)
    Let ${\mathcal {F}}$ be a class of functions that is integrable $\mathbb {P}$, and define ${\mathcal {F}}_{0}=\{f-\mathbb {P} f\mid f\in {\mathcal {F}}\}$. Then the following are equivalent:
* ${\mathcal {F}}$ is a weak Glivenko-Cantelli class and ${\mathcal {F}}_{0}$ is dominated by an integrable function
* ${\mathcal {F}}$ is a Glivenko-Cantelli class
Theorem (Dudley, Giné, and Zinn, 1991)
    Suppose that a function class ${\mathcal {F}}$ is bounded. Also suppose that the set ${\mathcal {F}}_{0}=\{f-\inf f\mid f\in {\mathcal {F}}\}$ is image-admissible Suslin. Then ${\mathcal {F}}$ is a weak uniform Glivenko-Cantelli class if and only if it is a strong uniform Glivenko-Cantelli class.
The following theorem is central to statistical learning of binary classification tasks.
Theorem (Vapnik and Chervonenkis, 1968)
    Under certain consistency conditions, a universally measurable class of sets $\ {\mathcal {C}}\$ is a uniform Glivenko-Cantelli class if and only if it is a Vapnik–Chervonenkis class.
There exist a variety of consistency conditions for the equivalence of uniform Glivenko-Cantelli and Vapnik-Chervonenkis classes. In particular, either of the following conditions for a class ${\mathcal {C}}$ suffice:
* ${\mathcal {C}}$ is image-admissible Suslin.
* ${\mathcal {C}}$ is universally separable: There exists a countable subset ${\mathcal {C_{0}}}$ of ${\mathcal {C}}$ such that each set $C\in {\mathcal {C}}$ can be written as the pointwise limit of sets in ${\mathcal {C}}_{0}$.

## Examples

* Let $S=\mathbb {R}$ and ${\mathcal {C}}=\{(-\infty ,t]:t\in {\mathbb {R} }\}$. The classical Glivenko–Cantelli theorem implies that this class is a universal GC class. Furthermore, by Kolmogorov's theorem,
    $\sup _{P\in {\mathcal {P}}(S,A)}\|P_{n}-P\|_{\mathcal {C}}\sim n^{-1/2}$, that is ${\mathcal {C}}$ is uniformly Glivenko–Cantelli class.
* Let P be a nonatomic probability measure on S and ${\mathcal {C}}$ be a class of all finite subsets in S. Because $A_{n}=\{X_{1},\ldots ,X_{n}\}\in {\mathcal {C}}$, $P(A_{n})=0$, $P_{n}(A_{n})=1$, we have that $\|P_{n}-P\|_{\mathcal {C}}=1$ and so ${\mathcal {C}}$ is not a GC class with respect to P.