Bookmark and Share

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]

Re: st: Random draw from log normal distribution with known mean and sd


From   Alfonso Sánchez-Peñalver <[email protected]>
To   Stata List <[email protected]>
Subject   Re: st: Random draw from log normal distribution with known mean and sd
Date   Mon, 27 Jan 2014 07:51:43 -0500

Hi Lulu,

please explain how you get the equivalent normal mean and sd of -1.04 and 0.89 from the lognormal mean and sd of -0.22 and 0.74? Because I think that is where the problem is. Check http://en.wikipedia.org/wiki/Log-normal_distribution to see the relationship with the means and the standard deviations. The following seems close enough

clear
set obs 5000
generate n = rnormal(-2.77, 1.58)
generate ln = -exp(n)
summarize

Best,

Alfonso

On Jan 27, 2014, at 4:15 AM, Lulu Zeng <[email protected]> wrote:

> 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/


*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index