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

st: Problems with -bs- command


From   "Paul Seed" <[email protected]>
To   <[email protected]>
Subject   st: Problems with -bs- command
Date   Wed, 7 Aug 2002 17:00:52 +0100

Dear all,

I am interested in a bootstrapped confidence interval for the
difference between two means, and to save time
wish to work out the means using -summ, meanonly-.

I have written a Stata program to do this, which runs perfectly well
on it's own.  However, when trying to get -bs- to work out the confidence
intervals, I get an unexplained error message.

Any thoughts on wher ethe problem lies, greatly appreciated.

* Commands
cap prog drop myprog
prog define myprog, rclass
	summ centile if aps, mean
	di "r(mean) = " r(mean)
	local m1 = r(mean)
	return local m1 = r(mean)
	summ centile if control, mean
	return local m2 = r(mean)
	return local m2_m1 = `m1' - r(mean)
end myprog

	use centile1, clear
	note

	di in wh _n "Test program myprog"
	myprog
	ret li

	di in wh "Now use it for bootstrap"
	set seed 35435141
	bs "myprog" "r(m1)", reps(50)
pause
	bs "myprog" "r(m1)", reps(1000)

* Resulting output

. * Test program myprog"
.         myprog
r(mean) = 34.544

.         ret li

macros:
             r(m2_m1) : "13.66652601350295"
                r(m2) : "48.21052629579054"
                r(m1) : "34.5440002822876"

.
. * Now use it for bootstrap"
.         set seed 35435141

.         bs "myprog" "r(m1) r(m2) r(m2_m1)", reps(50)

command:     myprog
statistics:  r(m1) r(m2) r(m2_m1)
error in statistic: r(m1)
r(198);

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