Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Robust Standard Errors in spatial error models #25

Closed
orlando-sabogal opened this issue Dec 6, 2021 · 3 comments
Closed

Robust Standard Errors in spatial error models #25

orlando-sabogal opened this issue Dec 6, 2021 · 3 comments

Comments

@orlando-sabogal
Copy link

This is probably an issue more related to the documentation.
I asked this question on stack overflow but I think it is helpful to bring it here.

I am fitting a Spatial Error Model using the errorsarlm() function in the spdep library.
The Breusch-Pagan test for spatial models, calculated using the bptest.sarlm() function, suggest the presence of heteroskedasticity.

A natural next step would be to get the robust standard error estimates and update the p-values. In the documentation of the bptest.sarlm() function says the following:

"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 the following code (as reference) is presented:

lm.target <- lm(error.col$tary ~ error.col$tarX - 1)
if (require(lmtest) && require(sandwich)) {
  print(coeftest(lm.target, vcov=vcovHC(lm.target, type="HC0"), df=Inf))} 

where error.col is the spatial error model estimated.

Now, I can easily adapt the code to my problem and get the robust standard errors.
Nevertheless, I was wondering:

  • What exactly is the “lm.target” component of sarlm objects? I can not find any mention to it in the spdep documentation.
  • What exactly are $tary and $tarX? Again, it does not seem to be mentioned on the documentation.
  • Why documentation says it is "technically possible to make heteroskedasticity corrections"? Does it mean that proposed approach is not really recommended to overcome issues of heteroskedasticity?
@rsbivand
Copy link
Member

rsbivand commented Dec 6, 2021

No, the approach is not recommended at all. Either use sphet or a Bayesian approach giving the marginal posterior distribution. I'll drop the confusing documentation. tary is $y - \rho W y$ and similarly for tarX in the spatial error model case. Note that tary etc. only occur in spdep in documentation for localmoran.exact() and localmoran.sad(); were you using out of date package versions?

@orlando-sabogal
Copy link
Author

Thanks for your fast response. I'll go with sphet.
I am using the latest version of the package.

@rsbivand
Copy link
Member

rsbivand commented Dec 6, 2021

Please also consider installing the updated development version from github rather than the otdated version on CRAN.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants