[R-sig-Geo] heteroskedasticity corrections for lagsarlm() in spdep
Roger Bivand
Roger.Bivand at nhh.no
Fri Oct 21 17:31:37 CEST 2011
On Fri, 21 Oct 2011, Marco Helbich wrote:
> Dear list,
>
> I have estimate a spatial simultaneous autoregressive lag model by means
> of the lagsarlm() function in the spdep package. The Breusch-Pagan test
> for spatial models bptest.sarlm() shows that there are some problems
> with heteroskedasticity.
>
> On p. 21 in the spdep manual states 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."
>
> First I thought the code below could be the solution, but it fails. I
> have slightly adapted the code (lagsarlm instead of errorsarlm) on page 21.
>
> data(oldcol)
> example <- lagsarlm(CRIME ~ INC + HOVAL, data=COL.OLD, nb2listw(COL.nb,
> style="W"))
>
> lm.target <- lm(example$tary ~ example$tarX - 1)
> if (require(lmtest) && require(sandwich)) {
> coeftest(lm.target, vcov=vcovHC(lm.target, type="HC0"), df=Inf)
> }
>
> I am sure anyone has already done this. I would appreciate every hint or
> piece of code (and sorry if this is nonsense).
But your code works? Could you please be more specific about what doesn't
work, the exact error message, the output of traceback() after the
message, and of sessionInfo()? Of course, for the spatial lag model, this
is really not OK, because of interaction between the covariance of rho and
the betas. For the spatial error model, they do not interact, and the beta
covariance matrix block is the same in OLS on the transformed covariates
and ML.
Roger
>
> Thank you in advance!
> Best
> Marco
>
>
--
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no
More information about the R-sig-Geo
mailing list