Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: st: Robust Standard Errors in Paneldatasets

From   Amy Dunbar <>
To   "" <>
Subject   RE: st: Robust Standard Errors in Paneldatasets
Date   Tue, 26 Oct 2010 13:24:06 +0000

Kit Baum wrote: "None of what you have found deals with clustering."  When I followed up on Kit's -xtivreg2_ suggestion, I found the following in the help for ivreg2:

cluster(varname1 varname2) provides 2-way cluster-robust SEs and statistics as proposed by Cameron, Gelbach and
Miller (2006) and Thompson (2009).  "Two-way cluster-robust" means the SEs and statistics are robust to
arbitrary within-group correlation in two distinct non-nested categories defined by varname1 and varname2.  A
typical application would be panel data where one "category" is the panel and the other "category" is time; the
resulting SEs are robust to arbitrary within-panel autocorrelation (clustering on panel id) and to arbitrary
contemporaneous cross-panel correlation (clustering on time).  

In Petersen, Mitchell A. 2009. Estimating Standard Errors in Finance Panel Data Sets: Comparing Approaches. Review of Financial Studies 22 (1), Petersen provides a link to his web site (  On his web page he states:  "The routines currently written into Stata allow you to cluster by only one variable (e.g. one dimension such as firm or time). Papers by Thompson (2006) and by Cameron, Gelbach and Miller (2006) suggest a way to account for multiple dimensions at the same time. This approach allows for correlations among different firms in the same year and different years in the same firm, for example. See their papers and mine for more details and caveats. I have written a Stata ado file to implement this estimation procedure." 

The help file above indicates that -ivreg2- does deal with both, so I'm not sure what I am missing.  If I'm correct, -ivreg2- came out in 2008, so maybe Petersen wrote his paper before -ivreg2-, but his website doesn't mention -ivreg2-. 

Also see Gow, I., G. Ormazabal, and D. Taylor. 2010. Correcting for Cross-Sectional and Time-Series Dependence in Accounting Research. The Accounting Review 85 (2):483.  This paper references Petersen's Stata code.

It's still not clear to me when it's ok to deal with time effects (cross-sectional correlation) parametrically by including a time indicator variable and just correct for time-series dependence (serial correlation) with cluster (firm) or vice versa.  The -ivreg2- help states, "Users should be aware of the asymptotic requirements for the consistency of the chosen VCE,"   so when T is short, is the best option the parametric option?  - ivreg2- has a small sample correction option, so when would that be appropriate as opposed to including a time indicator variable? 

Thank you for considering my question.

Amy Dunbar

-----Original Message-----
From: [] On Behalf Of Christopher Baum
Sent: Tuesday, October 26, 2010 7:56 AM
Subject: Re: st: Robust Standard Errors in Paneldatasets

On Oct 26, 2010, at 2:33 AM, Leon wrote:

> Hi, I am new to Stata and try to measure herd behavior as deviations in the return dispersion of a large panel dataset. Hence, I wonder which regression type and which standard errors are most applicable as they should correct for heteroscedasticity and autocorrelation. I recently read these two articles about robust standard errors in panel datasets and can't figure out which SE I should use and in case of the clustered method how to apply this to Stata.
> Petersen, M. A. 2008. Estimating Standard Errors in Finance Panel Data Sets: Comparing Approaches. Review of Financial Studies 22:435-80.
> Driscoll, J., & Kraay, A. (1998). CONSISTENT COVARIANCE MATRIX ESTIMATION WITH SPATIALLY DEPENDENT PANEL DATA. Review of Economics & Statistics, 80(4), 549-560.
> I found various methods to apply the regression in Stata and hope you can help me to choose the right one, if any.
> * regression using Driscoll-Kraay SEs (need to install the xtscc 
> package first) xtscc depvar varlist, fe
> * regression using Newey-West SEs
> newey depvar varlist, lag('T-1') force
> * regression using White SEs
> xtreg depvar varlist, vce(robust)
> * normal panel regression
> xtreg depvar varlist, fe robust
> * found as well
> ivregress gmm depvar varlist, vce(hac nwest opt) perfect

None of what you have found deals with clustering. xtreg without the fe option is random effects, which is a.s. inappropriate for finance panels. newey and ivregress fail to take the panel nature of the data into account (in fact the ivregress command you give will not run on multiple panels, and the newey with undocumented -force- option is likely to think your data are one long time series). I would look at Schaffer's -xtivreg2-, on SSC, which will allow you to estimate a model with one-way and two-way clustering (see my BOS'10 and UKSUG 2010 presentations, on my RePEc page below). Clustering allows you to deal with arbitrary heteroskedasticity across panels and aribtrary correlation within panels. Two-way clustering also allows you to consider common effects hitting all firms at the same point in time. See the discussion of clustering in Baum/Schaffer/Stillman papers, Stata Journal 3(1) [free] and 7(4), available in preprint form on my website.


Kit Baum   |   Boston College Economics & DIW Berlin   |
                              An Introduction to Stata Programming  |
   An Introduction to Modern Econometrics Using Stata  |

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index