GeoNeighIndex {GeoModels} | R Documentation |
Spatial or spatiotemporal near neighbour indices.
Description
The function returns the indices associated with a given spatial (temporal) neighbour and/or distance
Usage
GeoNeighIndex(coordx,coordy=NULL,coordx_dyn=NULL,
coordt=NULL,distance="Eucl",neighb=4,maxdist=NULL,
maxtime=1,radius=6371,bivariate=FALSE)
Arguments
coordx |
A numeric ( |
coordy |
A numeric vector assigning 1-dimension of
spatial coordinates; |
coordt |
A numeric vector assigning 1-dimension of
temporal coordinates. Optional argument, the default is |
coordx_dyn |
A list of |
distance |
String; the name of the spatial distance. The default
is |
neighb |
Numeric; an optional (vector of) positive integer indicating the order of neighborhood. See the Section Details for more information. |
maxdist |
A numeric value denoting the spatial distance Details. |
maxtime |
A numeric value denoting the temporal distance Details. |
radius |
Numeric; a value indicating the radius of the sphere when using the great circle distance. Default value is the radius of the earth in Km (i.e. 6371) |
bivariate |
Logical; if |
Details
The function returns the spatial or spatiotemporal indices of the pairs tha are neighboords of a certain order and/or with a certain fixed distance
Value
Returns a list containing the following components:
colidx |
First vector of indices |
rowidx |
Second vector of indices |
lags |
Vector of spatial distances |
lagt |
Vector of temporal distances |
Author(s)
Moreno Bevilacqua, moreno.bevilacqua89@gmail.com,https://sites.google.com/view/moreno-bevilacqua/home, Víctor Morales Oñate, victor.morales@uv.cl, https://sites.google.com/site/moralesonatevictor/, Christian", Caamaño-Carrillo, chcaaman@ubiobio.cl,https://www.researchgate.net/profile/Christian-Caamano
Examples
require(GeoModels)
NN = 400
coords = cbind(runif(NN),runif(NN))
scale=0.5/3
param = list(mean=0,sill=1,nugget=0,scale=0.5/3,smooth=0.5)
corrmodel = "Matern";
param = list(mean=0,sill=1,nugget=0,scale=scale,smooth=0.5)
set.seed(951)
data = GeoSim(coordx = coords,corrmodel = corrmodel,
model = "Gaussian",param = param)$data
sel=GeoNeighIndex(coordx=coords,maxdist=0.05)
data1=data[sel$colidx]; data2=data[sel$rowidx]
## plotting pairs that are neighboord of order 5
plot(data1,data2,xlab="",ylab="",main="h-scatterplot, dist=0.05")