Bookmark and Share

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: how to do subsampling in stata


From   László Sándor <[email protected]>
To   [email protected]
Subject   Re: st: how to do subsampling in stata
Date   Thu, 15 Aug 2013 12:45:07 -0400

Oh, I would have never changed an official ado file, no.

Surely I was talking about the copies — I even named them already.

Yes, if things come to it, I could do it for my own use case (until it
does not break anymore) and not even distribute the result.

Or of course, if StataCorp reading this is confident about how easy
the transition from -bsample- to -sample- would be for a clone of
-bootstrap-…

Thanks,

Laszlo

On Thu, Aug 15, 2013 at 12:27 PM, Nick Cox <[email protected]> wrote:
> The story of Knuth and TeX springs to mind somehow. He got annoyed
> with the mathematical typesetting of one of his books, but reckoned
> that the problem was programmable, yet that no one else was going to
> do it, so he just needed to write the program himself. The project
> took a decade of his life, or thereabouts, but many of us are in
> permanent debt to him.
>
> The link here may be that the problem is programmable but hitherto no
> one else has done it, so you may need to write the program yourself.
> The precedent is, however, alarming, even if you factor in that this
> problem is easier, because we can be confident that Knuth is better
> than any of us.
> Nick
> [email protected]
>
>
> On 15 August 2013 17:10, László Sándor <[email protected]> wrote:
>> FWIW, the bsampling for -bootstrap- is done by -_loop_bs.ado-. I did
>> not venture to tweak these files, as there are quite a few options to
>> keep track of.
>>
>> On the other hand, this does not look like hard-coded, optimized MPI C
>> code to my eye, so maybe a more adventurous soul could duplicate a
>> -_loop_ss.ado- and thus -subsampling- for us?
>>
>> At least for simpler cases, if -sample- does not allow all the options
>> -bsample- does.
>>
>> Thanks,
>>
>> Laszlo
>>
>> On Wed, Aug 14, 2013 at 2:14 PM, Stas Kolenikov <[email protected]> wrote:
>>> Phil indicated (absolutely correctly) that -sample- implements
>>> sampling without replacement, which is what subsampling needs to use.
>>> You can use the mechanics of -post- or -simulate- to make subsampling
>>> work. I don't know whether there's a straightforward way to utilize
>>> the -bootstrap- output formatting to work with a file thus created.
>>> You can also try Jeff Pitblado's -bs4rw- where your replicate weights
>>> will be 0 and 1, with the total number of 1's equal to your b
>>> parameter of subsampling (in Politis, Romano and Wolf's notation). If
>>> you have a non-iid situation, then you may need to use specific tools
>>> to create the right patterns of 0s and 1s, but if you have iid data,
>>> then you simply simulate them with standard tools, such as (very
>>> inefficient due to multiple sorts)
>>>
>>> tempvar u
>>> gen `u' = .
>>> forvalues r=1/`R/ {
>>>   replace `u' = uniform()
>>>   sort `u'
>>>   gen wgt`r' = (_n <= `b' )
>>> }
>>> bs4rw , rw( wgt* ) : whatever
>>>
>>>
>>>
>>> -- Stas Kolenikov, PhD, PStat (ASA, SSC)
>>> -- Senior Survey Statistician, Abt SRBI
>>> -- Opinions stated in this email are mine only, and do not reflect the
>>> position of my employer
>>> -- http://stas.kolenikov.name
>>>
>>>
>>>
>>> On Wed, Aug 14, 2013 at 12:43 PM, László Sándor <[email protected]> wrote:
>>>> Thanks, Phil.
>>>>
>>>> I am not sure I'd venture to hack -bootstrap- with replacing -bsample-
>>>> with -sample- on my own, while I think its MP optimization and other
>>>> features make the -bootstrap- prefix preferable to one's own
>>>> implementations of loops of -bsample-.
>>>>
>>>> That said, if "no replacement" is indeed not in -bootstrap-, it won't
>>>> be added any time soon, so there is nothing but the manual loops…
>>>>
>>>> But I forgot link to one existing Statalist entry on subsampling from
>>>> 4 (!) years ago already citing prestigious (though admittedly recent)
>>>> literature suggesting subsampling could be a good idea — e.g. for
>>>> matching estimators which were perhaps the biggest novelty in Stata
>>>> 13. So, where is the subsampling?
>>>> http://www.stata.com/statalist/archive/2009-04/msg00920.html
>>>>
>>>> Thanks!
>>>>
>>>> Laszlo
>>>>
>>>> On Wed, Aug 14, 2013 at 1:33 PM, Phil Schumm <[email protected]> wrote:
>>>>> On Aug 14, 2013, at 11:15 AM, Phil Schumm <[email protected]> wrote:
>>>>>> On Aug 14, 2013, at 10:58 AM, László Sándor <[email protected]> wrote:
>>>>>>> I wonder why I found no comments, help files, FAQs, list entries on subsampling implemented in Stata. Isn't one of the sampling-bootstrapping commands fit to that too? Is the sampling without replacement the biggest difficulty?
>>>>>>>
>>>>>>> I would have thought a simple option could have been added to -bootstrap- long ago to achieve this.
>>>>>>>
>>>>>>> Or am I overlooking another simple solution?
>>>>>>
>>>>>>
>>>>>> I don't understand your question, but -search sample- brings up -bsample-, which is used by -bootstrap-.
>>>>>
>>>>>
>>>>> I'm sorry -- I read too quickly.  The command -sample- will draw samples without replacement, which you could use to construct the CI referenced in your post.
>>>>>
>>>>>
>>>>> -- Phil
>>>>>
>>>>>
>>>>> *
>>>>> *   For searches and help try:
>>>>> *   http://www.stata.com/help.cgi?search
>>>>> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index