View source: R/GeoNeighIndex.R
| GeoNeighIndex | R Documentation |
The function returns the indices associated with a given spatial (temporal) neighbour and/or distance. Optionally, a stochastic thinning mechanism can be applied to randomly retain only a fraction of the indices.
GeoNeighIndex(coordx, coordy=NULL, coordz=NULL, coordt=NULL,
coordx_dyn=NULL, distance="Eucl", neighb=4,
maxdist=NULL, maxtime=1, radius=1,
bivariate=FALSE, p_neighb=1, thin_method="iid")
coordx |
A numeric ( |
coordy |
A numeric vector giving 1-dimension of spatial coordinates; optional argument,
default is |
coordz |
A numeric vector giving 1-dimension of spatial coordinates; optional argument,
default is |
coordt |
A numeric vector assigning 1-dimension of temporal coordinates. Optional argument,
default is |
coordx_dyn |
A list of |
distance |
String; the name of the spatial distance. 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 maximum spatial distance; see Details. |
maxtime |
A numeric value denoting the maximum temporal distance; see Details. |
radius |
Numeric; a value indicating the radius of the sphere when using great-circle distances.
Default value is |
bivariate |
Logical; if |
p_neighb |
Numeric; a value in |
thin_method |
String; thinning scheme used when |
The function returns spatial or spatio-temporal indices of the pairs that are neighbours of a given order and/or within a given distance threshold.
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. |
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
require(GeoModels)
NN <- 400
coords <- cbind(runif(NN), runif(NN))
corrmodel <- "Matern"
scale <- 0.5/3
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, neighb=5)
data1 <- data[sel$colidx]
data2 <- data[sel$rowidx]
## plotting pairs that are neighbours of order 5
plot(data1, data2, xlab="", ylab="",
main="h-scatterplot, neighb=5")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.