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

Re: st: version 7 > 8 [and bstrap]


From   [email protected] (Jeff Pitblado, StataCorp LP)
To   [email protected]
Subject   Re: st: version 7 > 8 [and bstrap]
Date   Wed, 17 Mar 2004 09:00:33 -0600

"Patrick Sturgis" <[email protected]>

> This is a repeat of a message I posted toward the end of last year, which
> Nick Cox kindly helped me to resolve. However, the resolution was only
> partial as it fixed the bug in my code but I still seem to have a problem
> with running the same file successfully in version 8 (it works fine in 7).
> Here is the code:
> 
> program define alphawithin
>   version 8.0
>   if "`1'" == "?" {
>   global S_1 "alphawithin"
>   exit
>   }
>   tempname y
>   alpha bef*
>   scalar `y' = r(alpha)
>   alpha aft* 
>  post `1' (`r(alpha)'-`y')
>  end
> 
> When I run this with:	bstrap	alphawithin,	reps(10)
> 
> I get the following error message:
> 
> command ->	alphawithin
> error when	command executed	on	original	dataset
> under	version	8	control
> r(198);

The syntax for -bstrap- has changed from Stata 7 to Stata 8.  In Stata 8,
-bstrap- is a synonym for -bootstrap-.  To get -bstrap- to behave like it does
in Stata 7, use the -version- command:

	. version 7: bstrap alphawithin, reps(10)

To use the modern -bootstrap- syntax, try the following modified version of
-alphawithin-

	program myalpha, rclass
		version 8.2
		tempname y
		alpha bef*
		scalar `y' = r(alpha)
		alpha aft*
		return scalar diff = r(alpha) - `y'
	end

	. bootstrap "myalpha" alphawithin=r(diff), reps(10)

For more details on -bootstrap-, see [R] bootstrap.

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