[R] Efficient sampling from a discrete distribution in R
Issac Trotts
issac.trotts at gmail.com
Tue Sep 4 09:40:47 CEST 2007
On 9/3/07, Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
> Yes, vectorize, and don't grow vectors. See 'S Programming' (details in
> the R FAQ).
It's easy to avoid growing the samples vector but it doesn't seem to
make much difference. Vectorizing would be probably help, but in this
algorithm each step depends on the one before it. Do you know of an
alternative to the Chinese restaurant process that is vectorizable?
> We've no idea about you (the R posting guide does ask for a signature
> block), but if this is homework some people are going to be annoyed.
No, it's for my job at Google, so maybe I should use my work email
address to avoid confusion. Sorry if the questions are so basic that
they sound like homework, but you and others on the list know things
that aren't easy to find in the documentation.
--
Issac Trotts
Web Operations Chair
Silicon Valley Web Builder
http://svwebbuilder.com
More information about the R-help
mailing list