lat2w | R Documentation |
This function creates a contiguity-based (Rook or Queen) weights matrix for a regular grid with equal number of rows and columns
lat2w(nrows=5, ncols=5, rook=TRUE)
nrows |
number of rows |
ncols |
number of columns (identical to the number of rows) |
rook |
a TRUE/FALSE option. TRUE refers to a rook contiguity and FALSE to queen contiguity |
This function may also serve in simulations.
Returns a list of neighbours for each cell of the grid as well as a weights matrix.
nbs |
a list of neighbours for each observation |
w |
a matrix of weights |
Stamatis Kalogirou <stamatis.science@gmail.com
Kalogirou, S. (2003) The Statistical Analysis and Modelling of Internal Migration Flows within England and Wales, PhD Thesis, School of Geography, Politics and Sociology, University of Newcastle upon Tyne, UK. https://theses.ncl.ac.uk/jspui/handle/10443/204
Kalogirou, S. (2015) Spatial Analysis: Methodology and Applications with R. [ebook] Athens: Hellenic Academic Libraries Link. ISBN: 978-960-603-285-1 (in Greek). https://repository.kallipos.gr/handle/11419/5029?locale=en
w.matrix
, moransI.w
, spGini.w
#rook weights matrix for a 5 by 5 grid
w.mat <- lat2w(nrows=5, ncols=5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.