Statalist


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

Re: st: exponential distribution


From   "Austin Nichols" <[email protected]>
To   [email protected]
Subject   Re: st: exponential distribution
Date   Wed, 20 Feb 2008 07:58:41 -0500

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 <[email protected]> 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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index