[R-sig-Geo] how to get the values for corresponding neighbors
Roger Bivand
Roger.Bivand at nhh.no
Tue May 4 20:38:27 CEST 2010
On Tue, 4 May 2010, rusers.sh wrote:
> Hi there,
> Take the data of columbus(spdep) as an example. Say ?i? is one of the
> polygons, and ?j? represents its neighbours. How to get the vlues of
> ?sum(Wij*Xj)?? ?Wij? means the weights, which can be get by
> ?nb2listw$weights?.
> Say ?Xj? to be ?columbus$PLUMB?. The problem is how to get the right values
> of ?columbus$PLUMB? for the corresponding neighbours, so i can calculate the
> "sum(Wij*Xj)"? See the following example.
> example(columbus);coords <- coordinates(columbus)
> nbs <- dnearneigh(coords,0,4)
> nbslistw<-nb2listw(nbs, style="B")
> #nbslistw$neighbours; nbslistw$weights
> I can not figure it out. Anybody can give me some suggestions?
lag(nbslistw, x)
?lag.listw
HTH
Roger
> Thanks.
>
>
--
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