Description Usage Arguments Details References Examples
genW
generates an spatial contiguity matrix (rook or queen)
rowStdrt
standartizes spatial contiguity matrix by rows
constructW
contructs a spatial contiguity matrix using object longitude and latitude coordinates
1 2 3 4 5 |
n |
a number of objects with spatial interaction to be arranged.See 'Details' for objects arranging principle |
type |
an optional type of spatial interaction. Currently 'rook' and ”queen' values are supported, to produce Rook and Queen Contiguity matrix. See references for more info. By default set to rook. |
seed |
an optional random number generator seed for random matrices |
W |
a spatial contiguity matrix to be standatised |
coords |
a matrix of two columns, where every row is a longitude-latitude pair of object coordinates |
labels |
a vector of object lables to mark rows and columns of the resulting contiguity matrix |
To generate spatial interaction between n
objects the function arranges them on a chess board.
A number of columns is calculated as a square root of n
, rounded to the top. The last row contains empty cells, if n is not quadratic
The function divides every element in an argument matrix by the sum of elements in its row. Some spatial estimation requires this standartisation (generally - for faster calculations)
The function contructs a spatial contiguity matrix using object longitude and latitude coordinates. Eucledean distance is currently used.
Anselin, L. (1988). Spatial Econometrics: Methods and Models. Kluwer Academic Publishers, Dordrecht, The Netherlands.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | # Completely filled 10x10 rook contiguity matrix
rookW <- genW(100)
rookW
# Partly filled 10x10 rook contiguity matrix
rookW <- genW(90)
rookW
# Completely filled 10x10 queen contiguity matrix
queenW <- genW(100, type="queen")
queenW
# Completely filled 10x10 queen contiguity matrix
queenW <- genW(100, type="queen")
queenW
# Standartisation
stQueenW <- rowStdrt(queenW)
stQueenW
data(airports)
W <- constructW(cbind(airports$lon, airports$lat),airports$ICAO_code)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.