GeoVariogramDir {GeoModels} | R Documentation |
Empirical Directional Semivariogram
Description
Computes the empirical semivariogram in multiple directions (e.g., 0, 45, 90, 135 degrees) to assess spatial anisotropy, using only relevant pairs of points selected using maxdist
and
neighb
through GeoNeighIndex
.
Usage
GeoVariogramDir(data, coordx, coordy = NULL, coordz = NULL,
directions = c(0, 45, 90, 135), tolerance = 22.5, numbins = 13,
maxdist = NULL, neighb = NULL, distance = "Eucl")
Arguments
data |
A numeric vector containing the observed values at each location. |
coordx |
A numeric vector or matrix of the x-coordinates of the locations. If a matrix with 2 or 3 columns is provided, |
coordy |
A numeric vector of the y-coordinates of the locations. Optional; defaults to |
coordz |
A numeric vector of the z-coordinates of the locations. Optional; defaults to |
directions |
A numeric vector giving the principal directions (in degrees) for which to compute the semivariogram (default: |
tolerance |
Angular tolerance (in degrees) for each direction (default: 22.5). |
numbins |
Number of distance bins for the empirical semivariogram (default: 13). |
maxdist |
Maximum distance to consider between pairs (default: |
neighb |
Number of nearest neighbors to use for each location (default: |
distance |
Type of distance metric to use (default: |
Details
The function computes the empirical semivariogram for several directions by:
Selecting pairs of points within
maxdist
and among theneighb
nearest neighbors usingGeoNeighIndex
.Calculating the squared differences for each pair.
Assigning each pair to a directional bin if the vector connecting the pair falls within the specified angular tolerance of a given direction.
Binning the pairs by distance and computing the average squared difference (semivariogram) for each bin.
The direction is defined in the xy-plane even in 3D. For 2D data, set coordz = NULL
.
This implementation is optimized: distance bins and directional masks are precomputed for all pairs, minimizing repeated computations for each direction.
Value
A list of class "GeoVariogramDir"
with one element for each direction. Each element is a list with components:
centers |
Centers of the distance bins. |
gamma |
Empirical semivariogram values for each bin. |
npairs |
Number of point pairs in each bin. |
See Also
Examples
require(GeoModels)
set.seed(960)
NN <- 1500
coords <- cbind(runif(NN), runif(NN))
scale <- 0.5/3
param <- list(mean = 0, sill = 1, nugget = 0, scale = scale, smooth = 0.5)
corrmodel <- "Matern"
set.seed(951)
data <- GeoSim(coordx = coords, corrmodel = corrmodel,
model = "Gaussian", param = param)$data
vario_dir <- GeoVariogramDir(data = data, coordx = coords, maxdist = 0.4)
plot(vario_dir,ylim=c(0,1))