# Variance of $X$ and Variance of $\log(X)$. How to relate them?

I have the variance of a random variable $$X$$ and I want to obtain the variance of $$\log(X)$$. Is it possible if I dont know its PDF? If I assume that $$X$$ has a lognormal PDF, how variances should be related?

• Because the variance of any positive multiple $\sigma X$ is $\sigma^2$ times the variance of $X,$ but the variance of $\log(\sigma X) = \log(\sigma)+\log(X)$ does not change, it is impossible in general to say anything about the relationship between the variance of $X$ and that of $\log(X).$ Indeed, it's even possible for either one or both of those variances to be infinite. As an example, for $t\ge 1$ let $\Pr(\log(X)\le -t) = 1/t:$ this logarithm has infinite variance, but $X$ itself (being confined to the interval $(0,1]$) has finite variance.
– whuber
Dec 2, 2020 at 17:13

The delta method is pretty useful here. Using a first order Taylor series approximation about the mean of $$X$$ $$\log(X) \approx \log(E[X]) + \frac{(X-E[X])}{E[X]}$$ so, after we take expectations and variances on both sides,

• $$E[\log(X)] \approx \log(E[X])$$
• $$V[\log(X)] \approx E[X]^{-2}\text{V}[X]$$.

This relates to the idea of variance-stabilization; if a dependent variable in a regression has a variance that is proportional to the mean squared, then taking the log of that dependent variable produces something that has constant variance, which is often a desirable or necessary assumption.

• Could you please show how you derive the approximation for $\text{log}(X)$? Thank you! Aug 23, 2021 at 9:22
• For $E[X]^{-2}$, did you mean the second moment or the expected value of $X^2$? May 1, 2022 at 23:03

Comment on lognormal and normal distributions.

The variance of data tends to decrease when you take logs of the values. Perhaps the most common case is that, if $$X_1$$ is lognormal, then $$X_2 = \ln(X_1)$$ is normal, which has smaller variance than $$X_.1$$ Also, if it exists, $$X_3 = \ln(X_2)$$ may have a still smaller variance.

Below we begin with a random sample (using R) of $$n = 10^4$$ observations from a lognormal distribution with parameters $$\mu = 50, \sigma = 2.$$ (It is customary to use lognormal parameters that match parameters of the related normal distribution. You can look at Wikipedia on 'lognormal distributions' for details.) We show means and standard deviations for distributions of $$X_1, X_2,$$ and $$X_3.$$

set.seed(720); n = 10^4
x2 = rnorm(n, 50, 2);  x1 = exp(x2);  x3 = log(x2)
mean(x1); mean(x2); mean(x3)
[1] 3.686093e+22
[1] 50.01289         # aprx E(X2) = 50
[1] 3.911481
sd(x1); sd(x2); sd(x3)
[1] 2.308712e+23
[1] 1.997261         # aprx SD(X2) = 2
[1] 0.04004551


Then we show histograms of the three samples. At the left, notice that it is difficult to make an informative histogram of $$X_1$$ because it is so severely skewed to the right. In the center panel, we overlay the density function of $$\mathsf{Norm}(\mu =50, \sigma=2);$$ which is symmetrical. At the right, notice that taking (natural) logs once again results in a slightly left-skewed distribution.

Notes: (1) The the support of a lognormal distribution is $$(0, \infty).$$ A normal distribution may take negative values. If the lognormal distribution is truncated to $$(1, \infty)$$ so that the normal distribution is truncated to $$(0,\infty),$$ then the natural log of that "normal" distribution exists. The distribution $$\mathsf{Norm}(50, 2)$$ has almost no probability below $$0,$$ so the truncation would have little practical effect in this example.

(2) R code for the figure above:

par(mfrow=c(1,3))
hist(x1, prob=T, br=50, col="skyblue2")
hist(x2, prob=T, col="skyblue2")
hist(x3, prob=T, col="skyblue2")
par(mfrow=c(1,1))


(3) However, it is not always true that taking logs gives a smaller variance. If $$X_2 \sim \mathsf{Unif}(0,1),\, X_1 = e^{X_2},$$ and $$X_3 = \ln(X_2),$$ then R code similar to the code for the lognormal example gives the following results:

set.seed(720); n = 10^5
x2 = runif(n);  x1 = exp(x2);  x3 = log(x2)
var(x1); var(x2); var(x3)
[1] 0.2411124
[1] 0.08316279  # aprx V(X2) = 1/12
[1] 1.01091


• Very nice answer! I would suggest that in (3) we do not need to form $X_1$. Just $X_2$ and $X_3$ are enough for the argument. Dec 2, 2020 at 18:39