0

Assume that $X∼ N (μ, σ^2)$ and that $Y = e^X$ and we have set $μ = 0$ and $σ = 1.5$. We have to prove that $E[Y] = e^{(μ+σ^2)/2}$ using 10000 simulations. I.e. rnorm(n=10000,mean=0,sd=1.5). I have simulated values of $X$ using rnorm, but how can I use these values to make simulations of $Y$?

Markus J
  • 21
  • 2
  • 1
    The answer is right in your question: $Y=\exp(X)$. You could also work with rlnorm directly. – Christoph Hanck Mar 01 '24 at 13:56
  • Well, E[Y] = $e^{(μ+σ^2)/2}$ = $e^{(1.5^2)/2}$ = 3.08. Is this correct? Using x<-rlnorm(10000,mean=0,sd=1.5) mean(x)= 3.07. I am just confused because it is very far from the mean, 0. – Markus J Mar 01 '24 at 14:00
  • 1
    The log normal $y$ is obtained when you exponentiate a normal (or equivalently, the log of such a r.v. is normal, whence the name) as stated in your Q. Its expected value $Y$ is also given in your question. Here, $\mu$ is the expected value of the normal r.v. $X$ that when exponentiated gives the log-normally distributed r.v. $Y$. – Christoph Hanck Mar 01 '24 at 14:03
  • But when you exponentiate =0 it doesn't give the log-normally distributed r.v. – Markus J Mar 01 '24 at 14:06
  • With a geometric mean $\sigma = 1.5$ you will need an enormous simulation to get anywhere close to the expected result. Start with a much smaller value of $\sigma:$ less than $0.6$ is usually reasonable. But your question is puzzling, because it contains its own answer: you have defined $Y$ as the exponential of $X,$ whence if you have simulated values of $X,$ you merely exponentiate them to produce simulated values of $Y.$ What are you really trying to ask? – whuber Mar 01 '24 at 14:07
  • Using x <- rnorm(10000,mean=0,sd=1.5) and then mean(x), I get a mean = 0.01. I then exponentiate it, and get Y = $e^X$, Y = $e^{0.01} = 1.01 $. When I exponentiate 1.01 I don't get anything close to E[Y] = (μ+σ2)/2 = (1.52)/2 = 3.08. So my question is why my calculations are so far from the theoretical calculation? – Markus J Mar 01 '24 at 14:24
  • 3
    You are doing it the wrong way round. You first have to exponentiate to get the log-normally distributed r.v. and then take the mean to estimate the expected value of the log-normal. As in mean(exp(rnorm(n=10000,mean=0,sd=1.5))) – Christoph Hanck Mar 01 '24 at 14:26
  • Thank you, I understand it now. – Markus J Mar 01 '24 at 14:27

0 Answers0