Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: How many statistics can be bootstrapped by one program?


From   [email protected] (William Gould)
To   [email protected]
Subject   Re: st: How many statistics can be bootstrapped by one program?
Date   Mon, 19 Aug 2002 08:05:36 -0500

Olena Stavrunova <[email protected]> writes, 

> I need to bootstrap [...] 5 statistics [...].  [...] I have no luck in
> obtaining bootstrap estimates for the number of statistics larger than 4.  I
> use the following program, which works fine for 4 statistics :
>
>       program define jobflo
>               version 6.0
>               [...]
>       end
>
> However, if I add one more statistic for calculation so that the program
> looks like:
>
>       program define jobflo1
>               version 6.0
>               [...]
>               local tf`i' = `gh`i'' - 'jk`i''
>               [...]
>               post `1' `gh1998' `jk1998'  `tf1998' `gh1999' `jk1999' `tf1998'
>       end

There are two problems.

The first is with the line 

>               local tf`i' = `gh`i'' - 'jk`i''
                                        ^
                                        |
                            should be `, not '

More important is how I found it, which was to run the program with 
-set trace on-.

The second problem has not bitten Olena yet and perhaps it never will, but 
better to be safe.  It concerns the line 

>    post `1' `gh1998' `jk1998'  `tf1998' `gh1999' `jk1999' `tf1998'

I recommend Olena change the line to read, 

     post `1' (`gh1998') (`jk1998') (`tf1998') (`gh1999') (`jk1999') (`tf1998')

Stata 7 would require that line look like I have just retyped it, but Olena is
using Stata 6 (or perhaps using Stata 7 in Stata-6 compatability mode).

`gh1998', `jk1998', `tf1998', `gh1999', `jk1999', and `tf1998' are all macros,
meaning each substitutes to the number itself.  So, 

>    post `1' `gh1998' `jk1998'  `tf1998' `gh1999' `jk1999' `tf1998'

might become 

>    post `1' 12 15.2 -17 3.25 9.1 11.7

Note the negative 17 in the middle.  -post- will think it sees

>    post `1' 12 (15.2-17) 3.25 9.1 11.7

and then complain that too few values were specified.  This is avoided by 
binding each number in parentheses ourselves; 

     post `1' (`gh1998') (`jk1998') (`tf1998') (`gh1999') (`jk1999') (`tf1998')

becomes 

     post `1' (12) (15.2) (-17) (3.25) (9.1) (11.7)

and -post- cannot become confused.

If Olena were using Stata 7, it would have forced her to use the safer syntax.

-- Bill
[email protected]
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index