# Standard Deviation of Averages of Random Numbers

Suppose we have an unending source of random numbers from the interval [0,1] coming from the uniform distribution. Think of each number as the result of an experiment.

Fix a value $s$ (say, $s=100$).

We are going to create a random function $f_s(t)$ for $t \in \mathbb{N}$ from this sequence of random numbers.

We do the following. We take the average of $t$ of the random numbers. This should be approximately $0.5$, since the numbers are uniformly distributed. Next, we do the same thing $s$ times, collecting the $s$ averages. We end up with $s$ numbers, all of which are fairly close to $0.5$.

Now, one would expect that the averages would all be closer to $0.5$ the higher the value of $t$. Thus we set $f_s(t)$ to be the standard deviation of these $s$ values.

Next we let $s$ go to infinity, or at least, be reasonably large, to get the function $f(t)$. We can use the following MATLAB code to graph the function:

function w=randstd(trials,s)

for n=[1:trials] for r=[1:s] z(r,1)=mean(rand(n,1)); end w(n,1)=std(z); end plot(w)

The result appears to be a fairly smooth curve, even as I try many times. My questions are:

1) What is the curve? Is it polynomial, logarithmic, or exponential? 2) Is there a mathematical explanation for this? Should we expect the curve to look like this for general random sets? 3) If not, is the curve I've graphed simply a result of the nature of whatever pseudorandom number generator MATLAB is using? If so, is the curve I've graphed at least the result of some mathematically quantifiable property of that pseudorandom number generator?

I understand there might not be a rigorous mathematical answer to this question, but I'm asking because there might be.

-
Let $X_i \sim U[0,1]$, so $Var(X_i)=1/12$. If $Y_t = \frac{1}{t} \sum_{i=1}^t X_i$ you have $Var(Y_t) = \frac{1}{12t}$, and $f(t) = \sqrt{Var(Y_t)} = \frac{1}{2\sqrt{3t}}$ –  Or Zuk May 31 '11 at 18:52
Is there something here that I missed beyond routinely citing the central limit theorem? –  Michael Hardy Jun 1 '11 at 16:39
Let $Y$ the be mean of $t$ samples of the distribution. $Y$ has mean $1/2$ and variance $1/(12 t)$. Then $f_s(t)$ is the sample standard deviation of $s$ draws from $Y$. As the sample standard deviation is a consistent estimator, $f_s(t)$ converges in probability to $\sqrt{1/(12 t)}$.
I'm selecting this answer because, after graphing $\sqrt{\frac{1}{12t}}$, it appears very close to the answer! –  David Corwin May 31 '11 at 19:25
Your means will be approximately normally distributed for large t, so to the first order you will be sampling $s$ values from a normal distribution with the appropriate parameters, which you can compute in your copious spare time (or look up the precise statement of the Central Limit Theorem in Feller's book). For the case of uniform deviates from $(0, 1),$ where the moments are all bounded, the Berry-Esseen theorem gives you convergence speed bounds, which are believe are essentially sharp in this case. For Berry-Esseen, again, Feller vol II is an excellent reference.