Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: simulating a lognormal distribution (correction)


From   "Feiveson, Alan H. \(JSC-SK311\)" <[email protected]>
To   <[email protected]>
Subject   st: RE: simulating a lognormal distribution (correction)
Date   Tue, 12 Sep 2006 08:59:49 -0500

for E(Y^2). Corrected version is below.

al F.

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.

Al Feiveson



-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Jeph Herrin
Sent: Tuesday, September 12, 2006 8:24 AM
To: [email protected]
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?

thanks,
Jeph







*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index