Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm currently trying to solve a maximum likelihood estimation of a random variable which is assumed to be log normal distributed.

For this I compute the log of all sample values I have in order to compute mean and variance of the (normal-)distribution.

My problem is that always if a value drops below one, its log() will be negative. In my solving algorithm I need to compute the standard deviation, which is not possible for negative values.

Am I missing something?

share|improve this question
You can easily calculate the SD even if all your values are negative. For example the SD of $-1, -2, -3, -4, -5$ is necessarily the same as that of $1, 2, 3, 4, 5$. What makes you think otherwise? – Nick Cox Jan 10 at 13:41
Note that while negative variance (or SD) is impossible in your context, the variance (or SD) of negative numbers is certainly defined. Perhaps this is the source of your confusion. – Nick Cox Jan 10 at 13:45
Thanks to all who answered. You helped me understand a general problem. I was solving for the varianz and got for some stupid reason a negative value as the solution. This caused some confusion. – kschalle Jan 10 at 23:51

You are missing something!

If you consider the original log-normal sample $(y_1,\ldots,y_n)$, the log-transformed sample $(x_1,\ldots,x_n)=(\ln y_1,\ldots,\ln y_n)$ is distributed as a $\mathcal{N}(\mu,\sigma^2)$ sample. Estimating $(\mu,\sigma)$ by maximum likelihood from the original log-normal sample $(y_1,\ldots,y_n)$ is thus equivalent to estimating $(\mu,\sigma)$ by maximum likelihood from the log-transformed sample $(x_1,\ldots,x_n)$, which means deriving the maximum likelihood estimates of mean and variance from a normal sample. In other words, $$ \hat\mu=\frac{1}{n}\sum_{i=1}^n x_i \qquad \hat\sigma^2=\frac{1}{n}\sum_{i=1}^n (x_i-\hat\mu)^2 $$ or equivalently $$ \hat\mu=\frac{1}{n}\sum_{i=1}^n \ln y_i \qquad \hat\sigma^2=\frac{1}{n}\sum_{i=1}^n (\ln y_i-\hat\mu)^2 $$ This solution is well-defined even when some [or all] $x_i$'s are negative.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.