Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Stata implementation of alias method
From
Jesse McCrosky <[email protected]>
To
[email protected]
Subject
Re: st: Stata implementation of alias method
Date
Fri, 10 Aug 2012 11:57:49 -0600
Thanks Rich, but it seems that rdiscrete() is limited to sampling from at most 10000 different outcomes:
: sampleIndexes = rdiscrete(100, 1, probabilityVector')
exceeded maximum table size of 10000
rdiscrete(): 3300 argument out of range
<istmt>: - function returned error
: rows(probabilityVector)
1
: cols(probabilityVector)
9875456
I don't suppose there's any way around this limitation? I've written my sampling function in C and it works fine there, but it'd be nice to be able to keep everything in Stata.
Best,
Jesse McCrosky
On 2012-08-09, at 11:11 AM, Richard Gates <[email protected]> wrote:
> Jesse,
>
> See
>
> . help mf_rdiscrete.
>
> -Rich
> [email protected]
>
> On 08/09/2012 11:16 AM, Jesse McCrosky wrote:
>> Hi all,
>>
>> I've been looking for an implementation in Stata of the alias method (for sampling from an arbitrary discrete distribution) and very surprised not to find one. If it really hasn't been done, I'll write it myself, but just thought I'd check here first.
>>
>> For those unfamiliar with the method, but curious, the method is described about halfway down here: http://www.keithschwarz.com/darts-dice-coins/ and the best implementation is in this paper: http://www.jstor.org/stable/10.2307/2683739
>>
>> Anyone seen or written this in Stata?
>>
>> Best,
>>
>> Jesse McCrosky
>>
>>
>>
>>
>>
>> *
>> * For searches and help try:
>> * http://www.stata.com/help.cgi?search
>> * http://www.stata.com/support/statalist/faq
>> * http://www.ats.ucla.edu/stat/stata/
>>
>
> *
> * For searches and help try:
> * http://www.stata.com/help.cgi?search
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/