Tutorials › Stochastic Processes › Quantitative Weak-Law Calculations for Sample Means

Convergence of Random Variables · Tutorial 57 of 994

Quantitative Weak-Law Calculations for Sample Means

Use variance and distributional information to calculate how many observations are needed to control the probability that a sample mean deviates from its target.

Intermediate 10 min read

What You'll Learn

  • Derive a deviation-probability bound for an independent sample mean with finite variance.
  • Convert a target error tolerance and probability level into a positive integer sample size.
  • Calculate Bernoulli deviation probabilities while respecting strict event boundaries.
  • Bound the variance of observations known to lie in a fixed interval.
  • Compare variance-based guarantees with exact Gaussian sample-mean probabilities.

From a Weak Law to a Sample-Size Calculation

A weak law says that a sample mean gets close to its target in probability as the sample size increases. In applications, the next question is quantitative: how large must the sample be to make a specified error probability small enough? A variance calculation gives a direct, generally conservative answer. When the sampling distribution is known, as for Gaussian observations, we can also calculate the deviation probability more exactly.

Work on a probability space \((\Omega,\mathcal{F},\mathbb{P})\). Let \(X_1,X_2,\ldots\) be independent and identically distributed random variables with mean \(\mu=\mathbb{E}[X_1]\) and finite variance \(\sigma^2=\operatorname{Var}(X_1)\). The sample mean based on \(n\) observations is \(\overline{X}_n=n^{-1}\sum_{i=1}^nX_i\). We will ask for the probability that its absolute error exceeds a tolerance \(\varepsilon>0\), and compare that probability with a target \(\alpha\), where \(0<\alpha<1\).

Quantitative weak-law bound: Under the independence and finite-variance assumptions above, for every positive integer \(n\) and every \(\varepsilon>0\), \(\mathbb{P}(|\overline{X}_n-\mu|>\varepsilon)\le \sigma^2/(n\varepsilon^2)\). Consequently, the smallest positive integer sample size for which this bound is at most \(\alpha\) is \(\max\{1,\lceil\sigma^2/(\alpha\varepsilon^2)\rceil\}\).

Proof. Independence gives \(\operatorname{Var}(\overline{X}_n)=n^{-2}\sum_{i=1}^n\operatorname{Var}(X_i)=\sigma^2/n\). For any random variable \(Y\) with finite variance and any \(\varepsilon>0\), apply Markov's inequality to the nonnegative variable \((Y-\mathbb{E}Y)^2\): the event \(\{|Y-\mathbb{E}Y|>\varepsilon\}\) is contained in \(\{(Y-\mathbb{E}Y)^2\ge\varepsilon^2\}\), so its probability is at most \(\mathbb{E}[(Y-\mathbb{E}Y)^2]/\varepsilon^2=\operatorname{Var}(Y)/\varepsilon^2\). Taking \(Y=\overline{X}_n\) proves the bound. To make the bound at most \(\alpha\), it suffices and is necessary for this bound that \(n\ge\sigma^2/(\alpha\varepsilon^2)\). If the ratio is positive, the smallest positive integer satisfying this inequality is its ceiling. If \(\sigma^2=0\), the ratio is zero and every positive integer satisfies the inequality; the smallest permitted sample size is then \(1\). These cases give the stated maximum. \(\square\)

In particular, with \(\sigma^2\) finite and fixed, the bound tends to zero as \(n\) increases. This proves convergence in probability of \(\overline{X}_n\) to \(\mu\), the weak law in this setting. For a design calculation, however, the useful step is to insert the desired \(\varepsilon\) and \(\alpha\) into the formula. The resulting sample size guarantees the requested probability by this variance bound; it need not be the smallest sample size that would work according to the true probability.

Bernoulli Sample Means

If \(X_i\) is Bernoulli with success probability \(p\), then \(X_i\) equals \(1\) with probability \(p\) and \(0\) with probability \(1-p\). Its mean is \(p\), and its variance is \(p(1-p)\). The sample mean \(\overline{X}_n\) is the observed success proportion. The variance bound is therefore \(\mathbb{P}(|\overline{X}_n-p|>\varepsilon)\le p(1-p)/(n\varepsilon^2)\). This uses the actual value of \(p\); if it is unknown, a conservative bound can use \(p(1-p)\le1/4\), which follows from \((p-\tfrac12)^2\ge0\).

Worked Example: A Bernoulli Sample-Size Guarantee

Suppose \(p=\tfrac3{10}\), and the goal is to make the probability of an error exceeding \(\varepsilon=\tfrac1{10}\) at most \(\alpha=\tfrac1{20}\). First calculate the variance: \(p(1-p)=\tfrac3{10}\cdot\tfrac7{10}=\tfrac{21}{100}\). The denominator in the sample-size ratio is \(\alpha\varepsilon^2=\tfrac1{20}\cdot\tfrac1{100}=\tfrac1{2000}\). Thus

$$ \frac{\sigma^2}{\alpha\varepsilon^2} =\frac{21/100}{1/2000} =\frac{21}{100}\cdot 2000 =420. $$

