dnb | R Documentation |
A brute force neighbor search implementation to identify observed data points within a given distance around location and time interval.
dnb(query, obs, th, future=TRUE)
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. |
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.
A vector, row numbers in the observed data matrix, that are within the given distance threshold and time lag of the query location.
For large dataset, use ANN (for spatial kriging) and Range Tree for spatiotemporal Kriging.
Dong Liang (dliang@umces.edu)
get.knn
in FNN
data(epa_cl)
coords <- c('x','y','t')
ii <- dnb(query[1,coords],obs[,coords],c(0.1,10))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.