[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: RE: simulating a lognormal distribution (correction)
You can also form some sort of generalized method of moments estimator
where you are weighting the three estimating equations to form a
conglomerate of those. In the simplest form, if you have the median
MED, the mean MY and the standard deviation SDY, you can form (MED -
exp(mu))^2 + (MY - exp(mu+sigma^2/2))^2 + (SDY^2 - exp(2*mu + sigma^2)
* (exp(sigma^2) - 1) )^2 to be minimized over mu and sigma (or better
sigma^2)... if I got the variance right!
Indeed, the lognormal distribution is very heavy tailed, although it
has all the moments of positive order, but those moments of higher
orders are unstable. On the other hand, the estimator of the variance
based on the difference between the mean and the median may be
unstable, as well.
For a background reading, you can look up an ancient book on lognormal
distribution by Aithcison and Brown dated back in the 1950s.
On 9/12/06, Feiveson, Alan H. (JSC-SK311) <firstname.lastname@example.org> wrote:
for E(Y^2). Corrected version is below.
Jeph - Let X = log(Y). You can use the fact that E(exp(tX)) = exp(mu*t +
t*t*sig2/2) where X~N(mu,sig2). Taking t=1,we see that E(Y) = mu +
sig2/2. Also the median of Y is exp(median of X) = exp(mu). So from the
mean and median of Y, you can get values for mu and sig. The sd of Y
adds additional information if you want to use it. Taking t=2, gives
E(Y^2) = E( (exp(x))^2 ) = E(exp(2X)) = exp(2*mu + 4*sig2/2) = exp(2*mu
+ 2*sig2). From this you can get Var(Y)=E(Y^2) - (E(y))^2 also as some
function of mu and sig2. Then you have three equations and two unknowns
(mu and sig)and you could solve for mu and sig by some sort of weighted
least squares. But I think the sample variance (or sd) of a lognormal RV
is not very reliable statistic and I would go with just the mean and
median to estimate mu and sig.
[mailto:email@example.com] On Behalf Of Jeph Herrin
Sent: Tuesday, September 12, 2006 8:24 AM
Subject: st: simulating a lognormal distribution
This is not, strictly speaking, a Stata problem, but I am hoping to find
a Stata solution.
I am trying to simulate a lognormal distribution, but have only the
median (which I'm willing to assume is the log mean) plus the mean and
sd of the non-log transformed data. Put another way, I have median, mean
and sd of Y, but log(Y) is normal, and I would like to simulate Y.
I have found -rndlgn-, which will simulate a random log normal
distribution, but only if I have the mean and sd of log(Y). The only
idea I have is to generate a series of log normal distributions X with
mean = log(median(Y)) and a range of sds, until I end up with one where
exp(X) has the mean and sd of Y. But this seems overly computing
intensive for my purposes, as I will need to do this for a large number
of obs with a loop that runs many times.
Any other ideas? In particuar, am I missing an obvious way to get the
mean & sd of log(Y) from the mean and sd of Y?
* For searches and help try: