Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: Random draw from log normal distribution with known mean and sd
From
Lulu Zeng <[email protected]>
To
"[email protected]" <[email protected]>
Subject
st: Random draw from log normal distribution with known mean and sd
Date
Mon, 27 Jan 2014 20:15:27 +1100
Dear Statalist,
I am seeking your help on take random draws from a log normal
distribution (with known mean and sd). I am aware similar question has
been answered on below page but I didn't manage to solve my issue with
this (http://www.stata.com/statalist/archive/2005-04/msg00999.html).
I am trying to calculate Willingness to Pay (wtp) for a number of
attributes (variables) of a random utility model (mixed logit in my
case).
wtp for a particular attribute is defined as the ratio of the
coefficient for the attribute (e.g., engine performance) to the
coefficient for the price variable. However, both of the engine
performance and price coefficients are random in my model -
performance is normally distributed & price is lognormal distributed.
Given the difference in distribution for the two coefficients, I had
to use simulation to work out the wtp. That means - take random draws
from both distribution and divide one by another to work out a
distribution for wtp.
To achieve this, my first step was to take random draws from my log
normally distributed price coefficient, which has a log mean & log sd
of -0.22 and 0.74 respectively (equivalent to a normal mean & sd of
-1.04 and 0.89 respectively). These figures are the results from my
model (distribution of the coefficient).
I used below code to take the draw as suggested by the webpage above
(1200 draws):
gen lognormal = exp(-1.04 + 0.89 * invnorm(uniform()))
To check, I summed the resulting draws from the above, and the draws a
mean of 0.53 & sd of 0.56. These figures are the same as the -0.22 and
0.74 I have above in log form, so I thought there must be something
wrong.
It would be really appreciated if I could have your help on this.
Best Regards,
Lulu
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/