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?
-
$\begingroup$ 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. $\endgroup$– whuber ♦Commented Dec 2, 2020 at 17:13
2 Answers
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.
-
$\begingroup$ Could you please show how you derive the approximation for $\text{log}(X)$? Thank you! $\endgroup$– GilfoyleCommented Aug 23, 2021 at 9:22
-
$\begingroup$ For $E[X]^{-2}$, did you mean the second moment or the expected value of $X^2$? $\endgroup$– hnguyenCommented May 1, 2022 at 23:03
-
1$\begingroup$ @Gilfoyle we take the Taylor expansion of the function $\log(X)$ around $X_0:=E[X]$. This gives us the approximation for $\log(X)$. $\endgroup$– RiemannCommented Oct 23 at 14:11
-
$\begingroup$ @hnguyen the meaning of $E[X]^{-2}$ is the fraction $\frac{1}{(E[x])^2}$. $\endgroup$– RiemannCommented Oct 23 at 14:13
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.
[![enter image description here][1]][1]
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=TRUE, br=50, col="skyblue2")
hist(x2, prob=TRUE, col="skyblue2")
curve(dnorm(x,50,2), add=TRUE, col="red")
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
```r
[![enter image description here][3]][3]
[1]: https://i.sstatic.net/ICW5Y.png
[2]: https://i.sstatic.net/h4Wm4.png
[3]: https://i.sstatic.net/Trosu.png
-
$\begingroup$ 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. $\endgroup$ Commented Dec 2, 2020 at 18:39