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

Re: st: bootstrap program problem


From   [email protected] (Jeff Pitblado, StataCorp LP)
To   [email protected]
Subject   Re: st: bootstrap program problem
Date   Thu, 27 Oct 2005 22:42:52 -0500

Fred Wolfe <[email protected]> has a user written command that
uses the -bootstrap- prefix on another user written command:

> I have written a program to calculate differences between categories using 
> bootstrap.
> 
> . ndbdifference sex ,by(ra) seed(1) reps(25)
> (output omitted)
>
> The program works as directed.
> 
> The code is:
> 
> program define ndbdifference
>     version 9.0
>     syntax varlist [if] [in] ,by(varname) [seed(real -1) Reverse reps(real 
> 100)]
>     marksample touse, novarlist
>     if "`seed'" != "-1" {
>        set seed `seed'
>     }
>     foreach var of varlist `varlist' {
>        preserve
>        qui keep if `touse'
>        keep `var' `by'
>        qui keep if !mi(`var',`by')
>        bootstrap `"`var'_b"'=r(dif), ///
>        reps(`reps') nowarn nodots nolegend  title(Difference between `by' 
> categories)  ///
>        : difference `var',by(`by') `reverse'
>        restore
>     }
> 
> end
>
> (omitted the rest)

Fred then points out that he changed the line

        bootstrap `"`var'_b"'=r(dif), ///

to

        bootstrap `var'_b=r(dif), ///

which conforms to the grammar for expression lists that -bootstrap- accepts;
see -help exp_list-.  Those quote marks can confuse the expression list
parser.

Unfortunately, that didn't entirely solve Fred's problem because he got
the following error message when he added the -bca- option to -bootstrap-

	name sex_b already specified

This error message resulted after -jackknife- finished estimating the
acceleration.

Fred found a bug in -bootstrap-.  The bug fix will be available in the next
ado-file update.

--Jeff
[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