nsDist3d: Calculate coordinate-specific distance matrices, only for...

Description Usage Arguments Value Examples

View source: R/core.R

Description

nsDist3d generates and returns new 3-dimensional arrays containing the former dist1_sq, dist2_sq, and dist12 matrices, but only as needed for the k nearest-neighbors of each location. these 3D matrices (dist1_3d, dist2_3d, and dist12_3d) are used in the new implementation of calculateAD_ns().

Usage

1
nsDist3d(coords, nID, scale_factor = NULL, isotropic = FALSE)

Arguments

coords

N x 2 matrix; contains the x-y coordinates of stations.

nID

N x k matrix; contains indices of nearest neighbors.

scale_factor

Scalar; optional argument for re-scaling the distances.

isotropic

Logical; indicates whether distances should be calculated separately for each coordinate dimension (FALSE) or simultaneously for all coordinate dimensions (TRUE). isotropic = TRUE can only be used for two-dimensional coordinate systems.

Value

Arrays with nearest neighbor distances in each coordinate direction.

Examples

1
2
3
4
5
# Generate some coordinates and neighbors
coords <- cbind(runif(100),runif(100))
nID <- determineNeighbors(coords, 10)
# Calculate distances
nsDist3d(coords, nID)

BayesNSGP documentation built on Jan. 9, 2022, 9:07 a.m.