# util-misc: Standard spatial contiguity matrixes In spfrontier: Spatial Stochastic Frontier Models

## Description

`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

## Usage

 ```1 2 3 4 5``` ```genW(n, type = "rook", seed = NULL) rowStdrt(W) constructW(coords, labels) ```

## Arguments

 `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

## Details

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.

## References

Anselin, L. (1988). Spatial Econometrics: Methods and Models. Kluwer Academic Publishers, Dordrecht, The Netherlands.

## Examples

 ``` 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) ```

spfrontier documentation built on Dec. 19, 2019, 1:09 a.m.