# Margin of Error of Sample Variance

For $N$ samples of normally distributed data $X_i \sim \mathcal{N}(\mu,\sigma^2)$, the $1-\alpha$ confidence interval for the sample mean $\bar{X}$ is $$\left[\bar{X} - z_{\alpha/2}\frac{\sigma}{\sqrt{N}}, \bar{X} + z_{\alpha/2}\frac{\sigma}{\sqrt{N}}\right],$$ where $z_{\alpha/2}$ is the $(1-\alpha/2)$ quantile for the standard normal distribution. In particular, it is clear the length of the confidence interval decreases at the rate $N^{-1/2}$, and so the accuracy of the sample mean increases as the sample size increases.

On the other hand, let $a$ be the $\alpha/2$ quantile and $b$ the $1 - \alpha/2$ quantile for the chi-squared distribution with $N-1$ d.o.f. Then the $1 - \alpha$ confidence interval for the sample variance $S^2$ is $$\left[\frac{(N-1)S^2}{b},\frac{(N-1)S^2}{a}\right].$$ It is not obvious to me that this interval's length decreases with increasing $N$, as I would expect it to. Only through simulation was I able to verify it does so empirically (here I set $\sigma = 0.15$):

I'd really like to be able to show something like, "for N > 1000, the margin of error for $S^2$ is ___", but

1. I don't see how margin of error is easily extracted for the sample variance, as it is for sample mean, and
2. I'm not sure how to show the decrease in interval length analytically.

Any thoughts are appreciated.

• +1 Interesting question. It might help the intuition to know that $a$ and $b$ are asymptotically linear in $N$. – whuber Aug 5 '15 at 16:38
• @whuber Yes, that must be the case. Do you know of a reference that demonstrates this? – bcf Aug 5 '15 at 16:42
• Terminology: $z_{\alpha/2}$ is a quantile of the distribution, not a p-value. – Christoph Hanck Aug 5 '15 at 17:14
• It would certainly be in Johnson & Kotz. But when you understand $\chi^2(n)$ to be the distribution of the sum of $n$ iid standard Normals, it should be intuitively obvious that the quantiles are proportional to $n$. I believe you could easily prove this in many ways, such as by applying Chebyshev's Inequality. – whuber Aug 5 '15 at 17:23
• Chebyshev implies that for $z\gt 1$, the $1-1/z^2$ quantile of any distribution of mean $\mu$ and standard deviation $\sigma$ cannot exceed $\mu+z\sigma$ and the $1/z^2$ quantile cannot be less than $\mu-z\sigma$. Basic properties of the standard Normal distribution imply the mean of a $\chi^2(n)$ distribution is $n$ and its standard deviation is $\sqrt{2n}$. Therefore any fixed quantile of $\chi_2(n)$ lies within an interval whose endpoints scale (at worst) like $O(n)\pm O(\sqrt{n})$. – whuber Aug 5 '15 at 20:49

If you reparameterize in terms of:

$$\sqrt{n} \left( \left[\begin{array}{c} \bar{X} \\ S_n^2 \end{array}\right] - \left[\begin{array}{c} \mu \\ \sigma^2 \end{array}\right] \right) \rightarrow_d \mathcal{N} \left( \left[ \begin{array}{c} 0 \\ 0 \end{array} \right] , \left[ \begin{array}{cc} \sigma^2 & 0 \\ 0 & 2\sigma^4 \end{array} \right] \right)$$

you would get an asymptotic distribution that's more efficient... since this gives CIs that do approach 0. That's just not possible :)

For $X$ distributed as you say, $r_i^2 = (X_i - \mu)^2 \sim \chi^2_1$ and $\sum_{i=1}^n r_i^2 \sim \chi^2_{n}$ with 95% exact bounds: $F_{\chi^2_{N}}(\alpha/2), 1-F_{\chi^2_{N}}(\alpha/2)$. Now, I haven't handled the issue of the plug in $\bar{X}$ estimator, but we can get some intuition by ignoring it for now. We should at least verify at this point that the upper bound quantile is less than $\mathcal{O}(N)$.

Chernoff bounds have been derived in terms of the quantile function, and a similar method may derive the percentile function... but I haven't done so.

You can frame this problem more simply by looking at the inverse gamma distribution:

$$W_n \equiv \frac{n}{\chi_n^2} \sim \text{Inverse-Gamma}(\tfrac{n}{2},\tfrac{n}{2}).$$

This distribution has mean $$\mathbb{E}(W_n) = n/(n-2)$$ and variance $$\mathbb{V}(W_n) = 2 n^2/(n-2)^2 (n-4)$$ so you have $$\mathbb{E}(W_n) \rightarrow 1$$ and $$\mathbb{V}(W_n) \rightarrow 0$$, which means that $$W_n$$ converges in probability to unity (i.e., the distribution becomes tighter and tighter around one as $$n \rightarrow \infty$$). Using standard notation for the critical points of this distribution you can write your confidence interval for the variance as:

$$\text{CI}(1-\alpha) = \Big[ W_{\alpha/2, n-1} \cdot S^2, W_{1-\alpha/2, n-1} \cdot S^2 \Big].$$

Thus, you can write the length of the interval as:

$$|\text{CI}(1-\alpha)| = S^2 \cdot L_\alpha(n) \quad \quad \quad L_\alpha(n) \equiv W_{1-\alpha/2, n-1}-W_{\alpha/2, n-1}.$$

The function $$L_\alpha$$ is the object you want to examine if you are interested in looking at the width of the confidence interval analytically. This function is related directly to the quantile function for the inverse gamma distribution. For any fixed $$0 <\alpha < 1$$ you can examine how this function changes with $$n$$. It should be possible to show that this function is a decreasing function (i.e., the confidence interval gets more accurate as $$n$$ increases) and to show that $$L_\alpha(n) \rightarrow 0$$. I imagine it would be possible to prove this by establishing appropriate bounds on the quantile function and then using the squeeze theorem.

• As a possible simplification $n \cdot \text{Inverse-Gamma}(\tfrac{n}{2},\tfrac{1}{2})$ would be distributed as $\text{Inverse-Gamma}(\tfrac{n}{2},\tfrac{n}{2})$. – COOLSerdash Aug 16 at 12:05
• @COOLSerdash: Well-spotted - edited. – Reinstate Monica Aug 16 at 12:17