Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

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

Re: st: Extract Values from bootstrap operation

From   Rahber Thariani <>
Subject   Re: st: Extract Values from bootstrap operation
Date   Mon, 31 Dec 2012 18:44:26 -0800

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.

Appreciate any advice you guys can bring.



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 <> wrote:

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.


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:

*   For searches and help try:

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