makeneighborsw {GeoXp}R Documentation

Spatial weight matrix

Description

The function `makeneighborsw' create a spatial weight matrix based on a given number of nearest neighbors (option "neighbor" by default), based on a threshold distance (option method="distance") or both these 2 methods.

Usage

makeneighborsw(xc,yc,method="neighbor",m=1,d,cum=TRUE)

Arguments

xc a vector $x$ of size $n$
yc a vector $y$ of size $n$
method "neighbor" by default, "distance" or "both"
m number of nearest neighbors
d threshold point
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

In the case of method="neighbor", 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.

In the case of method="distance", if site $i$ is seperated from $j$ by a distance lower or equal to a given threshold :

W_{ij}=1

else

W_{ij}=0


In the case of method="both" W must verify the two first conditions.

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 (2008), ``Statistique et Econométrie pour données géoréférencées : modèles et études de cas''

See Also

moranplotmap,normw

Examples

# data auckland
data(auckland)
x.ext <- auckland$Easting[1:10]
y.ext <- auckland$Northing[1:10] 
#plot(x.ext,y.ext,type='p')
#text(x.ext,y.ext,as.character(1:10))

# matrix based on 5 nearest neighbors
W<-makeneighborsw(x.ext,y.ext,method="neighbor",m=3)

# matrix based on a threshold distance
W1<-makeneighborsw(x.ext,y.ext,method="distance",d=20)

# matrix based on the two methods
W2<-makeneighborsw(x.ext,y.ext,method="both",m=3,d=20)

[Package GeoXp version 1.3 Index]