Mean of Sampleset and powered Sampleset

Posted by Milla Well on Stack Overflow See other posts from Stack Overflow or by Milla Well
Published on 2012-12-10T16:47:53Z Indexed on 2012/12/10 17:03 UTC
Read the original article Hit count: 225

Filed under:
|
|

I am working on an ICA implementation wich is based on the assumption, that all source signals are independent. So I checked on the basic concepts of Dependence vs. Correlation and tried to show this example on sample data

from numpy import *
from numpy.random import *
k =  1000
s = 10000
mn = 0
mnPow = 0
for i in arange(1,k):
    a = randn(s)
    a = a-mean(a)
    mn = mn + mean(a)
    mnPow = mnPow + mean(a**3)
print "Mean X: ", mn/k
print "Mean X^3: ", mnPow/k

But I couldn't produce the last step of this example E(X^3) = 0:

>> Mean X:  -1.11174580826e-18
>> Mean X^3:  -0.00125229267144

First value I would consider to be zero, but second value is too large, isn't it? Since I subtract the mean of a, I expected the mean of a^3 to be zero as well. Does the problem lie in

  1. the random number generator,
  2. the precision of the numerical values
  3. in my misunderstanding of the concepts of mean and expected value?

© Stack Overflow or respective owner

Related posts about python

Related posts about random