2
$\begingroup$

So this is probably really simple to anyone who's actually taken stats. I want to generate a number of sets of random numbers from 0 to 1, then find the standard deviations of the means.

I'm trying to find out if its worth computing the mean of a set of randoms or to just assume constant value since the SD would be too insignificant.

edit: i know i can simulate it but I'd really rather see the math behind it

$\endgroup$
3
  • 1
    $\begingroup$ @anon They are psuedorandom but literally made to be a representation of randomness. So it doesn't really change the answer. $\endgroup$ Oct 9, 2016 at 2:18
  • $\begingroup$ @user2958456 Random.org has a decimal number generator. Conveniently, the maximum amount of numbers it can generate is 10,000. The maximum decimal places it can do is 20. Here's the link: random.org/decimal-fractions/… $\endgroup$
    – esote
    Oct 9, 2016 at 2:22
  • $\begingroup$ @Anonymous yes ok thank you but I don't care for a simulation I can do that in MATLAB already. I want to know how to apply CLT and find the answer analytically $\endgroup$ Oct 9, 2016 at 2:26

3 Answers 3

2
$\begingroup$

You can compute the variance of a single random number as it is drawn from a uniform distribution on $(0,1)$. Then the variance of the sum is the sum of the variances, which is just multiplying the variance by the number of samples. The variance of the mean decreases as the inverse of the number of samples.

$\endgroup$
1
$\begingroup$

If you are generating $n$ numbers between 0 and 1, you can express this as $U_1 , \ldots, U_n$ where each $U_i$ is a Uniform(0, 1) random variable.

In any given sample, the sample mean is $\bar{U} = \frac{\sum_{i=1}^n U_i}{n}$. So the expected value of the sample mean is just the mean (use the linearity of expectation to work it out).

Since the $U_i$ are independent the variance (not SD!) is linear as well. So you have

$Var(\bar{U}) = \frac{1}{n^2} \sum_{i=1}^n Var(U_i)$

The variance of a single Uniform(0,1) is... I could post the answer here, but it's good if you look it up or work it out! After you have the variance, take the square root and that's your standard deviation of the sample means. Next, try some simulations to see that it's right!

$\endgroup$
2
  • 1
    $\begingroup$ I am a sad programmer who has been trying to understand this topic just well enough to solve a problem, who does not have the mental energy to try to compute the answer, and is thus displeased by your ending paragraph. :( $\endgroup$
    – Venryx
    Dec 25, 2018 at 23:31
  • $\begingroup$ It's 1/n for Var(U) not 1 / n^2. $\endgroup$
    – alian
    Aug 10, 2021 at 0:39
0
$\begingroup$

For anyone who wants the more general answer rather than n=10000, I found the variance equation for a continuous uniform distribution on Wikipedia:

$$Var(U(a,b)) = \frac{1}{12}(b-a)^2$$

For U(0,1) that works out to 1/12. Standard deviation is simply the square root of that.

$$\sqrt{\frac{1}{12}} \approx 0.2886751346$$

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .