## Two-way cluster robust standard error

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

cmd41
Posts: 15
Joined: Fri Apr 30, 2010 8:23 am

### Two-way cluster robust standard error

Hi,

I posted a while ago asking for instruction to estimate two-way cluster robust standard errors (i.e. clustered by BOTH cross section and period, as described in page 12 of the attached paper). Glenn kindly provided me with the answer, which I very much appreciate. I quote Glenn's answer below:

"...
In my quick reading of the paper, what you first need to do is to compute the clustering in each direction and save the covariances. That will give you V1 and V2.

Getting VI is harder since EViews doesn't offer clustering along an arbitrary dimension (we should do this at some point).

What you'll have to do is to create a new variable that indexes industry-year combinations. Then restructure your workfile page to an undated panel structured by that variable. Estimate the *same* model you estimated when you obtained V1 and V2, with White-period clustered errors (which will give you within cross-section correlation robust errors). Save the covariances as VI.

Then V1 + V2 - VI should give you the desired variance estimates.
..."

I followed the instructed procedures to estimate quite a few equations, and things seemed to run smoothly untill I had the following error message: "Log or square root of negative number in "Vector..." in one instance.

I understand that I have a negative value in the diagonal of the covariance matrix, but could not figure out why. Any help is very much appreciated!

I basically try to regress wc_ab_prod on a constant and 4 independent variables: wl_mvye_la1_dev, wc_bm_la1_dev, wc_roa_dev and jb_ov (which is dummy with value of 1 and 0). Attached is the excerp of the data and my program.

I hope I can have some feedbacks. Thanks in advance!

Chau
Attachments
jb_zero.prg
excerp.wf1
Gow et al 2009 Correct for Autocorrelation.pdf

EViews Glenn
EViews Developer
Posts: 2605
Joined: Wed Oct 15, 2008 9:17 am

### Re: Two-way cluster robust standard error

Not certain why, but your a3t is not being estimated as a panel equation.

EViews Glenn
EViews Developer
Posts: 2605
Joined: Wed Oct 15, 2008 9:17 am

### Re: Two-way cluster robust standard error

Looked at the workfile again, and I know why it's not estimating as a panel. Your joint clusters uniquely identify a single observation so that clustering is not possible within that grouping.

cmd41
Posts: 15
Joined: Fri Apr 30, 2010 8:23 am

### Re: Two-way cluster robust standard error

Hi Glenn,

First of all, thank you very much for the response.

You're absolutely right that the a3t is not estimated as a panel. However, because in this case the observations are firm-years, clustering by firm-year should produce White stadard errors (as explained in page 12 of the Gow et al's paper attached in the first post, in the last sentence of the paragraph immediately before the "Two-way cluster-robust standard errors" section). Therefore, I would expect the vi_t should not have negative values in the diagonal because in Vi_t = V1 + V2 - V3, subtracting V3 (which is the covariance matrix of my a3t equation) means only to correct for double-counting the within firm variance (please see page 7 of the Thompson's paper attached to this reply).

Therefore, after all, I am still stucked why I have negative values in the diagonal of the vi_t. I would really appreciate any further clarification.

Thanks again.

Chau
Attachments
Thompson Cluster SE.pdf

EViews Glenn
EViews Developer
Posts: 2605
Joined: Wed Oct 15, 2008 9:17 am

### Re: Two-way cluster robust standard error

A quick glance at the paper suggests that you need to compute the last model using White heteroskedasticity-robust covariances.

cmd41
Posts: 15
Joined: Fri Apr 30, 2010 8:23 am

### Re: Two-way cluster robust standard error

Thank you very much Glenn. I can confirm that I've tried the White covariance without restructuring the workfile (i.e. when the workfile is still as a dated panel), and the problem seemed to be resolved.

btims
Posts: 4
Joined: Thu Jun 16, 2011 12:27 am

### Re: Two-way cluster robust standard error

Dear Glenn,

Just checking. I have tried to apply the method applied in the Thompson paper (see earlier posting by Chau).
I have run a fixed cross-section effects OLS panel, for which I use the cov. estimation options "cxwhite" as the V1 covariance matrix; "perwhite" as V2; and "stackedwhite" as the Vl matrix.
Could you please confirm this is the correct way?
Best wishes,

Ben.

Kouvas
Posts: 34
Joined: Sat Aug 31, 2013 3:28 am

### Re: Two-way cluster robust standard error

Just a quick question regarding the two way cluster errors. In case that the estimation using cxwhite provides a warning message about estimated coefficient covariance matrix being of reduced rank should this pose a problem in the estimation of the two way cluster errors?. Thanks in advance.

Best

Kouvas

EViews Glenn
EViews Developer
Posts: 2605
Joined: Wed Oct 15, 2008 9:17 am

### Re: Two-way cluster robust standard error

It's generally the result of not having enough observations to accurately identify the clustered errors. If you don't have enough observations for one-way, that doesn't go away when you do two way.