makeneighborsw {GeoXp} | R Documentation |
The function `makeneighborsw' creates a spatial weight matrix based on a given number of nearest neighbors.
makeneighborsw(xc, yc, m, cum = TRUE)
xc |
a vector $x$ of size $n$ |
yc |
a vector $y$ of size $n$ |
m |
number of nearest neighbors |
cum |
if cum=TRUE, $W$ is the sum of spatial weight matrix based on $k$ nearest neighbours (for $k <=q m$; if FALSE $W$ is the spatial weight matrix based only on $m^{th}$ nearest neighbours |
For each site, we order the other sites by their distance from this site. If cum=TRUE, for $i$, if $j$ is among the $m^{th}$ nearest sites, then :
W_{ij}=1
else
W_{ij}=0
If cum=FALSE, for $s_i$, if $s_j$ is the $m^{th}$ nearest site, then :
W_{ij}=1
else
W_{ij}=0
In case of ties, the nearest neighbour is randomly chosen.
A spatial weight matrix of size $n times n$
Aragon Y., Thomas-Agnan C., Ruiz-Gazen A., Laurent T., Robidou L.
Aragon Yves, Perrin Olivier, Ruiz-Gazen Anne, Thomas-Agnan Christine (2008), ``Statistique et Econométrie pour données géoréférencées : modèles et études de cas''
moranplotmap
,findneighbors
,makedistancew
,normw
# data auckland data(auckland) W<-makeneighborsw(auckland$Easting,auckland$Northing,5)