Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: Bootstrap error


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: Bootstrap error
Date   Thu, 4 May 2006 21:16:55 +0100

The first error is a Statalist 
mistake: you appear to be using Stata 8 and not 
telling us that. 

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)

Incidentally, I am no -bootstrap- expert but 25 seems awful low 
to me. 

Also, I don't see that you need an intermediate program
here at all. -bootstrap- could call -xtabond2- directly. 

Nick 
n.j.cox@durham.ac.uk 

Carl Nelson
 
> I created the following do file to obtain bootstrapped 
> confidence intervals.
> 
> 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
> 
> bootstrap "kuznets" kuz, reps(25) cluster(countrycode) 
> idcluster(countryrs)
> 
> The result is:
> 
> command:      kuznets
> statistic:    _bs_1      = kuz
> 
> Bootstrap statistics                              Number of 
> obs    =      1980
>                                                    N of 
> clusters    =        66
>                                                    
> Replications     =        25
> 
> --------------------------------------------------------------
> ----------------
> 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);
> 
> It looks like I am only getting one replication of kuz.
> 
> I would appreciate any help identifying my error.

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