What are the minimum and maximum values of variance? [closed]

I am new to statistics. I am getting my hands dirty on VarianceThreshold. I am having a single dimensional array, containing N values. What’s the maximum and minimum values of a variance for any values present in array?

I guess the minimum value will always be non-negative but I don’t know about the maximum value. I have googled it but couldn’t find a good answer.

Answer

I interpret this question as asking

Given a set of $N$ numbers $x_1, x_2, \ldots,x_N$, what is the minimum and maximum values that the variance $V$, defined as
$$V = \frac 1N \sum_{k=1}^N (x_k-\bar{x})^2 ~~ \text{where}~\bar{x}=\frac 1N \sum_{k=1}^N x_k$$ can take on?

Well, the minimum value of $V$ is $0$ as Daniel Lopez’s comment points out, and it occurs if and only if all the $N$ numbers have the same value. At the other end, every finite set of real numbers has a (finite) upper bound (call it $b$) and a (finite) lower bound (call it $a$), and
$$V \leq \frac{(b-a)^2}{4} = \left(\frac{b-a}{2}\right)^2 = \left(\frac{\mathcal R}{2}\right)^2\tag{1}$$ where $\mathcal R$ is the range of the set of $N$ numbers. Note that it is not necessary to know the values of $b$ and $a$ separately; we only need the range $\mathcal R = (b-a)$ to calculate the upper bound $(1)$ on $V$.

If $N$ is an even number, there exist sets for which the bound $(1)$ holds with equality: these are sets for which $\frac N2$ of the $x_k$ have value $b$ and the other $\frac N2$ have value $a$. For odd $N$, the bound $\frac{(b-a)^2}{4}$ still applies but cannot be attained with equality if $N>1$. For odd $N>1$, the maximum value is $\frac{(b-a)^2}{4}\frac{N^2-1}{N^2}$ and is attained by a set in which $\frac{N-1}{2}$ of the $x_k$ have value $b$, $\frac{N+1}{2}$ have value $a$, or vice versa. For details, see this answer of mine on math.SE.

In another answer (and the comments on it), @Jim has argued that “A set of $N$ real numbers” tells the listener nothing whatsoever about the set if you don’t know what any of the values are, even the minimum or maximum, and so the only completely correct answer is that maximum possible $V$ is unbounded: any other answer (such as mine above or a couple of possible answers suggested by Jim) must be be festooned with caveats that the answer is based on assumptions might be unwarranted. I disagree. Even if a secretive questioner is unwilling to share any details about the set he/she is concerned about, my answer gives the questioner enough information to find the maximum possible value of $V$ for him/herself from very minimal information abut the set: just the range suffices, no need to know even what $N$ is!

EDIT: (by AHK) Corrected the maximum variance for odd $N>1$ and the corresponding choice of $x_i$‘s

Attribution
Source : Link , Question Author : Mangu Singh Rajpurohit , Answer Author : blooraven

Leave a Comment