From ben.bob at gmail.com  Tue Aug 30 15:44:50 2005
From: ben.bob at gmail.com (Bo Peng)
Date: Tue, 30 Aug 2005 06:44:50 -0700
Subject: [Rd] efficiency of sample() with prob.
In-Reply-To: <Pine.LNX.4.61.0508300716360.22282@gannet.stats>
References: <C698D707214E6F4AB39AB7096C3DE5A5AB5031@phost015.EVAFUNDS.intermedia.net>
	<6ea7b54305062211146473e7bf@mail.gmail.com>
	<Pine.LNX.4.61.0506222005080.3592@gannet.stats>
	<6ea7b54305062314375200f7d9@mail.gmail.com>
	<Pine.LNX.4.61.0508291607080.6766@gannet.stats>
	<6ea7b54305082915037905dc2f@mail.gmail.com>
	<Pine.LNX.4.61.0508300716360.22282@gannet.stats>
Message-ID: <6ea7b543050830064462b73670@mail.gmail.com>

> You chose to report just one extremely favourable example, < ignore>
> I do think you are being `careless with the truth'.

I chose to report whatever I got and whatever I felt the result was. It was not
a scientific report and it was up to you (the R-team) to validate my result and
make further investigations. When I was asked for a more thorough research
in this field (and thus take the responsibility to my results), I said
no since I did
not have enough expertise and time. 

After all, I could have chosen not to report anything at all. If this
mailing list
only accepts serious contributions from field professionals, it is time for me 
to quit.

> Hmm.  A sample every 100ns and generating samples several times faster
> than tabulating them is something to be impressed by. <ignore>
> Not in our tests.  Did you try my 5 out of 10,000 non-zero probablilties
> distribution, for example?

No. I did not try. Intuitively, Walker's method may be slow because  of
the memory allocation and table setup stuff. It should be used with 
large sample and small prob vector. Bisection method should be
quicker when the prob vector is large (so linear search is slow) and the 
sample size is relatively small. I thought bisection would be uniformly quicker 
than the linear search method since there is no additional cost other than 
a few more variables.

If you have done enough experiments and know the fastest method in 
each case, it should be straightforward to implement a hybrid method 
where the best method is chosen based on the lengths of sample and 
prob vector. I might have been reporting partial results, but the 80 times 
speed-up in some cases was not faked.

Cheers,
Bo



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