Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: bootstrap problem on a user written program: insufficient observations to compute bootstrap standard errors
From
Marco Savegnago <[email protected]>
To
[email protected]
Subject
st: bootstrap problem on a user written program: insufficient observations to compute bootstrap standard errors
Date
Sat, 1 Mar 2014 12:22:39 +0100
Dear Statalisters,
I have a trouble using the bootstrap prefix.
Before resorting to Statalist, I've looked online and on textbooks for
a solution, without finding it.
Assume we want to bootstrap the difference between 2 OLS estimations
(for 2 subpopulations identified by a dummy variable) and that we
write our rclass program.
cap prog drop myprog
prog def myprog, rclass
syntax varlist(min=3 max=3 numeric)
tokenize `varlist'
qui reg `1' `2' if `3' == 0
scalar beta_0 = _b[`2']
qui reg `1' `2' if `3' == 1
scalar beta_1 = _b[`2']
scalar diffbeta = beta_1 - beta_0
disp in ye "Diff in beta between (" "`3'" " = 1) and ("
"`3'" " = 0) is " as result diffbeta
return scalar diffbeta=diffbeta
end
Let's test it and check it works:
sysuse auto, clear
myprog price mpg foreign
ret list
However, when I try to use it in bootstrap, I encounter this problem:
. bootstrap dbet = r(diffbeta): myprog price mpg foreign
(running myprog on estimation sample)
Bootstrap replications (50)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 50
insufficient observations to compute bootstrap standard errors
no results will be saved
r(2000);
Is there any suggestion to solve the problem?
I hope someone can help,
Thank you very much,
*
* For searches and help try:
* http://www.stata.com/help.cgi?search
* http://www.stata.com/support/faqs/resources/statalist-faq/
* http://www.ats.ucla.edu/stat/stata/