Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

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

From (Jeff Pitblado, StataCorp LP)
Subject   Re: st: calculating robust standard errors for -xtpoisson-
Date   Thu, 05 Jan 2006 15:08:05 -0600

Scott Cunningham <> 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).
> Scroll down to, 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  
> 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 "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)

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.

*   For searches and help try:

© Copyright 1996–2021 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index