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

# Re: st: Generating random variables with logistic distribution

 From "Eric G. Wruck" To statalist@hsphsun2.harvard.edu Subject Re: st: Generating random variables with logistic distribution Date Thu, 4 Aug 2005 11:29:32 -0400

```This rang a bell so I went back to Mood, Graybill & Boes (1974).  What you are interested in is called a probability integral transform (p. 202 if you have that book).  "...Conversely, if U is uniformly distributed over the interval (0,1), then X = F-1(U) has cumulative distribution function Fx()."  Unfortunately, I can't seem to do sub- & superscripts here in Eudora, but the F-1() is supposed to be the inverse cumulative distribution function for the random variable X.  So if you have the cdf for the logistic, you should be able to generate an rv L that is distributed according to the logistic distribution.

As an example, I took the simple logistic case with parameters alpha = 0 & beta = 1.  Here's what I get with a sample of 1,000:

. gen u = uniform()

. gen L = -ln((1 - u)/u)

. summ L, de

L
-------------------------------------------------------------
Percentiles      Smallest
1%    -4.747468      -7.249973
5%    -3.048538      -6.471672
10%     -2.17264      -5.892376       Obs                1000
25%    -1.153445      -5.352503       Sum of Wgt.        1000

50%     .0949801                      Mean          -.0038691
Largest       Std. Dev.      1.805678
75%     1.139236       5.268712
90%     2.159457       5.512243       Variance       3.260474
95%     2.882929       5.750656       Skewness      -.1215126
99%     4.709992       6.240138       Kurtosis       3.704852

.

The theoretical mean is alpha, or zero in this case, so it looks somewhat close.  The theoretical variance is (beta times pi) squared divided by 3, or approximately 3.299, so again close.

Hope this helps.

Eric

>I know how to generate random variables with normal and uniform distributions.  How about other distributions - in particular, logistic?  Is there a program around that already does this, or can somebody tell me what the formula is?  I seem to vaguely remember seeing something like this but now I can't find it.  Thanks.
>
>
>-------------------------------------------
>Richard Williams, Notre Dame Dept of Sociology
>OFFICE: (574)631-6668, (574)631-6463
>FAX:    (574)288-4373
>HOME:   (574)289-5227
>EMAIL:  Richard.A.Williams.5@ND.Edu
>WWW (personal):    http://www.nd.edu/~rwilliam
>WWW (department):    http://www.nd.edu/~soc
>
>*
>*   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/

--

===================================================

Eric G. Wruck
Econalytics
2535 Sherwood Road
Columbus, OH  43209

ph:      614.231.5034
cell:    614.330.8846
eFax:    614.573.6639
eMail:   ewruck@econalytics.com
website: http://www.econalytics.com

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