Statalist


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

RE: st: exponential distribution


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: exponential distribution
Date   Wed, 20 Feb 2008 13:14:08 -0000

Austin is naturally correct. But as (1 - uniform(x)) has the same
distribution as uniform(x) 
his expression can be simplified without loss to 

g e1 = -ln(uniform()) 

Nick 

Austin Nichols

Jon--
The general approach is to take the cumulative distribution function
F(x) and solve for x in terms of F.  Then replace F with uniform() and
you are done:
F=1-exp(-lambda*x)
1-F=exp(-lambda*x)
-lambda*x=ln(1-F)
x=-(1/lambda)*ln(1-F)

so for lambda=1, you can
g e1=-ln(1-uniform())

On Feb 19, 2008 9:02 PM, Jon Schwabish <jschwabi@yahoo.com> wrote:
> Does anyone know how to create an exponential
> distribution with a mean of 1 to use as random
> numbers? I believe it's a tweak on exp=-ln(uniform()),
> but am not sure.

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index