# [R-sig-Geo] Robust standard errors in spatial error models

Javier García javier.garcia at ehu.eus
Fri Sep 8 00:41:22 CEST 2017

```Hello everybody,

I have estimated a spatial error model by means of the lagsarlm() function.
The Breusch-Pagan test for spatial models (bptest.sarlm()) shows
heteroskedasticity evidence. I want to estimate robust standard errors, but
the functions I have looked at only work with lm type objects. In page 23 in
the spdep manual it is stated that "it is also technically possible to make
heteroskedasticity corrections to standard error estimates by using the
“lm.target” component of sarlm objects – using functions in the lmtest and
sandwich packages.", and gives an example that honestly I do not understand
(what is \$tary and \$tarX? what is the lm.target component? where are they
documented?). I have adapted the example to my case, obtaining an estimated
model with its corresponding coefficients, standard errors, etc. My question
is: is this correct? Are these standard errors already robust under
heteroskedasticity?

Best

Javi

PD: below you can see the piece of code and the generated output

reg.SLM <- lagsarlm(precio_m2~z1+z2+z3+z4+z5+z6+z7+z8+z9+z10-1,

data=datos,W_n,method="eigen",  tol.solve=1.0e-20)

lm.target <- lm(reg.SEM\$tary ~ reg.SEM\$tarX - 1)

if (require(lmtest) && require(sandwich)) {

coeftest(lm.target, vcov=vcovHC(lm.target, type="HC0"), df=Inf)

}

z test of coefficients:

Estimate Std. Error z value
Pr(>|z|)

reg.SEM\$tarXI(x - lambda * WX)z1       1489.27593  124.86303 11.9273 <
2.2e-16

reg.SEM\$tarXI(x - lambda * WX)z2       1471.24060  135.03910 10.8949 <
2.2e-16

reg.SEM\$tarXI(x - lambda * WX)z3       1646.50753  126.03324 13.0641 <
2.2e-16

reg.SEM\$tarXI(x - lambda * WX)z4       1615.11404  232.94826  6.9334
4.110e-12

reg.SEM\$tarXI(x - lambda * WX)z5       1947.56387  149.28017 13.0464 <
2.2e-16

reg.SEM\$tarXI(x - lambda * WX)z6       1903.80428  132.62287 14.3550 <
2.2e-16

reg.SEM\$tarXI(x - lambda * WX)z7       1943.40961  118.29268 16.4288 <
2.2e-16

reg.SEM\$tarXI(x - lambda * WX)z8       2576.77441  144.33295 17.8530 <
2.2e-16

reg.SEM\$tarXI(x - lambda * WX)z9       3037.47241  215.77036 14.0773 <
2.2e-16

reg.SEM\$tarXI(x - lambda * WX)z10      3976.81752  260.71406 15.2536 <
2.2e-16

reg.SEM\$tarXI(x - lambda * WX)z1       ***

reg.SEM\$tarXI(x - lambda * WX)z2       ***

reg.SEM\$tarXI(x - lambda * WX)z3       ***

reg.SEM\$tarXI(x - lambda * WX)z4       ***

reg.SEM\$tarXI(x - lambda * WX)z5       ***

reg.SEM\$tarXI(x - lambda * WX)z6       ***

reg.SEM\$tarXI(x - lambda * WX)z7       ***

reg.SEM\$tarXI(x - lambda * WX)z8       ***

reg.SEM\$tarXI(x - lambda * WX)z9       ***

reg.SEM\$tarXI(x - lambda * WX)z10      ***

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

JAVIER GARCÍA

Facultad de Economía y Empresa (Sección Sarriko)
Avda. Lehendakari Aguirre 83

48015 BILBAO
T.: +34 601 7126 F.: +34 601 3754
<http://www.ehu.es/> www.ehu.es

http://www.unibertsitate-hedakuntza.ehu.es/p268-content/es/contenidos/inform
acion/manual_id_corp/es_manual/images/firma_email_upv_euskampus_bilingue.gif

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20170908/9f5d39b0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 6359 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20170908/9f5d39b0/attachment.gif>
```