# RE: st: boostrap with stata

 From "Roys, Nicolas A." To Subject RE: st: boostrap with stata Date Thu, 18 Aug 2005 14:04:17 -0400

```You wrote :

-----------------------------------------------------------------------------------------
From: owner-statalist@hsphsun2.harvard.edu on behalf of Timothy.Mak@iop.kcl.ac.uk
Sent: Thu 8/18/2005 8:39 AM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: boostrap with stata (elementary question)
Hi,
To me, It seems what Nicholas Roys wanted was:
Var(estSD(ice)/estSD(ich))
whereas Clive gave the procedure to give:
Var(ice/ich)
I think to calculate the former result, you need to write your own
program.
Tim

-----------------------------------------------------------------

Tim is right I want Var(estSD(ice)/estSD(ich))
"writing my own program" is probably the solution. I try to use this one :
program ratio, rclass
version 8.0
summarize ice
local ice = r(sd)
summarize ich
local ich = r(sd)
return ratio = `ice'/`ich'
end
Then, I write :
bootstrap "ratio" r(ratio), reps(1000)
but It doesn't work, stata saying :
command -> ratio
error when command executed on original dataset under version 8 control
r(198);

if anybody has a suggestion...
nicolas

"Clive Nicholas" <Clive.Nicholas@newcastle.ac.uk>
Sent by: owner-statalist@hsphsun2.harvard.edu
18/08/2005 12:33
statalist@hsphsun2.harvard.edu

To
statalist@hsphsun2.harvard.edu
cc

Subject
Re: st: boostrap with stata (elementary question)

Nicolas A. Roys wrote:

> I want to bootstrap the variance of the standard deviation of "ice" and
> the standard deviation of "ich"
> so I think the stata command is simply :
> bs "summarize ice, detail" "r(sd)", rep(1000)
> bs "summarize ich, detail" "r(sd)", rep(1000)
> but how can I can bootstrap the variance of the ratio
> standard deviation of "ice" divided by standard deviation of "ich" ?

Perhaps I'm missing something obvious, but I don't see the need for any
further -bootstrap-ping. All I think you need do is the following:

(1) -generate- a new variable for the ratio of ("ice"/"ich");
(2) *then* -summarize- that variable: since it gives the standard
deviation, all you need do is square it to get the variance of that
ratio.

By the way, as Nick Cox has counselled to the list on various occasions,
it's not a bright idea to say that you're asking an 'elementary' question
to Statalist. Such posts often get deleted on sight, because it suggests
that the answer is also elementary, indeed so elementary that you didn't
really need to ask the list in the first place!

Hope that helps.

CLIVE NICHOLAS        |t: 0(044)7903 397793
Politics              |e: clive.nicholas@ncl.ac.uk
Newcastle University  |http://www.ncl.ac.uk/geps <http://www.ncl.ac.uk/geps>

Whereever you go and whatever you do, just remember this. No matter how
many like you, admire you, love you or adore you, the number of people
turning up to your funeral will be largely determined by local weather
conditions.

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html <http://www.stata.com/support/faqs/res/findit.html>
*   http://www.stata.com/support/statalist/faq <http://www.stata.com/support/statalist/faq>
*   http://www.ats.ucla.edu/stat/stata/ <http://www.ats.ucla.edu/stat/stata/>

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html <http://www.stata.com/support/faqs/res/findit.html>
*   http://www.stata.com/support/statalist/faq <http://www.stata.com/support/statalist/faq>
*   http://www.ats.ucla.edu/stat/stata/ <http://www.ats.ucla.edu/stat/stata/>

```

<<winmail.dat>>