# Empirical measure

In probability theory, an empirical measure is a random measure arising from a particular realization of a (usually finite) sequence of random variables. The precise definition is found below. Empirical measures are relevant to mathematical statistics.
The motivation for studying empirical measures is that it is often impossible to know the true underlying probability measure $P$. We collect observations $X_{1},X_{2},\dots ,X_{n}$ and compute relative frequencies. We can estimate $P$, or a related distribution function $F$ by means of the empirical measure or empirical distribution function, respectively. These are uniformly good estimates under certain conditions. Theorems in the area of empirical processes provide rates of this convergence.

## Definition

Let $X_{1},X_{2},\dots$ be a sequence of independent identically distributed random variables with values in the state space S with probability distribution P.
Definition
    The empirical measure P$_n$ is defined for measurable subsets of S and given by
       $P_{n}(A)={1 \over n}\sum _{i=1}^{n}I_{A}(X_{i})={\frac {1}{n}}\sum _{i=1}^{n}\delta _{X_{i}}(A)$
       where $I_{A}$ is the indicator function and $\delta _{X}$ is the Dirac measure.
Properties
* For a fixed measurable set A, nP$_n$(A) is a binomial random variable with mean nP(A) and variance nP(A)(1 − P(A)).
** In particular, P$_n$(A) is an unbiased estimator of P(A).
* For a fixed partition $A_{i}$ of S, random variables $Y_{i}=nP_{n}(A_{i})$ form a multinomial distribution with event probabilities $P(A_{i})$
** The covariance matrix of this multinomial distribution is $Cov(Y_{i},Y_{j})=nP(A_{i})(\delta _{ij}-P(A_{j}))$.
Definition
    ${\biglP_{n}(c){\bigr )}_{c\in {\mathcal {C}}}$ is the empirical measure indexed by ${\mathcal {C}}$, a collection of measurable subsets of S.
To generalize this notion further, observe that the empirical measure $P_{n}$ maps measurable functions $f:S\to \mathbb {R}$ to their empirical mean,
    $f\mapsto P_{n}f=\int _{S}f\,dP_{n}={\frac {1}{n}}\sum _{i=1}^{n}f(X_{i})$
In particular, the empirical measure of A is simply the empirical mean of the indicator function, P$_n$(A) = P$_n$ I$_A$.
For a fixed measurable function $f$, $P_{n}f$ is a random variable with mean $\mathbb {E} f$ and variance ${\frac {1}{n}}\mathbb {E} (f-\mathbb {E} f)^{2}$.
By the strong law of large numbers, P$_n$(A) converges to P(A) almost surely for fixed A. Similarly $P_{n}f$ converges to $\mathbb {E} f$ almost surely for a fixed measurable function $f$. The problem of uniform convergence of P$_n$ to P was open until Vapnik and Chervonenkis solved it in 1968.
If the class ${\mathcal {C}}$ (or ${\mathcal {F}}$) is Glivenko–Cantelli with respect to P then P$_n$ converges to P uniformly over $c\in {\mathcal {C}}$ (or $f\in {\mathcal {F}}$). In other words, with probability 1 we have
    $\|P_{n}-P\|_{\mathcal {C}}=\sup _{c\in {\mathcal {C}}}|P_{n}(c)-P(c)|\to 0,$
    $\|P_{n}-P\|_{\mathcal {F}}=\sup _{f\in {\mathcal {F}}}|P_{n}f-\mathbb {E} f|\to 0.$

## Empirical distribution function

The empirical distribution function provides an example of empirical measures. For real-valued iid random variables $X_{1},\dots ,X_{n}$ it is given by
    $F_{n}(x)=P_{n}((-\infty ,x])=P_{n}I_{(-\infty ,x]}.$
In this case, empirical measures are indexed by a class ${\mathcal {C}}=\{(-\infty ,x]:x\in \mathbb {R} \}.$ It has been shown that ${\mathcal {C}}$ is a uniform Glivenko–Cantelli class, in particular,
    $\sup _{F}\|F_{n}(x)-F(x)\|_{\infty }\to 0$
with probability 1.