# Disparity when using E(Y) to calculate mean, vs the real mean

I have used R to compute the mean, median, and SD of 100K monthly salaries of public state workers salaries in a US state. I then took the log of each of those salaries, and got: The mean, μ = 11.29312 The SD, σ = 0.3538964 I then calculated the expected value, using this formula $$E(Y)=e^{μ+σ^2/2}$$ = e^{11.29312+(0.3538964^2)/2}$$=$$85454 However, I calculated the mean of the salaries to be $85577. I am very curious as to why this disparity exist, shouldn't they be exactly equal? Why is the formula faulty? Is it because the data is not 100% log normal distributed, but only 99%? Do 100% log normal distributions even exist in real life, or do we always have to make do with aproximations? • Are these real salary data? In such a case, they will be 0% lognormally distributed, insofar as 0% of the data will have been drawn from a lognormal distribution. Commented Mar 1 at 18:32 • The salary data are indeed real . I took the values in R and turned them into a log normal distribution however, that's where I got μ = 11.29312 The SD, σ = 0.3538964 from. Commented Mar 1 at 18:34 • No finite amount of data can possibly have a lognormal distribution (or any continuous distribution for that matter). You might want to study the difference between a property of a distribution and an estimator of that property. – whuber Commented Mar 1 at 19:16 • Beyond the fundamental problem that "No finite amount of data can possibly have a lognormal distribution (or any continuous distribution for that matter)," the formula shown for the expected value is incorrect; see Wikipedia. Also, I'm having some trouble reproducing your$E(Y)$calculation with the correct formula and the mean and sd the you report. Please edit the question to provide the correct formula and double check your calculations. Try to avoid using $ symbols as they get interpreted as delimiting MathJax content.
– EdM
Commented Mar 1 at 19:27
• $\$$symbols can be used if you put a \ in front, like so: \\\$. They'll then show up as \\$ Commented Mar 1 at 20:40

The R EnvStats package discusses several ways to estimate the parameters of a lognormal distribution from the original data, in its help page for elnormAlt(). Your method, based on evaluating the mean and variance of the log-transformed values, is the "maximum likelihood" or the "quasi maximum likelihood" estimate, depending on whether you used $$n$$ or $$(n-1)$$ in the formula for the variance; those are essentially the same with your 100000 observations. If $$\theta$$ is the true mean value of the lognormal distribution, its maximum-likelihood estimate is, as you write, $$\hat\theta_{mle}=\exp(\hat\mu + \hat\sigma^2/2)$$, where $$\hat\mu$$ and $$\hat\sigma^2$$ are the sample mean and variance of the log-transformed values.
The sampling distribution of $$\hat\theta_{mle}$$, however, is biased from the true value $$\theta$$. The expected value of $$\hat\theta_{mle}$$ is:
$$E[\hat\theta_{mle}]=\theta \exp\left[\frac{-(n-1)\sigma^2}{2n}\right] \left(1 - \frac{\sigma^2}{n}\right)^{-(n-1)/2},$$
where $$n$$ is the number of observations and $$\sigma^2$$ is the true variance of the log-transformed distribution. That's approximately $$\theta \exp(-\sigma^2/2)$$ at large $$n$$, lower than $$\theta$$.
The default in elnormAlt() is a "minimum variance unbiased estimate" that takes the number of observations into account.