[R] Results of vcovCL (sandwich) and of cluster() in Stata

Igor Sosa Mayor joseleopoldo1792 at gmail.com
Thu Aug 3 10:14:46 CEST 2017


Hi,

I'm trying to reproduce with R the results of this study:
https://learn.gold.ac.uk/mod/resource/view.php?id=262406

More precisely I want to reproduce the results of the table 6 (pag.280),
which can also be seen here: 
http://picpaste.de/pics/table-robin-llKCOeWV.1501745645.png

Let's take the first column: we have a coeff. of 0.097 and a SE of
0.026, which represents clustered robust standard errors. If I try to
reproduce in R the analysis, I get the same coefficient, but I'm not
able to get the same SE.

The author made the stata file available here:
https://drive.google.com/file/d/0B_QoCd-1jkVXTmNDWmViWkJFdmM/edit?usp=sharing
(see: http://www.jaredcrubin.com/research)

To make the regression, he uses (as far as I can understand the stata
code) the following command:

local conditions "city != "Mainz" & city != "Wittenberg" & city != "Zürich""
reg prot1530 press if `conditions' & pop1500 != ., noconstant robust cluster(territory)

I'm trying to translate this into R-code doing the following: 

library(foreign)
library(dplyr)
library(lmtest)
library(sandwich)

# the data are here:
# https://drive.google.com/file/d/0B_QoCd-1jkVXRGdUMTlkYTNiNGc/edit?usp=sharing
cities <- read.dta("data/Printing_and_Protestants_Data-ReStat.dta")

# we filter the data
cities <- filter(cities, !is.na(pop1500))
cities <- filter(cities, city != "Zürich" & city != "Mainz" &
city != "Wittenberg")

# the model
m1 <- lm(prot1530 ~ press - 1, data = cities)
# the clustered standard errors
coeftest(m1, vcov. = vcovCL(m1, cluster=cities$territory))

I tried different types (HC1, HC2, etc), but always the value for the SE
is not the same as in the table.

Any ideas?

Many thanks in advance.

-- 
:: Igor Sosa Mayor     :: joseleopoldo1792 at gmail.com ::
:: GnuPG: 0x1C1E2890   :: http://www.gnupg.org/      ::
:: jabberid: rogorido  ::                            ::



More information about the R-help mailing list