| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: RE: Bootstrap error
At 03:16 PM 5/4/2006, you wrote:
The first error is a Statalist
mistake: you appear to be using Stata 8 and not
telling us that.
My apologies. I am using Stata 9, but I am using the Stata 8 bootstrap syntax
More seriously, in your program [not "do file"]
program kuznets, rclass
args lnSEC lnGDPC lnGDPC2
tsset countrycode year
xtabond2 lnSEC l1.lnSEC lnGDPC lnGDPC2, gmm(l1.lnSEC) ///
iv(lnGDPC lnGDPC2)
gen kuz = exp(-_coef[lnGDPC]/(2*_coef[lnGDPC2]))
return scalar x1 = kuz
end
You do nothing with the results of -args-, so that can go.
I doubt you need to -tsset- every time, but you'd need to
check that.
There is no need to put a constant in a variable. It's poor style.
So, this looks more like
program kuznets, rclass
tsset countrycode year
xtabond2 lnSEC l1.lnSEC lnGDPC lnGDPC2, gmm(l1.lnSEC) ///
iv(lnGDPC lnGDPC2)
return scalar x1 = exp(-_coef[lnGDPC]/(2*_coef[lnGDPC2]))
end
Now what -bootstrap- should pick up is r(x1):
So your call should be more like
bootstrap "kuznets" r(x1), reps(25) cluster(countrycode)
idcluster(countryrs)
I tried the suggested change and obtained the following result:
do leekuznets
. tsset countrycode year
panel variable: countrycode, 1 to 66
time variable: year, 1960 to 1990
. program kuznets, rclass
1. args lnSEC lnGDPC lnGDPC2
2. xtabond2 lnSEC l1.lnSEC lnGDPC lnGDPC2, gmm(l1.lnSEC)
iv(lnGDPC lnGDPC2)
3. return scalar x1 = exp(-_coef[lnGDPC]/(2*_coef[lnGDPC2]))
4. end
.
. bootstrap "kuznets" r(x1), reps(200) cluster(countrycode) idcluster(newid)
command: kuznets
statistic: _bs_1 = r(x1)
Bootstrap statistics Number of obs = 1980
N of clusters = 66
Replications = 200
------------------------------------------------------------------------------
Variable | Reps Observed Bias Std. Err. [95% Conf. Interval]
-------------+----------------------------------------------------------------
_bs_1 | 0 42843.02 . . . . (N)
| . . (P)
| . . (BC)
------------------------------------------------------------------------------
Note: N = normal
P = percentile
BC = bias-corrected
insufficient observations to compute bootstrap standard errors
no results will be saved
r(2000);
which is no change from my previous result.
And the direct call to bootstrap produces the following, which is the
reason that I wrote the intermediate program.
bootstrap x1=exp(-_coef[lnGDPC]/(2*_coef[lnGDPC2])), reps(200)
cluster(countrycode) idclu
> ster(newid) : xtabond2 lnSEC l1.lnSEC lnGDPC lnGDPC2,
gmm(l1.lnSEC) iv(lnGDPC lnGDPC2)
(running xtabond2 on estimation sample)
Bootstrap replications (200)
----+--- 1 ---+--- 2 ---+--- 3 ---+--- 4 ---+--- 5
repeated time values within panel
the most likely cause for this error is misspecifying the cluster(),
idcluster(), or
group() option
The low number of replications is just a test to get the code working.
Carl Nelson
*
* 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/