The bound therefore guarantees the target for every \(n\ge420\), and its smallest positive-integer sample size is \(420\). Substitution checks the guarantee at that value: \(\tfrac{21}{100}/(420\cdot\tfrac1{100})=\tfrac{21}{420}=\tfrac1{20}\). For any smaller positive integer, the displayed variance bound is larger than \(\tfrac1{20}\), so this particular bound does not certify the target.

For Bernoulli data, the exact probability can also be found by counting successes. If \(K_n=\sum_{i=1}^nX_i\), independence gives \(\mathbb{P}(K_n=k)=\binom{n}{k}p^k(1-p)^{n-k}\) for \(k=0,\ldots,n\). Since \(\overline{X}_n=K_n/n\), the strict deviation event uses the integer values \(k\) satisfying \(|k/n-p|>\varepsilon\). The strict inequality matters: a value exactly on the tolerance boundary is not included.

Worked Example: An Exact Bernoulli Deviation Probability

Let \(X_i\) be independent Bernoulli variables with \(p=\tfrac12\), and take \(n=4\) and \(\varepsilon=\tfrac14\). The event is \(|K_4/4-\tfrac12|>\tfrac14\). For \(k=0\), the deviation is \(|0-\tfrac12|=\tfrac12>\tfrac14\); for \(k=1\), it is \(|\tfrac14-\tfrac12|=\tfrac14\), which is not strictly greater. For \(k=2\), it is \(0\); for \(k=3\), it is \(\tfrac14\), also excluded; and for \(k=4\), it is \(\tfrac12>\tfrac14\). Thus only \(k=0\) and \(k=4\) count.

Each of these endpoint outcomes has probability \((\tfrac12)^4=\tfrac1{16}\), so the exact deviation probability is \(\tfrac1{16}+\tfrac1{16}=\tfrac18\). As a check, the variance bound is \((\tfrac14)/(4\cdot\tfrac1{16})=1\), which is valid but much larger than the exact probability \(\tfrac18\). If the event had instead been defined with \(\ge\tfrac14\), then \(k=1\) and \(k=3\) would also count; each has probability \(\binom41/16=4/16\), so that probability would be \((1+4+4+1)/16=10/16=\tfrac58\).

Bounded Observations

Sometimes the variance is not known, but the observations are known to lie in a fixed interval. A variance bound then converts the range information into a sample-size guarantee. The following inequality is useful because it is valid for any distribution supported on the interval, not only a uniform distribution.

Variance bound for a bounded variable: If \(a\le X\le b\) almost surely, where \(a\le b\) are finite constants, then \(\operatorname{Var}(X)\le(b-a)^2/4\).

Proof. If \(a=b\), then \(X=a\) almost surely and its variance is zero, so the inequality holds. Suppose \(a<b\), and write \(m=\mathbb{E}[X]\), which lies in \([a,b]\). Since \((X-a)(b-X)\ge0\) almost surely, taking expectations and expanding gives \(\mathbb{E}[X^2]\le(a+b)m-ab\). Consequently, \(\operatorname{Var}(X)=\mathbb{E}[X^2]-m^2\le(a+b)m-ab-m^2=(m-a)(b-m)\). The two nonnegative factors on the right sum to \(b-a\). For any nonnegative \(u,v\) with \(u+v=b-a\), \((u-v)^2\ge0\) implies \(4uv\le(u+v)^2=(b-a)^2\). Apply this with \(u=m-a\) and \(v=b-m\) to obtain \((m-a)(b-m)\le(b-a)^2/4\). This proves the claim. \(\square\)

If independent, identically distributed observations lie in \([a,b]\), use \((b-a)^2/4\) in place of \(\sigma^2\) in the sample-size formula. If their actual variance is known, using it can give a smaller guarantee. The range bound applies to more general independent observations as well when they share a common mean and each has variance at most a known common bound: the variance of their average is then at most that bound divided by \(n\).

Worked Example: Comparing a Range Bound with the Actual Variance

Let \(X_i\) be independent and uniform on \([0,2]\), and require \(\mathbb{P}(|\overline{X}_n-1|>\tfrac15)\le\tfrac1{20}\). The range width is \(2-0=2\), so the bounded-variable result gives \(\sigma^2\le2^2/4=1\). The range-based sample-size ratio is \(1/((\tfrac1{20})(\tfrac1{25}))=1/(\tfrac1{500})=500\). Thus \(n=500\) suffices by the range bound.

For this uniform distribution, the actual variance is \((2-0)^2/12=1/3\). Using it gives the ratio \((\tfrac13)/(\tfrac1{500})=\tfrac{500}{3}\), whose ceiling is \(167\). Check the bound at \(n=167\): \((1/3)/(167/25)=25/501\), and \(25/501<1/20\) because \(500<501\). At \(n=166\), the bound is \(25/498\), which is greater than \(1/20\) because \(500>498\). Thus \(167\) is the smallest positive integer certified by the actual-variance bound, while \(500\) is certified using only the range. Neither statement asserts that these are the smallest sample sizes for the true deviation probability.

