The average of the sum of a normally distributed variable with a mean of 0 is zero. That works. The product of e to the power of a normally distributed variable with a mean of 0 should be 1. But when I do it in Python, I get a product that is higher than 1. Any explanation for this?
sumProduct = 0.0
iterations = 100000
for j in range(iterations):
product = 1.0
for i in range(10):
normalVar = numpy.random.normal(0.0, 0.1)
product *= math.exp(normalVar)
sumProduct += product
print sumProduct/iterations # Outputs 1.05
Shouldn’t it output 1.0? The expected value of the product variable should be 1.0, and the average of all the product variables should be 1.0. So why does it output 1.05? (Changing the number of iterations and the standard deviation changes the output, but it always greater than one). Thanks for the help!
The mean of a log-normal variable is exp(mu + 1/2 sigma^2), where mu and sigma are the parameters of the associated normal distribution. In this case, the associated normal distribution is the distribution of the logarithm of the variable ‘product’, which has mu = 10 times 0.0 and sigma^2 = 10 times 0.1^2 = 0.1. Therefore the mean of the log-normal variable is exp(0.0 + 1/2 times 0.1) = exp(0.05) which is approximately 1.05.