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 (d \times 2)-matrix (where d is the number of spatial sites) assigning 2-dimensions of spatial coordinates or a numeric d-dimensional vector assigning 1-dimension of spatial coordinates. Coordinates on a sphere for a fixed radius radius are passed in lon/lat format expressed in decimal degrees.

coordy

A numeric vector assigning 1-dimension of spatial coordinates; coordy is interpreted only if coordx is a numeric vector or grid=TRUE otherwise it will be ignored. Optional argument, the default is NULL then coordx is expected to be numeric a (d \times 2)-matrix.

coordt

A numeric vector assigning 1-dimension of temporal coordinates. Optional argument, the default is NULL then a spatial random field is expected.

coordx_dyn

A list of m numeric (d_t \times 2)-matrices containing dynamical (in time) spatial coordinates. Optional argument, the default is NULL

distance

String; the name of the spatial distance. The default is Eucl, the euclidean distance. See the Section Details of GeoFit.

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 FALSE (the default) the data are interpreted as univariate spatial or spatial-temporal realisations. Otherwise they are intrepreted as a a realization from a bivariate field.

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


[Package GeoModels version 2.0.1 Index]