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   "Roger B. Newson" <[email protected]>
To   [email protected]
Subject   Re: st: Random draw from log normal distribution with known mean and sd
Date   Mon, 27 Jan 2014 13:00:08 +0000

Another useful source on the lognormal distributon (I find) is Stas Kolenikov's page at

http://www.komkon.org/~tacik/science/lognorm.pdf

which presents the useful formulas in one place.

Best wishes

Roger

Roger B Newson BSc MSc DPhil
Lecturer in Medical Statistics
Respiratory Epidemiology, Occupational Medicine
and Public Health Group
National Heart and Lung Institute
Imperial College London
Royal Brompton Campus
Room 33, Emmanuel Kaye Building
1B Manresa Road
London SW3 6LR
UNITED KINGDOM
Tel: +44 (0)20 7352 8121 ext 3381
Fax: +44 (0)20 7351 8322
Email: [email protected]
Web page: http://www.imperial.ac.uk/nhli/r.newson/
Departmental Web page:
http://www1.imperial.ac.uk/medicine/about/divisions/nhli/respiration/popgenetics/reph/

Opinions expressed are those of the author, not of the institution.

On 27/01/2014 12:51, Alfonso Sánchez-Peñalver wrote:
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/

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