Clustering Sd Error in Spatial Models.
Hello, I am currently working on a project estimating a spatial panel model. Because I also estimate non-spatial models I am computing the clustered standard errors following Stock and Watson (2008). I tried to do the same for my spatial models however I am running into the some errors (depending if I bootstrap or not my clustered variance-covariance matrix). Below is a reproducible example. #### Example
data(Produc, package = "plm") data(usaww) fm <- log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp fespaterr <- spml(fm, data = Produc, listw = mat2listw(usaww),
+ model="within", spatial.error="kkp")
library(lmtest) library(sandwich) vcov_test <- vcov_test <- vcovCL(fespaterr, cluster = Produc$state)
Error in UseMethod("estfun") :
no applicable method for 'estfun' applied to an object of class "splm"
vcov_boot <- vcovBS(fespaterr, cluster = Produc$state, R=250)
Error in terms.default(x) : no terms component nor attribute Error in terms.default(x) : no terms component nor attribute Error in terms.default(x) : no terms component nor attributebute ############# ### Non spatial library(lfe) fe_cluster <- felm(log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp|year+state|0|state,data=Produc)
summary(fe)
Call:
felm(formula = log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp |
year + state | 0 | state, data = Produc)
Residuals:
Min 1Q Median 3Q Max
-0.160369 -0.018026 -0.000859 0.016745 0.170752
Coefficients:
Estimate Cluster s.e. t value Pr(>|t|)
log(pcap) -0.030176 0.060042 -0.503 0.6154
log(pc) 0.168828 0.088331 1.911 0.0563 .
log(emp) 0.769306 0.087700 8.772 <2e-16 ***
unemp -0.004221 0.003294 -1.281 0.2005
---
Signif. codes: 0 ?***? 0.001 ?**? 0.01 ?*? 0.05 ?.? 0.1 ? ? 1
##########
My questions are:
1) Is it possible to cluster the variance-covariance matrix on spatial
models?
2) If so, what is the correct procedure?
Thank you for your help,
Amir
--
Amir B Ferreira Neto