[R-sig-Geo] nb2listw zero.policy

Roger Bivand Roger.Bivand at nhh.no
Sat Sep 12 11:26:19 CEST 2009


On Fri, 11 Sep 2009, Kitty Lee wrote:

> I tried to use nb2listw to create a weight matrix for spautolm. There 
> are 3 cases with no neighbors. I tried to set zero.policy=TRUE but 
> apparently that function doesn't work---I got the error message and I 
> also can't use the object created in spautolm.

zero.policy=TRUE does not propagate, so you need:

print(adjwt, zero.policy=TRUE)

and the same in any function using the listw object (to rub in the point 
that no-neighbour objects are probably not a good idea). Maybe it should 
propagate, but that won't happen before the listw class is re-designed.

Hope this helps,

Roger

>
> Any ideas?
>
> Thanks!
>
>
> adj1<-poly2nb(datashp)
>> adjwt<-nb2listw(adj1, zero.policy=TRUE)
>> adjwt
> Characteristics of weights list object:
> Neighbour list object:
> Number of regions: 2173
> Number of nonzero links: 11918
> Percentage nonzero weights: 0.2523968
> Average number of links: 5.484584
> 3 regions with no links:
> 281 1081 1096
>
> Weights style: W
> Weights constants summary:
> Error in spweights.constants(x, zero.policy = zero.policy) :
>  regions with no neighbours found
> Error in print(data.frame(rbind(unlist(spweights.constants(x, zero.policy = zero.policy))[c(1,  :
>  error in evaluating the argument 'x' in selecting a method for function 'print'
>
> _______________________________________________
> 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