Thursday, January 05, 2006

Re: st: calculating robust standard errors for -xtpoisson-

Scott Cunningham <scunning@gmail.com> is interested in bootstrap standard errors from the -xtpoisson- command:

> Recently, I queried the list about the proper method of calculating > robust standard errors in -xtpoisson- to correct for overdispersion. > I think I may have found a method, which is on Colin Cameron's > website (UC-Davis). > > http://cameron.econ.ucdavis.edu/mmabook/mmaprograms.html > > Scroll down to mma23p1pannonlin.do, and you'll find in that file the > following: > > bootstrap "xtpoisson PAT LOGR $xextra, fe i(id)" "_b[LOGR]", cluster > (id) reps($nreps) level(95) > > This clusters on id, and is a luster bootstrap. Discussion of panel > robust standard errors can be found in Cameron and Trivedi's recent > book, MICROECONOMETRICS: METHODS AND APPLICATIONS, setion 23.2.6, > pp. 789-791. The .do file in question contains the code used to > generate the various bias-corrected standard errors in table 23.1 on > page 794. > > Using -xtpoisson depvar indepvar, fe i(id) vce(boostrap) - did not > provide me with the same standard error calculation, either, as what > Cameron recommended. Does anyone know what the -vce(bootstrap)- is > doing in the -xtpoisson-?

Unfortunately, there is a problem with the following call to the Stata 8 -bootstrap-:

bootstrap "xtpoisson PAT LOGR $xextra, fe i(id)" /// "_b[LOGR]", cluster(id) reps($nreps) level(95)

It is in the use of the -id- variable. When the -cluster()- option is used, -bootstrap- generates a new bootstrap dataset by randomly sampling the groups identified by the -id- variable. Suppose -id==1- is sampled twice, then the new bootstrap sample contains all the observations for which -id==1- twice. When -xtpoisson- is called to fit the model, it treats these two independently sampled copies of the panel as a single panel.

This is the reason for the -idcluster()- option. When specified, -bootstrap- recreates a variable that uniquely identifies the independently sampled panels. Here is how to bootstrap panel data using the Stata 8 -bootstrap- (with the above example):

tempvar newid gen `newid' = id bootstrap "xtpoisson PAT LOGR $xextra, fe i(`newid')" /// "_b[LOGR]", cluster(id) idcluster(`newid') reps($nreps) level(95)

Now when a panel is sampled multiple times, `newid' will identify each sampled panel uniquely so that -xtpoisson- can treat them as seperate entities.

Scott's use of the -vce(bootstrap)- option in Stata 9's -xtpoisson- does not have this problem, because -xtpoisson- handles communicating the panel information to -bootstrap- for you:

xtpoisson depvar indepvar, fe i(id) vce(bootstrap)

If you want to change the number of reps from the default to 99, use the -reps()- suboption of -vce(bootstrap)-

xtpoisson depvar indepvar, fe i(id) vce(bootstrap, reps(99))

Also, don't forget to set the random number seed so that you can reproduce your results later.

--Jeff jpitblado@stata.com * * 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/


Tag:


Links to this post:

Create a Link



<< Home

This page is powered by Blogger. Isn't yours?