Suppose that a random variable has a lower and an upper bound [0,1]. How to compute the variance of such a variable?

# Solved – Variance of a bounded random variable

measurement errorstandard deviationvariance

#### Related Solutions

The lower bound will occur when $B = -A$ so that $A + B = 0$ and the variance is $0$. This also occurs when $B$ is shifted from $A$, but in any case you cannot have a variance less than $0$ and this shows a case where it can equal $0$.

The upper bound comes when $B = A$ or $B = c1 + c2 \times A$ which gives a correlation of $1$. In this case you get the variance is the comments above.

The general asymptotic result for the asymptotic distribution of the sample variance is (see this post)

$$\sqrt n(\hat v - v) \xrightarrow{d} N\left(0,\mu_4 - v^2\right)$$

where here, I have used the notation $v\equiv \sigma^2$ to avoid later confusion with squares, and where $\mu_4 = \mathrm{E}\left((X_i -\mu)^4\right)$. Therefore by the continuous mapping theorem

$$\frac {n(\hat v - v)^2}{\mu_4 - v^2} \xrightarrow{d} \chi^2_1 $$

Then, accepting the approximation,

$$P\left(\frac {n(\hat v - v)^2}{\mu_4 - v^2}\leq \chi^2_{1,1-a}\right)=1-a$$

The term in the parenthesis will give us a quadratic equation in $v$ that will include the unknown term $\mu_4$. Accepting a further approximation, we can estimate this from the sample. Then we will obtain

$$P\left(Av^2 + Bv +\Gamma\leq 0 \right)=1-a$$

The roots of the polynomial are

$$v^*_{1,2}= \frac {-B \pm \sqrt {B^2 -4A\Gamma}}{2A}$$

and our $1-a$ confidence interval for the population variance will be

$$\max\Big\{0,\min\{v^*_{1,2}\}\Big\}\leq \sigma^2 \leq \max\{v^*_{1,2}\}$$

since the probability that the quadratic polynomial is smaller than zero, equals (in our case, where $A>0$) the probability that the population variance lies in between the roots of the polynomial.

## Monte Carlo Study

For clarity, denote $\chi^2_{1,1-a}\equiv z$.

A little algebra gives us that

$$A = n+z, \;\;\ B = -2n\hat v,\;\; \Gamma = n\hat v^2 -z \hat \mu_4$$

which leads to

$$v^*_{1,2}= \frac {n\hat v \pm \sqrt {nz(\hat \mu_4-\hat v^2)+z^2\hat \mu_4}}{n+z}$$

For $a=0.05$ we have $\chi^2_{1,1-a}\equiv z = 3.84$

I generated $10,000$ samples each of size $n=100$ from a Gamma distribution with shape parameter $k=3$ and scale parameter $\theta = 2$. The true mean is $\mu = 6$, and the true variance is $v=\sigma^2 =12$.

**Results:**

The sample distribution of the sample variance had a long road ahead to become normal, but this is to be expected for the small sample size chosen. Its average value though was $11.88$, pretty close to the true value.

The estimation bound was smaller than the true variance, in $1,456$ samples, while the lower bound was greater than the true variance only $17$ times. So the true value was missed by the $CI$ in $14.73$% of the samples, mostly due to undershooting, giving a confidence level of $85$%, which is a $~10$ percentage points worsening from the nominal confidence level of $95$%.

On average the lower bound was $7.20$, while on average the upper bound was $15.68$. The average length of the CI was $8.47$. Its minimum length was $2.56$ while its maximum length was $34.52$.

## Best Answer

You can prove Popoviciu's inequality as follows. Use the notation $m=\inf X$ and $M=\sup X$. Define a function $g$ by $$ g(t)=\mathbb{E}\left[\left(X-t\right)^2\right] \, . $$ Computing the derivative $g'$, and solving $$ g'(t) = -2\mathbb{E}[X] +2t=0 \, , $$ we find that $g$ achieves its minimum at $t=\mathbb{E}[X]$ (note that $g''>0$).

Now, consider the value of the function $g$ at the special point $t=\frac{M+m}{2}$. It must be the case that $$ \mathbb{Var}[X]=g(\mathbb{E}[X])\leq g\left(\frac{M+m}{2}\right) \, . $$ But $$ g\left(\frac{M+m}{2}\right) = \mathbb{E}\left[\left(X - \frac{M+m}{2}\right)^2 \right] = \frac{1}{4}\mathbb{E}\left[\left((X-m) + (X-M)\right)^2 \right] \, . $$ Since $X-m\geq 0$ and $X-M\leq 0$, we have $$ \left((X-m)+(X-M)\right)^2\leq\left((X-m)-(X-M)\right)^2=\left(M-m\right)^2 \, , $$ implying that $$ \frac{1}{4}\mathbb{E}\left[\left((X-m) + (X-M)\right)^2 \right] \leq \frac{1}{4}\mathbb{E}\left[\left((X-m) - (X-M)\right)^2 \right] = \frac{(M-m)^2}{4} \, . $$ Therefore, we proved Popoviciu's inequality $$ \mathbb{Var}[X]\leq \frac{(M-m)^2}{4} \, . $$