# Negative variance in a log normal distribution

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?

-
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

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.