[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: Problems with -bs- command
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.
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)
use centile1, clear
di in wh _n "Test program myprog"
di in wh "Now use it for bootstrap"
set seed 35435141
bs "myprog" "r(m1)", reps(50)
bs "myprog" "r(m1)", reps(1000)
* Resulting output
. * Test program myprog"
r(mean) = 34.544
. ret li
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)
statistics: r(m1) r(m2) r(m2_m1)
error in statistic: r(m1)
* For searches and help try: