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: Extract Values from bootstrap operation


From   Nick Cox <njcoxstata@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Extract Values from bootstrap operation
Date   Tue, 1 Jan 2013 08:41:16 +0000

You should not be surprised that

> When I try
>
> noi bootstrap y0_bs=r(mean),saving("output.dta", replace): sum y0_hold
>
> I only get the mean values saved.

as that is _exactly_ what you asked for.

First off, -summarize- doesn't purport to save confidence intervals in
any sense. If that's what you want you need to use -ci- instead.

Conversely, if you want the 5th and 95th percentiles, you  need to
specify -summarize, detail-.

So, you need to get clear on what it is that you want. The help files
for -summarize- and -ci- are linked to the manual entries, which
explain which results are saved.

Nick

On Tue, Jan 1, 2013 at 2:44 AM, Rahber Thariani <thariani@gmail.com> wrote:
> Thanks for the reply!
>
> I'm actually trying to save the mean and the 5th and 95th ci values.
>
> When I try
>
> noi bootstrap y0_bs=r(mean),saving("output.dta", replace): sum y0_hold
>
> I only get the mean values saved.
>
> I tried using level(95) in my code too but that doesn't seem to work.
>
> So I'm looking to basically save the mean and ci values from my bootstrap.


On 12/19/2012 10:44 AM, Nick Cox wrote:

>> The -saving()- option of -bootstrap- is used for this purpose. It
>> wouldn't make much sense to generate variables, in the current dataset
>> as the results couldn't be aligned logically with the current
>> observations and in general the number of samples need not be the same
>> as the number of observations.

On Wed, Dec 19, 2012 at 6:36 PM, Rahber Thariani <thariani@gmail.com>

>>> I'm a noob at Stata and running into an issue extracting values from a
>>> bootstrap operation. I'm running Stata 12.
>>>
>>> I have
>>>
>>> drawnorm y1 y0, n(500) means(m) sds(sd) corr(corr)  cstorage(lower)
>>>
>>> gen d = (uniform() >0.5)
>>>   gen y = d*y1 + (1-d)*y0
>>> gen y0_hold=y if d==0
>>> noi bootstrap y0_bs=r(mean): sum y0_hold
>>> gen y1_hold=y if d==1
>>> noi  bootstrap y1_bs=r(mean): sum y1_hold
>>>
>>> I can see the results of the bootstrap on screen but don't know how to
>>> access them, and assign to a variable and then save to a file.
>>>
>>> So
>>>
>>> 1) How do I assign the different values on screen to different variables,
>>> like the co-efficient, 95% interval etc?
>>> 2) How do I save the variables to a specific file.
*
*   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