[R-sig-Geo] spautolm in Spdep

Roger Bivand Roger.Bivand at nhh.no
Fri Aug 10 11:30:23 CEST 2007


On Thu, 9 Aug 2007, Kitty Lee wrote:

> Hi. I'm trying to run spatial conditional autoregression (spautolm) in 
> SPDEP. My command is simply:
>
> spautolm(vote~income, listw=listw5)
>

?spautolm

Note that the default method is method="full", you would need 
method="Matrix". Only method="full" and family="SAR" (the default, as you 
have chosen above) would permit knn spatial weights which are presumed 
asymmetric. So you cannot use these weights for CAR anyway, and 
method="Matrix" only allows symmetric weights or weights "similar to 
symmetric". You can make your weights symmetric by adding the missing 
links.

Further note that GeoDa uses a sparse approach for large N, as does 
method="Matrix", but also needs symmetric weights to perform reliably, if 
I understand correctly (see the openspace list archives).

Finally, when using "Matrix", you will need to set the interval= argument 
if you are not using style="W" (row standardisation) in creating the 
weights.

> Listw5 is a weight matrix made up by nearest 5 neighbors. I have 22000 
> cases. However, the command could not run and I got the following 
> message:
>
> Error: cannot allocate vector of size 3.6 Gb

> 22000*22000*8
[1] 3.872e+09

that is the full matrix to pass to eigen().

>
> I tried to reduce the number of neighbor to 1. But I still got the same 
> message back.
>
> I tried running spatial lag regression in GeoDa and it worked fine. I 
> wonder why the spautolm takes so much space in R? And is there another 
> spatial regression package or command that allows 22k cases?

Just reading the help page ought to be enough - if you really wanted CAR, 
you need family="CAR". But please consider whether the data need to be 
this big - are there small numbers of special cases that make the 
assumption of a global spatial process helpful? Modelling spatial 
processes is usually sensible when there is too little data (either n, or 
when there are spatially patterned unobservable variables). Voting 
outcomes tend to come with plenty of other data, don't they? Are you 
modelling a voting percentage outcome on mean/median income? What 
transformations or weightings are you using? spautolm() does provide a 
weights= argument for trying to get a handle on non-constant variance.

>
> Also....GeoDa has bivariate moran i. Is there such routine in any of the 
> R packages?

No bivariate Moran in spdep, and I'm not aware of one elsewhere. If you 
need a bivariate Moran scatterplot, try:

par(mfrow=c(2,2))
plot(x, lag(listw, x))
plot(x, lag(listw, y))
plot(y, lag(listw, x))
plot(y, lag(listw, y))
par(mfrow=c(1,1))

Roger

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

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, 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