This site contains additional analyses and portions of the code used in the paper Correcting for Cross-Sectional and Time-Series Dependence in Accounting Research by Ian Gow, Gaizka Ormazabal and Daniel Taylor.

SAS code

This macro produces two-way cluster-robust standard errors using SAS. See below for code illustrating its use and discussion of how to produce two-way cluster-robust standard errors using other packages.

R code

This R code includes a function coeftest.cluster which can be applied to an existing model fit to return table output based on two-way cluster-robust standard errors. See here for code illustrating its use against data from Mitchell Petersen's website. This code was adapted from code provided by Mahmood Arai.

Matlab routines and simulation code

As part of our simulations, we developed a number of general purpose econometric routines. Details on these are provided here. To run the simulation you need access to Matlab and the files contained here (further instructions are included in the file).

Test code and data sets

Cost of capital pseudo-data: To illustrate the use of two-way cluster-robust standard errors in popular packages, we provide pseudo-data sets for our second application on the cost of capital in Stata, SAS and Matlab formats (to respect others' copyright, the data are fabricated, only the variable labels are retained from our analysis).

This file illustrates the application of two-way cluster-robust standard errors in Matlab. This file contains code to do the same in SAS using our macro (here is the output). This file illustrates two-way clustering in Stata using the cluster2.ado macro from Mitchell Petersen's site.

Last updated: April 25, 2008