GeoVariogramDir | R Documentation |
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
.
GeoVariogramDir(data, coordx, coordy = NULL, coordz = NULL,
directions = c(0, 45, 90, 135), tolerance = 22.5, numbins = 13,
maxdist = NULL, neighb = NULL, distance = "Eucl")
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: |
The function computes the empirical semivariogram for several directions by:
Selecting pairs of points within maxdist
and among the neighb
nearest neighbors using GeoNeighIndex
.
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.
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. |
GeoVariogram
, GeoNeighIndex
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.