Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Saving bootstrap samples


From   Nick Cox <njcoxstata@gmail.com>
To   "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: Saving bootstrap samples
Date   Mon, 17 Jun 2013 22:42:17 +0100

Better to think that you are replying to the list. Anyone who replies
to you is not volunteering to provide dedicated support, just trying
to push a discussion forward. Nor will they necessarily write lots of
code for you.

What you want requires custom programming, including mastery of -bsample-.




Nick
njcoxstata@gmail.com


On 17 June 2013 22:05, Margaret MacDougall <Margaret.MacDougall@ed.ac.uk> wrote:
> Dear Nick
>
> I am sorry if I did not provide all of the information you required.  Under
> your item 1., your third option looks attractive. I have three variables in
> the one spreadsheet from which the bootstrap samples are to be taken and
> would favour generating bootstrap samples of these which are saved within
> the original spreadsheet, if possible. It would be ideal if the output
> requested for each of these samples was also stored in the original
> spreadsheet, in this case, alongside each corresponding sample, in one or
> more columns if possible.
>
> Best wishes
>
> Margaret
>
>
> On 15/06/2013 09:16, Nick Cox wrote:
>>
>> Apart from the word "saving", what you seek is unclear.
>>
>> Some precision on exactly what you seek would help:
>>
>> 1. Different bootstrap samples as
>>
>> each a separate dataset
>> each a block of observations in  a combined dataset
>> each a block of variables in a combined dataset
>>
>> 2. Results of computations on each
>>
>> stored precisely how.
>>
>> Nick
>> njcoxstata@gmail.com
>>
>> On 15 June 2013 08:39, Margaret MacDougall <Margaret.MacDougall@ed.ac.uk>
>> wrote:
>>
>>> Thanks for your reply. It is the saving of the bootstrap samples I was
>>> specifically asking about, but I would wish to save them in addition to
>>> the
>>> output generated for particular parameters. Is it possible to combine
>>> these
>>> two tasks?
>>
>> On 14/06/2013 14:40, Maarten Buis wrote:
>>
>>>> On Fri, Jun 14, 2013 at 3:31 PM, Margaret MacDougall wrote:
>>>>>
>>>>> I would value some tips on how best to go about saving bootstrap
>>>>> samples
>>>>> generated by means of the bootstrap command in Stata.
>>>>
>>>> Do you want to save the samples or the statistics computed in each
>>>> sample? The latter can easily be achieved using the -saving()- option.
>>>> The former is harder. You'll probably have to abandon -bootstrap- and
>>>> code the loop yourself and draw random observation in each iteration
>>>> using -bsample-. It is probably most convient to store those samples
>>>> as fweights, like so:
>>>>
>>>> forvalues i = 1/10 {
>>>>       qui gen w`i' = .
>>>>       bsample , weight(w`i')
>>>> }
>>>>
>> *
>> *   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/
>>
>
>
> --
> The University of Edinburgh is a charitable body, registered in
> Scotland, with registration number SC005336.
>
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index