Hi All,
This is not really an R question but a statistical one. If someone could
either give me the brief explanation or point me to a reference that might
help, I'd appreciate it.
I want to estimate the mean of a log-normal distribution, given the (log
scale normal) parameters mu and sigma squared (sigma2). I understood this
should simply be:
exp(mu + sigma2)
... but I the following code gives me something strange:
R <- 10000000
mu <- -400
sigma2 <- 200
tmp <- rlnorm(R, mu, sqrt(sigma2)) # a sample from the desired log-normal
distribution
muh <- mean(log(tmp))
sigma2h <- var(log(tmp))
#by my understanding, all of the the following vectors should then contain
very similar numbers
c(mu, muh)
c(sigma2, sigma2h)
c(exp(mu + sigma2/2), exp(muh + sigma2h/2), mean(tmp))
I get the following (for one sample):
> c(mu, muh)
[1] -400.0000 -400.0231
> c(sigma2, sigma2h)
[1] 200.0000 199.5895
> c(exp(mu + sigma2/2), exp(muh + sigma2h/2), mean(tmp))
[1] 5.148200e-131 4.097249e-131 5.095888e-150
so they do all contain similar numbers, with the exception of the last
vector, which is out by a factor of 10^19. Is this likely to be because one
needs **very** large samples to get a reasonable estimate of the mean... or
am I missing something?
Regards,
Simon
[[alternative HTML version deleted]]