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

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


From   "Patrick Sturgis" <p.sturgis@surrey.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: st: version 7 > 8 [and bstrap]
Date   Wed, 17 Mar 2004 16:06:07 -0000

Jeff

I'll go with the first suggestion (for now). Many thanks,

Patrick 

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Jeff Pitblado,
StataCorp LP
Sent: 17 March 2004 15:01
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: version 7 > 8 [and bstrap]

"Patrick Sturgis" <p.sturgis@surrey.ac.uk>

> 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
jpitblado@stata.com
*
*   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/

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index