From ben.bob at gmail.com  Tue Jun 21 18:24:21 2005
From: ben.bob at gmail.com (Bo Peng)
Date: Tue, 21 Jun 2005 11:24:21 -0500
Subject: [Rd] efficiency of sample() with prob.
Message-ID: <6ea7b543050621092420dcc268@mail.gmail.com>

Dear list,

A while ago, Vadim asked opinions on improving efficiency of sample()
with prob, e.g. sample with replacement with weight.  (
https://stat.ethz.ch/pipermail/r-devel/2004-September/030844.html ) He
did not post what he ended up with this problem though.

I am having exactly the same problem. I need to sample  with
replacement from a population of size 10 million with fitness values
for each individual. sample() is too slow for this purpose.

I implement a bisection search algorithm. It is about 30% faster than
the linear search one but still not good enough to me. (I can post the
function if needed). Does anybody have some good ideas? The only other
idea I have is using a faster (but worse) random number generator just
for this application.

Thanks.
Bo



[Rd] efficiency of sample() with prob.
Bo Peng