MathGroup Archive 2002

[Date Index] [Thread Index] [Author Index]

Search the Archive

simulating random variables

  • To: mathgroup at
  • Subject: [mg32831] simulating random variables
  • From: "Aaron E. Hirsh" <aehirsh at>
  • Date: Thu, 14 Feb 2002 01:44:02 -0500 (EST)
  • Sender: owner-wri-mathgroup at

Dear All,

I need to simulate a large number of binomial random variables. 
Unfortunately, when the parameter n (number of trials) is large, the 
simulation of binomial random variables is relatively time consuming. 
For example, if I would like to simulate a binomial random variable 
with parameters n = 10000 and p =0.01:


{0.283333 Second,1007}

One possibility for saving time would be to use an approximation. For 
small p, an appropriate approximation is the Poisson. While this is 
definitely better:


{0.0333333 Second,1002}

, it is still much slower than using a normal:


{0. Second,1025.3}

Does anyone know how I could speed up my simulation of binomial or 
poisson-distributed random variables? I would also be interested in 
ways of speeding up the simulation of the Normal, though it seems 
extraordinarily efficient already.

     Thank you very much,

Aaron Hirsh

Aaron E. Hirsh
Center for Computational Genetics and Biological Modeling
Stanford University
tel. (650) 723-4952
fax. (650) 725-0180

  • Prev by Date: Re: Understanding the Output
  • Next by Date: Re: Stumped again on a simple list
  • Previous by thread: Re: Notebook manipulation
  • Next by thread: Re: simulating random variables