Statalist


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

Re: Random number routines [was: st: Simple Question - Use of rndbin]


From   "Ben Jann" <ben.jann@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: Random number routines [was: st: Simple Question - Use of rndbin]
Date   Mon, 24 Sep 2007 21:00:20 +0200

Yet another solution: You could use the -mm_rbinomial()- function from
the -moremata- package. Type

 . ssc install moremata

and then

 . help mata mm_rbinomial()

If n<50 or p>.03, the random numbers are generated using the rejection
technique (the direct approach). Otherwise the geometric distribution
technique is applied (see Evans et al. 2000).

ben

Evans, M., N. Hastings, B. Peacock (2000): Statistical Distributions.  Third
        Edition. New York: Wiley.



On 9/24/07, Yulia Marchenko, StataCorp LP <ymarchenko@stata.com> wrote:
> One more alternative to -rndbin- in addition to those mentioned by Nick in his
> response as of 21sep2007
>
> > http://www.stata.com/statalist/archive/2007-09/msg00689.html
>
> is the -genbinomial- command (an extension of -rndbinx-).  It uses a plugin
> for the binomial generation algorithm and therefore should be faster than
> -rndbin- and -rndbinx-.  See
>
>  . findit genbinomial
>
> for more information.
>
> -- Yulia
> ymarchenko@stata.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/
>
*
*   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