[R] Replicating Stata's xtreg clustered SEs in R

David A. Kim
Mon, 12 Mar 2012 04:55:46 -0000

I'm trying to replicate a time-series cross-sectional analysis
(countries over years) with SEs clustered by country. ?The original
analysis was done in Stata 10 with: xtreg [DV] [IVs] fe
cluster(country).

Using plm() in R (cran.r-project.org/web/packages/plm/index.html),
I've replicated the coefficients. I sought to estimate
country-clustered SEs with vcovHC(), and tried a variety of options,
but couldn't exactly replicate the published (i.e., Stata 10's) SEs.
In R, vcovHC(x, method="arellano", type="HC1",
cluster="group") came
closest to Stata's SEs (differing at the 3rd decimal place or so).

Does anyone happen to know what method cluster() for Stata's xtreg
uses to calculate clustered SEs for panel data, and/or how this could
be implemented equivalently in R? ?Any help would be much appreciated.

Many thanks in advance,

David