Unit 11, lesson 69

The Law of Large Numbers for Continuous Variables

How the weak law of large numbers covers IID continuous observations with finite variance, how the Chebyshev bound for a sample mean gives a sufficient sample size, and why the bound is conservative and can fail under dependence.

  • Video 69
  • Limit Theorems for Averages

In a constructed model, a sensor reading is uniform between 00 and 22, so a single reading misses the mean 11 by at least 0.10.1 with probability 0.90.9. How many independent readings must be averaged before a miss that large has probability at most 0.050.05? The law of large numbers for discrete variables answered questions like this for outcomes such as counts, and the same argument works for continuous measurements, because it uses only a mean, a finite variance and independence. This lesson proves the weak law for continuous variables, turns the Chebyshev bound into a sample size, and shows what that bound does and does not promise.

Key terms

Weak law of large numbers for continuous variables

Definition Let X1,X2,…X_1, X_2, \dots be IID random variables with mean μ\mu and finite variance σ2\sigma^2, let Sn=X1+⋯+XnS_n = X_1 + \cdots + X_n and let Xˉn=Sn/n\bar{X}_n = S_n / n. The weak law of large numbers says that for every fixed ε>0\varepsilon > 0

P(∣Xˉn−μ∣≥ε)→0as n→∞.\begin{aligned} &P(\lvert \bar{X}_n - \mu \rvert \ge \varepsilon) \\[0.4em] &\quad \to 0 \quad \text{as } n \to \infty. \end{aligned}

This is convergence in probability of Xˉn\bar{X}_n to μ\mu. The proof in the Chebyshev card below uses only the mean, the variance and independence, so it covers continuous distributions exactly as it covers discrete ones, and no density formula enters. Laws of large numbers under weaker assumptions exist, but this finite-variance version is the one proved here.

In plain words Fix any size of miss in advance. Once enough independent observations are averaged, a miss at least that large becomes improbable. The law speaks about probabilities across possible samples at each sample size. It does not say that every new observation moves the average closer to μ\mu, and earlier misses are diluted by later observations, not corrected by them. IID is an assumption about how the data arise. Readings from an instrument whose behavior drifts over time are not identically distributed, and collecting many of them does not make them so.

Example Let the readings Xi∼Uniform⁡(0,2)X_i \sim \operatorname{Uniform}(0, 2) be IID. Then μ=1\mu = 1 and

σ2=(2−0)212=13,\sigma^2 = \frac{(2 - 0)^2}{12} = \frac{1}{3},

which is finite, so the weak law applies and P(∣Xˉn−1∣≥0.1)→0P(\lvert \bar{X}_n - 1 \rvert \ge 0.1) \to 0. For a single reading this probability is 0.90.9, since X1X_1 misses by at least 0.10.1 unless it lands in the interval (0.9,1.1)(0.9, 1.1), whose length 0.20.2 is a tenth of the length of the support. For the average of two readings it is already 0.810.81, from the triangular density of X1+X2X_1 + X_2.

Running average

Definition Given observed values x1,x2,…x_1, x_2, \dots, the running average after kk observations is

xˉk=x1+⋯+xkk\bar{x}_k = \frac{x_1 + \cdots + x_k}{k}

for each k≥1k \ge 1. It can be updated one value at a time by xˉk=xˉk−1+(xk−xˉk−1)/k\bar{x}_k = \bar{x}_{k-1} + (x_k - \bar{x}_{k-1})/k for k≥2k \ge 2. The graph of xˉk\bar{x}_k against kk is one path. Before the data exist, the running averages Xˉ1,Xˉ2,…\bar{X}_1, \bar{X}_2, \dots are random, and a path is one realization of the whole sequence. It is not a histogram of many independent sample means, and it is a different object from the sampling distribution of Xˉn\bar{X}_n.

In plain words A running average plot shows what happened in one run. The weak law says that at a single large step kk the running average is probably close to μ\mu. A path can still move away from μ\mu at many individual steps, and another run gives another path.

Example One pseudorandom run of 10,00010{,}000 draws from Uniform⁡(0,2)\operatorname{Uniform}(0, 2), made with Python’s random module and seed 8701287012, gave these running averages.

kk10101001001,0001{,}00010,00010{,}000
xˉk\bar{x}_k0.63930.63930.92890.92890.99210.99210.99670.9967

The checkpoints approach μ=1\mu = 1, yet in the same run 5,0005{,}000 of the 9,9999{,}999 updates moved the average farther from 11. These simulated values illustrate the law in one run and do not prove it. A small constructed case shows a single step moving away. The values 0.90.9, 1.51.5 and 0.30.3 give the running averages 0.90.9, 1.21.2 and 0.90.9, whose distances from 11 are 0.10.1, 0.20.2 and 0.10.1.

Chebyshev bound for a sample mean

