I was doing some database work for a client, and I came across an oddity that I hoped someone could explain.
Take the sequence 0,0,0...,0,n (where n is any non-zero number), calculate the standard deviation (sample), and divide that by the average, and you always get the square root of the total number of samples.
e.g.(for 5 samples)
0,0,0,0,100 = 2.236067977
0,0,0,0,-0.21 = -2.236067977
(for 12 samples)
0,0,0,0,0,0,0,0,0,0,0,22 = 3.464101615
0,0,0,0,0,0,0,0,0,0,0,-0.1 = -3.464101615
Is there an obvious explanation for this?
The sample standard deviation divided by the average (the coefficient of variation, or abbreviated 'CV) can be denoted as:
$$CV = \frac{\sigma}{\mu}$$
or (with the sample standard deviation)
$$ CV= \frac{\sqrt{\frac{1}{n-1}\sum_{i=1}^n(x_i-\bar x)^2}}{\frac{1}{n}\sum_{i=1}^nx_i} $$
When all entries (n-entries) from the sequence are zero, except for one (let's call this entry $E$), we know that the average will be uniformly distributed over the sequence, so $$\mu= \frac{E}{n}$$
And then we can also write the $CV$ differently, as:
$$ CV= \frac{\sqrt{\frac{1}{n-1}\sum_{i=1}^{n-1}(\frac{E}{n})^2+(E-\frac{E}{n})^2}}{\frac{E}{n}} $$
or as
$$ CV= \frac{\sqrt{\frac{1}{n-1}\times[(n-1)(\frac{E}{n})^2+(E-\frac{E}{n})^2}]}{\frac{E}{n}} $$
easier to simplify, we take:
$$ CV= \frac{\sqrt{\frac{1}{n-1}\times[(n-1)(\frac{E}{n})^2+(E-\frac{E}{n})^2}]n}{E} $$
which simplifies to:
$$\frac{n\frac{E}{\sqrt{n}}}{E}$$ and leaves you $$\sqrt{n}$$