[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: random numbers

**From**: |
john |

**Subject**: |
Re: random numbers |

**Date**: |
Tue, 16 Feb 1999 21:24:43 +0000 (GMT) |

Selectively quoted and editted, On Mon, 15 Feb 1999, G. Brger wrote:
>* ... is it reasonable that for 2 independant random series, *
>* generated with*
>* *
>* e=normal_rnd(my_mean, my_var, 100000, 2);*
>* *
>* then cor(e(:,1),e(:,2)) has the order of 1e-3?*
Yes. Because doing
e=normal_rnd(my_mean, my_var, n, 2);
u = cor(e(:,1), e(:,2))
could be viewed as an unusual way to calculate a random number u with
mean nearly zero, variance roughly 1/n. So we expect u to lie within
about 3 standard deveations (3/sqrt(n)) of zero. For the n=100000 in the
question, we expect numbers in the range 10e-3 to -10e-3.
The underlying reason is that evaluating cor(e1,e2) involves averaging
the product of pairs of independant random numbers, mean 0 variance 1.
Each of the products gives a random number with mean 0 variance 1.
The average then has mean 0, variance 1/n. (Don't quote me - there
is some detail missing).
Further numerical evidence could come from a bit of octave code like:
mu = 200 ; ## choose some numbers
sigma = 142 ;
n = 100 ; ## length of each random sequence
m = 500 ; ## number of correlation coefficients to calculate
t = zeros(1,m) ;
for r=1:m
e = normal_rnd( mu, sigma, n, 2 ) ;
e1 = e(:,1) ;
e2 = e(:,2) ;
t(r) = cor( e1, e2 ) ;
endfor
printf("mean of correlation coefficients is %f\n", mean(t)) ;
printf("var of correlation coefficients is %f\n", var(t)) ;
printf("reciprical of n is %f\n", 1.0/n ) ;
which for me gives values
mean of correlation coefficients is 0.000501 <- nearly zero
var of correlation coefficients is 0.010560 <- nearly 1/n
reciprical of n is 0.010000
John.