Definition Let X1,…,XnX_1, \dots, X_n be independent, each with mean μ\mu and finite variance σ2\sigma^2. Linearity gives E[Xˉn]=μE[\bar{X}_n] = \mu, a step that needs no independence. Independence makes every covariance Cov⁡(Xi,Xj)\operatorname{Cov}(X_i, X_j) with i≠ji \ne j equal to 00, so Var⁡(Sn)=nσ2\operatorname{Var}(S_n) = n\sigma^2 and Var⁡(Xˉn)=σ2/n\operatorname{Var}(\bar{X}_n) = \sigma^2/n. Pairwise uncorrelated observations would be enough for this step. Chebyshev’s inequality says that P(∣Y−E[Y]∣≥ε)≤Var⁡(Y)/ε2P(\lvert Y - E[Y] \rvert \ge \varepsilon) \le \operatorname{Var}(Y)/\varepsilon^2 for every YY with finite variance and every ε>0\varepsilon > 0. Applied to Y=XˉnY = \bar{X}_n it gives

P(∣Xˉn−μ∣≥ε)≤σ2nε2.\begin{aligned} &P(\lvert \bar{X}_n - \mu \rvert \ge \varepsilon) \\[0.4em] &\quad \le \frac{\sigma^2}{n\varepsilon^2}. \end{aligned}

For fixed ε\varepsilon the right side tends to 00, which proves the weak law. A bound above 11 gives no information, since every probability is at most 11. To make the bound at most a target δ\delta with 0<δ<10 < \delta < 1, it suffices that

n≥σ2δε2,n \ge \frac{\sigma^2}{\delta \varepsilon^2},

and since nn counts observations, take the smallest positive whole number at least this large.

In plain words The average of nn independent observations has 1/n1/n of the variance of one observation, and Chebyshev’s inequality turns a small variance into a small probability of a large miss. Halving the tolerance multiplies the threshold σ2/(δε2)\sigma^2/(\delta \varepsilon^2) for nn by four.

Example For IID Uniform⁡(0,2)\operatorname{Uniform}(0, 2) readings and ε=0.1\varepsilon = 0.1,

P(∣Xˉn−1∣≥0.1)≤1/30.01 n=1003n.\begin{aligned} &P(\lvert \bar{X}_n - 1 \rvert \ge 0.1) \\[0.4em] &\quad \le \frac{1/3}{0.01\,n} = \frac{100}{3n}. \end{aligned}

At n=1000n = 1000 the bound is 130≈0.0333\tfrac{1}{30} \approx 0.0333, so P(0.9<Xˉ1000<1.1)≥2930P(0.9 < \bar{X}_{1000} < 1.1) \ge \tfrac{29}{30}. For a bound of at most 0.050.05 the sample size must satisfy 100/(3n)≤0.05100/(3n) \le 0.05, which means n≥2000/3≈666.67n \ge 2000/3 \approx 666.67, so 667667 readings suffice. Indeed n=667n = 667 gives 100/2001≈0.04998100/2001 \approx 0.04998, while n=666n = 666 gives 100/1998≈0.05005100/1998 \approx 0.05005.

Conservative bound

Definition A bound is conservative when it is guaranteed under its assumptions but can be far larger than the probability it bounds. Chebyshev’s inequality uses only the mean and the variance, so it must hold for every distribution with those two values, including the least favorable one, and for a particular model it is often loose. A sample size taken from a conservative bound is sufficient for the stated guarantee but need not be necessary, and the bound is not an estimate of the actual probability.

In plain words The bound has to hold even in the worst case among all distributions with the given mean and variance, so it says little about the behavior of the model at hand. A smaller sample may already meet the goal, and finding out requires the exact distribution or a justified approximation.

Example For two IID Uniform⁡(0,2)\operatorname{Uniform}(0, 2) readings the sum has a triangular density on [0,4][0, 4]. With ε=0.5\varepsilon = 0.5 the exact miss probability is P(∣Xˉ2−1∣≥0.5)=14P(\lvert \bar{X}_2 - 1 \rvert \ge 0.5) = \tfrac14, while the bound gives 1/60.25=23\tfrac{1/6}{0.25} = \tfrac23. For the tolerance 0.10.1 of the earlier example, the exact distribution of a sum of independent uniform variables shows that the miss probability P(∣Xˉn−1∣≥0.1)P(\lvert \bar{X}_n - 1 \rvert \ge 0.1) first drops to 0.050.05 or below at n=128n = 128, and at n=667n = 667 it is about 0.00000750.0000075. Here Chebyshev asks for about five times as many readings as the goal requires.

Perfectly dependent observations

Definition Observations are perfectly dependent when all of them equal one random variable, X1=X2=⋯=Xn=ZX_1 = X_2 = \cdots = X_n = Z, where ZZ has mean μ\mu and finite variance σ2\sigma^2. Each XiX_i then has the distribution of ZZ, so the observations are identically distributed. When σ2>0\sigma^2 > 0 and n≥2n \ge 2 they are not independent, since Cov⁡(Xi,Xj)=σ2>0\operatorname{Cov}(X_i, X_j) = \sigma^2 > 0 for i≠ji \ne j. The average is Xˉn=Z\bar{X}_n = Z for every nn, so Var⁡(Xˉn)=σ2\operatorname{Var}(\bar{X}_n) = \sigma^2, and the miss probability P(∣Xˉn−μ∣≥ε)=P(∣Z−μ∣≥ε)P(\lvert \bar{X}_n - \mu \rvert \ge \varepsilon) = P(\lvert Z - \mu \rvert \ge \varepsilon) does not change with nn. When σ2>0\sigma^2 > 0 and n≥2n \ge 2, the step Var⁡(Xˉn)=σ2/n\operatorname{Var}(\bar{X}_n) = \sigma^2/n fails, because all n2n^2 terms in

