Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Generating a logistically distributed random variable.


From   Antoine Terracol <Antoine.Terracol@univ-paris1.fr>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Generating a logistically distributed random variable.
Date   Mon, 19 Aug 2002 17:36:00 +0200

Hello.

To generate standard random logistic variables, you can use the following code (to be saved as drawlogit.ado in your personal ado files directory):

cap prog drop drawlogit
program define drawlogit
version 7.0
syntax newvarlist [if] [in] [, double]
tokenize "`varlist'"
while "`1'"!="" {
g `double' `1' =ln(1/uniform()-1) `if' `in'
mac shift
}
end


alternatively, and for more general distributions, see the --rnd- suite (findit rnd)

Hope this helps,
Antoine


epowers@moore.sc.edu wrote:


To generate a normal (0,1) random variable you use invnorm(uniform()). How do you generate a random variable that is logistically distributed?

Sincerely, Eric Powers
---
[This E-mail scanned for viruses by Declude Virus]

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



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