Gaussian Sample Means

For Gaussian observations, the sample mean has a known distribution, allowing an exact probability calculation in terms of the standard normal cumulative distribution function \(\Phi(x)=\mathbb{P}(Z\le x)\), where \(Z\) has the standard normal distribution. If the independent observations have distribution \(N(\mu,\sigma^2)\) with \(\sigma>0\), then \(\overline{X}_n\) has distribution \(N(\mu,\sigma^2/n)\). One way to verify this is to use the Gaussian characteristic function: for one observation it is \(\exp(i\mu t-\sigma^2t^2/2)\); independence makes the characteristic function of the sum the product of the \(n\) characteristic functions, \(\exp(in\mu t-n\sigma^2t^2/2)\). Rescaling the sum by \(1/n\) gives the characteristic function \(\exp(i\mu t-\sigma^2t^2/(2n))\), that of \(N(\mu,\sigma^2/n)\). The uniqueness of characteristic functions identifies the distribution.

It follows that the exact two-sided probability is \(2\Phi(-\varepsilon\sqrt{n}/\sigma)\). To meet a target \(\alpha\), one may compare this quantity directly with \(\alpha\); the variance bound instead gives the sufficient condition \(n\ge\sigma^2/(\alpha\varepsilon^2)\). The exact calculation can be substantially sharper, but it requires Gaussian sampling assumptions and evaluation of a normal tail.

Worked Example: Exact Gaussian Probability and Its Variance Bound

Let \(X_i\) be independent with distribution \(N(2,9)\), and take \(n=36\) and \(\varepsilon=1\). The sample mean has mean \(2\) and variance \(9/36=1/4\), hence standard deviation \(\sqrt{1/4}=1/2\). Standardizing the deviation gives \((\overline{X}_{36}-2)/(1/2)\sim N(0,1)\). Therefore the event \(|\overline{X}_{36}-2|>1\) is the event \(|Z|>1/(1/2)=2\), and its exact probability is \(\mathbb{P}(Z<-2)+\mathbb{P}(Z>2)=2\Phi(-2)\), using the symmetry of the standard normal distribution.

The variance bound gives \((9/36)/1^2=1/4\). This is a valid upper bound on \(2\Phi(-2)\), not an exact probability. For a sample-size guarantee using only the variance bound with \(\alpha=\tfrac1{20}\) and \(\varepsilon=1\), the calculation is \(9/((\tfrac1{20})1^2)=180\). Substitution gives \(9/(180\cdot1)=\tfrac1{20}\), so \(n=180\) meets the target by Chebyshev's inequality.

What the Bound Does—and Does Not—Guarantee

The variance calculation depends on independence: it is what allows the variance of the sum to equal the sum of the variances. Identical distribution is a convenient way to ensure a common mean and variance, but the calculation also works for independent variables with a common mean and a suitable bound on their average variance. The bound does not promise that a particular observed sample mean will be within tolerance, nor does it generally identify the true minimum sample size. It gives a guaranteed upper bound on a probability and a sample size sufficient to make that upper bound no larger than the chosen target.

Common mistake. A frequent error is to treat the ceiling of the sample-size ratio as the answer even when the ratio is zero. For example, if \(X_i=\mu\) almost surely, then \(\sigma^2=0\), and \(\lceil\sigma^2/(\alpha\varepsilon^2)\rceil=0\). But the sample size is required to be a positive integer: no sample mean with \(n=0\) is defined. In this case every positive sample size has zero deviation probability, so the smallest allowed sample size is \(1\). The corrected general expression is \(\max\{1,\lceil\sigma^2/(\alpha\varepsilon^2)\rceil\}\).

Independence is not merely a technical detail. If \(Z\) is a single Bernoulli variable with success probability \(\tfrac12\), and every \(X_i\) is set equal to that same \(Z\), then each observation has variance \(\tfrac14\), but \(\overline{X}_n=Z\) for every \(n\). For \(\varepsilon=\tfrac14\), the deviation probability from the mean \(\tfrac12\) is \(1\) for all \(n\), not a quantity tending to zero. The independent-sample variance calculation cannot be applied to this dependent sequence.

Check Your Understanding

For each question, distinguish the probability bound from the exact probability, and keep the specified event inequality strict or non-strict.

  1. For independent Bernoulli observations with \(p=\tfrac14\), find the smallest sample size certified by the variance bound for \(\varepsilon=\tfrac18\) and \(\alpha=\tfrac1{10}\).
  2. If independent observations lie in \([1,5]\), what variance bound follows from their range, and what sample size does it certify for \(\varepsilon=\tfrac12\) and \(\alpha=\tfrac1{20}\)?
  3. For four fair Bernoulli observations, list the values of \(K_4\) included in the event \(|K_4/4-\tfrac12|\ge\tfrac14\), and calculate its probability.
  4. If independent observations have distribution \(N(0,4)\), express the exact probability \(\mathbb{P}(|\overline{X}_n|>1)\) using \(\Phi\).
  5. Explain why the sample-size expression must be at least \(1\) when the variance is zero.