Posts Tagged ‘ code optimization ’

Variable probability Bernoulli outcomes – Fast and Slow

November 1, 2012
By
Variable probability Bernoulli outcomes – Fast and Slow

I am working on a project that requires the generation of Bernoulli outcomes. Typically, I would go about this using the built in sample() function like so: This works great and is fast, even for large n. Problem is, I want to generate each sample with its own unique probability. Seems straight forward enough, I

Read more »