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   Maarten Buis <[email protected]>
To   [email protected]
Subject   Re: st: how to do subsampling in stata
Date   Thu, 15 Aug 2013 18:25:55 +0200

First, and I guess László knows that, I would never never never change
a file in official Stata. I would copy it, give it a different name,
an only than start changing.

Second, I would probably not do that either. Instead, I would
repeatedly look at those files for inspiration and tricks, but start
with as simple an application of that project as possible and only
step by step expand it to allow more options, or nicer output, or let
it deal with somewhat more complicated problems, etc. As László
noticed, when trying to directly addept StataCorp code you just get
overwhelmed by too many details.

Third, in case László is getting his hopes up: I am not going to do
this, I just have too many other things to do right now.

-- Maarten

On Thu, Aug 15, 2013 at 6:10 PM, László Sándor 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/



-- 
---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany

http://www.maartenbuis.nl
---------------------------------

*
*   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