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 <[email protected]> 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
> [email protected]
> *
> * 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/