[R-sig-Geo] Plots for sarlm objects

Roger Bivand Roger.Bivand at nhh.no
Wed Mar 12 09:59:16 CET 2014


On Tue, 11 Mar 2014, Andreas Forø Tollefsen wrote:

> Hi,
>
> I wanted to ask if anyone know of particular diagnostics plot for sarlm
> objects.

Do you mean Haining-style plots (DOI: 10.1111/j.1467-9787.1994.tb00870.x) 
or others?

> In addition, it would be great to be able to plot create effect plots for
> the models fitted. Is this possible?
>

The answer is no, and more no now than before. Until a few years ago, 
lagsarlm() returned a fitted lm object from (y - \rho W y) ~ X, but it no 
longer does so (the fitted object included its fitting environment which 
made objects arbitrarily large on serialisation). You can re-create this 
with:

library(spdep)
data(oldcol)
COL.lag.eig <- lagsarlm(CRIME ~ INC + HOVAL, data=COL.OLD,
  nb2listw(COL.nb, style="W"))
lmobj <- lm(COL.lag.eig$tary ~ COL.lag.eig$tarX - 1)

but variable names, etc, are messed up. If you reconstruct them:

CRIME <- COL.lag.eig$tary
INC <- COL.lag.eig$tarX[,2]
HOVAL <- COL.lag.eig$tarX[,3]
lmobj <- lm(CRIME ~ INC + HOVAL)
library(effects)
plot(effect("INC:HOVAL", lmobj))

works, but the lm() variance-covariance of the coefficients matrix is 
wrong (omitted interaction with \rho). For errorsarlm(), the lm() 
variance-covariance is OK if the model is correctly specified. To do this 
properly would involve writing an Effect method to suit, and finding out 
how to add output components (terms?) to errorsarlm, lagsarlm and sacsarlm 
to permit them to flow through effect. The crucial thing would be to pass 
the correct variance-covariance matrix through, I think.

This is worth doing, contributions welcome!

Roger


> Thanks!
>
> Andreas
>
> 	[[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

-- 
Roger Bivand
Department of Economics, 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