makeneighborsw {GeoXp}R Documentation

Spatial weight matrix based on nearest neighbors

Description

The function `makeneighborsw' creates a spatial weight matrix based on a given number of nearest neighbors.

Usage

makeneighborsw(xc, yc, m, cum = TRUE)

Arguments

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

Details

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.

Value

A spatial weight matrix of size $n times n$

Author(s)

Aragon Y., Thomas-Agnan C., Ruiz-Gazen A., Laurent T., Robidou L.

References

Aragon Yves, Perrin Olivier, Ruiz-Gazen Anne, Thomas-Agnan Christine (2006), ``Statistique et Econométrie pour données géoréférencées : modèles et études de cas''

See Also

moranplotmap,findneighbors,makedistanceW,normw

Examples

# data auckland
data(auckland)
W<-makeneighborsw(auckland$Easting,auckland$Northing,5)

[Package GeoXp version 1.0 Index]