| GeoVariogramDir | R Documentation |
Computes empirical semivariograms in multiple directions (e.g., 0, 45, 90, 135 degrees) to assess spatial anisotropy.
GeoVariogramDir(data, coordx, coordy = NULL, coordz = NULL,
directions = c(0, 45, 90, 135), tolerance = 22.5, numbins = 13,
maxdist = NULL, neighb = NULL, distance = "Eucl",
subsample = 1)
data |
A numeric vector containing the observed values at each location. |
coordx |
Spatial coordinates. Either a numeric vector giving the first coordinate, or a matrix with 2 (or 3) columns.
If a matrix is provided, |
coordy |
A numeric vector of the second coordinate. Optional; defaults to |
coordz |
A numeric vector of the third coordinate (if needed). Optional; defaults to |
directions |
Numeric vector giving the principal directions (in degrees) for which the semivariogram is computed
(default: |
tolerance |
Angular tolerance (in degrees) around each direction (default: 22.5). |
numbins |
Number of distance bins for the empirical semivariogram (default: 13). |
maxdist |
Maximum spatial distance to consider between pairs. If |
neighb |
Number of nearest neighbors to use for each location. If |
distance |
Type of distance metric to use (default: |
subsample |
Numeric in |
The function computes empirical semivariograms for several directions by:
Selecting pairs of points within maxdist and among the neighb nearest neighbors using
GeoNeighIndex.
Computing squared differences for each selected pair.
Assigning each pair to a directional class if the vector connecting the pair falls within the specified angular tolerance around a given direction.
Binning pairs by distance and computing the average squared difference (semivariogram) within each bin.
The direction is defined in the xy-plane even in 3D. For 2D data, set coordz = NULL.
The subsample argument can be used to reduce computational cost by randomly selecting a subset of
spatial locations prior to pair construction. This is particularly useful for large datasets.
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 <- 2500
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,
subsample = 0.5)
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.