Home > database >  Generating random IID numbers with variance 1/n
Generating random IID numbers with variance 1/n

Time:05-29

Here is the spec :

A sufficient condition for correlation to decode convolution is that the elements of each vector (of dimension n) be independently and identically distributed with mean 0 and variance 1/n.

What I do is :

    stdev = np.sqrt(1/n) #var to std dev
    val = np.random.normal(loc=0,scale=stdev,size=n)

Are the generated numbers IID ?

Is variation => stdev logic correct ?

CodePudding user response:

Numpy's random number generator uses the same distribution and will independently generate random numbers for n times, so the numbers are i.i.d. And standard deviation is square root of variance, so your logic is correct.

  • Related