Adding Random Numbers
If RAND() returns a number less than 0.00034, your formula
will return a negative number, and if RAND() returns a number greater
than 0.99966, your formula will return a number greater than 23. Up to
the OP to decide whether this is OK or not.
Hi. I may be wrong, but I think you used a Standard Deviation of Sqrt(23/2) instead of Sqrt(23/12).
It's easier for me to test this with another program.
equ = InverseCDF[NormalDistribution[23/2, Sqrt[23/2]], x];
At machine precision, we get the two solutions you mention...
NSolve[equ == 0, x]
{x - 0.000347981}
NSolve[equ == 23, x]
{x - 0.999652}
If we do 1-million sums of 23 Random numbers(0-1), the Standard Deviation on this test data is 1.38..
m = Tr /@ RandomReal[1, {1000000, 23}];
{Min[m], Mean[m], Max[m], StandardDeviation[m]}
{4.68429, 11.5014, 18.0794, 1.38515}
Which checks with joeu2004's solution:
Sqrt[23/12.]
1.38444
And what we would expect...
Sqrt[23.] (UniformDistribution[{0, 1}] // StandardDeviation)
1.38444
--
HTH :)
Dana DeLouis
"Harlan Grove" wrote in message ...
joeu2004 wrote...
...
=norminv(rand(), 23/2, sqrt(23/12))
...
According to the CLT, the sum is a normal distribution regardless of
the distribution of the individual random variables being summed. The
distribution of the sum has a mean of N*m and a std dev of sqrt(N)*s,
where N is the number of random variables summed, and "m" and "s" are
the mean and std dev of each of the N random variables.
...
Not quite. The sum of iid random variables is ASYMPTOTICALLY normal.
Meaning, the distribution of the sum of N iid random variables becomes
normal as N approaches infinity. For smallish values of N, the normal
distribution is a rough approximation of the actual distribution of
the sum.
Also, the normal distribution with mean 23/2 and standard deviation
23/2 has a finite probability of NEGATIVE values and values GREATER
THAN 23. If RAND() returns a number less than 0.00034, your formula
will return a negative number, and if RAND() returns a number greater
than 0.99966, your formula will return a number greater than 23. Up to
the OP to decide whether this is OK or not.
|