Var⁡(Sn)=∑i=1n∑j=1nCov⁡(Xi,Xj)\begin{aligned} &\operatorname{Var}(S_n) \\[0.4em] &\quad = \sum_{i=1}^{n} \sum_{j=1}^{n} \operatorname{Cov}(X_i, X_j) \end{aligned}

equal σ2\sigma^2, which gives Var⁡(Sn)=n2σ2\operatorname{Var}(S_n) = n^2\sigma^2 instead of nσ2n\sigma^2.

In plain words Entering one measurement many times copies its error instead of averaging it away. The averaging argument of this lesson relies on independence, and identical distributions alone do not supply it.

Example Let Z∼Uniform⁡(0,2)Z \sim \operatorname{Uniform}(0, 2) and Xi=ZX_i = Z for every ii. Each observation is Uniform⁡(0,2)\operatorname{Uniform}(0, 2), exactly as in the IID model, but Xˉn=Z\bar{X}_n = Z has variance 13\tfrac13 for every nn, while the IID average has variance 1/(3n)1/(3n). The miss probability P(∣Xˉn−1∣≥0.1)P(\lvert \bar{X}_n - 1 \rvert \ge 0.1) stays 0.90.9 however large nn is, while in the IID model it is at most 100/(3n)100/(3n).

Check yourself

  1. Observations are IID Uniform⁡(−1,3)\operatorname{Uniform}(-1, 3). Use the Chebyshev bound to find a sample size that makes P(∣Xˉn−μ∣≥0.2)P(\lvert \bar{X}_n - \mu \rvert \ge 0.2) at most 0.10.1.
Show the answer

The mean is the midpoint, μ=1\mu = 1. The support has width 44, so σ2=16/12=43\sigma^2 = 16/12 = \tfrac43, which is finite. With ε2=0.04\varepsilon^2 = 0.04 the bound is

4/30.04 n=1003n.\frac{4/3}{0.04\,n} = \frac{100}{3n}.

Requiring 100/(3n)≤0.1100/(3n) \le 0.1 gives n≥1000/3≈333.33n \ge 1000/3 \approx 333.33, so n=334n = 334 suffices, with bound 100/1002≈0.0998100/1002 \approx 0.0998. This sample size is sufficient for the bound. It does not show that fewer observations would fail.

  1. Waiting times in minutes are IID Exp⁡(0.5)\operatorname{Exp}(0.5). Find the sample size the Chebyshev bound requires to make P(∣Xˉn−2∣≥0.1)P(\lvert \bar{X}_n - 2 \rvert \ge 0.1) at most 0.050.05, and compare it with the 667667 uniform readings found above. Does the answer show that 7,9997{,}999 waits are too few?
Show the answer

With rate 0.50.5 the mean is 1/0.5=21/0.5 = 2 and the variance is 1/0.52=41/0.5^2 = 4. The bound is 4/(0.01 n)=400/n4/(0.01\,n) = 400/n, and 400/n≤0.05400/n \le 0.05 gives n≥8000n \ge 8000. The variance 44 is twelve times the uniform variance 13\tfrac13, so at the same tolerance and target the threshold for nn grows by the same factor, from 2000/32000/3 to 12⋅2000/3=800012 \cdot 2000/3 = 8000. The answer does not show that 7,9997{,}999 waits are too few. A conservative bound gives a sufficient sample size only. In fact, the exact distribution of a sum of independent exponential waits shows that 1,5371{,}537 waits already give a miss probability below 0.050.05.

  1. A technician records one Uniform⁡(0,2)\operatorname{Uniform}(0, 2) reading ZZ and enters it 10001000 times as X1,…,X1000X_1, \dots, X_{1000}. Applying σ2/(nε2)\sigma^2/(n\varepsilon^2) with ε=0.1\varepsilon = 0.1, the technician concludes that the average misses 11 by at least 0.10.1 with probability at most 130\tfrac{1}{30}. Find the actual probability and name the assumption that fails.
Show the answer

The average equals ZZ, so the miss probability is P(∣Z−1∣≥0.1)=1−0.2/2=0.9P(\lvert Z - 1 \rvert \ge 0.1) = 1 - 0.2/2 = 0.9, far above 130\tfrac{1}{30}. Independence fails. The entries are identically distributed, but every covariance equals Var⁡(Z)=13\operatorname{Var}(Z) = \tfrac13, so Var⁡(Xˉ1000)=13\operatorname{Var}(\bar{X}_{1000}) = \tfrac13, not 13000\tfrac{1}{3000}. Chebyshev’s inequality applied correctly to Xˉ1000=Z\bar{X}_{1000} = Z gives 1/30.01≈33.3\tfrac{1/3}{0.01} \approx 33.3, which is above 11 and says nothing, consistent with the true value 0.90.9.

How this lesson connects