dnb: Search Neighbours in Time and Space Within Specified Ranges

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/dnb.R

Description

A brute force neighbor search implementation to identify observed data points within a given distance around location and time interval.

Usage

1
dnb(query, obs, th, future=TRUE)

Arguments

query

a vector; the x, y coordinates and the time stamp of the query point

obs

a matrix; the x, y coordinates and time stamps of the spatiotemporal locations

th

a vector; the distance threshold and time lag

future

logical, whether include observed spatiotemporal points future in time relative to the query spatiotemporal location.

Details

Implementation involves first calculating the time lags between query point and observed data (with locational coordinates and time); for observed locations within time lag of query, the function calculates the Euclidean distances between query location and all potential neighbors and select those within specified distance threshold.

The future argument can be used to exclude data in the future in neighbor search. This is useful in an extrapolation application.

Value

A vector, row numbers in the observed data matrix, that are within the given distance threshold and time lag of the query location.

Note

For large dataset, use ANN (for spatial kriging) and Range Tree for spatiotemporal Kriging.

Author(s)

Dong Liang ([email protected])

See Also

get.knn in FNN

Examples

1
2
3
data(epa_cl)
coords <- c('x','y','t')
ii <- dnb(query[1,coords],obs[,coords],c(0.1,10))

ltsk documentation built on July 28, 2018, 1:06 a.m.