GeoKriglocWeights: Compute validated local Gaussian kriging weights

View source: R/GeoKriglocWeights.R

GeoKriglocWeightsR Documentation

Compute validated local Gaussian kriging weights

Description

Given a set of spatial locations (and possibly temporal instants), the function computes local Gaussian kriging weights for each requested prediction task using a neighborhood selected from the observations. Non-Gaussian local prediction is implemented by GeoKrigloc, not by this low-level weights helper.

Usage

GeoKriglocWeights(coordx=NULL, coordy=NULL, coordz=NULL, coordt=NULL, coordx_dyn=NULL,
 corrmodel, distance="Eucl", grid=FALSE, loc, neighb=NULL,
 maxdist=NULL, maxtime=NULL, method="cholesky", model="Gaussian",
 n=1, nloc=NULL, param, anisopars=NULL,
 radius=1, sparse=FALSE, time=NULL, which=1,
 copula=NULL, X=NULL, Xloc=NULL, Mloc=NULL,parallel=FALSE,
 ncores=6, compact=FALSE)

Arguments

coordx

Numeric (d\times 2) or (d\times 3) matrix of spatial coordinates. Coordinates on a sphere are accepted (lon/lat in decimal degrees) when distance = "Sphere".

coordy

Optional numeric vector giving an additional spatial coordinate dimension. Ignored if coordx is already a matrix.

coordz

Optional numeric vector giving a third spatial coordinate dimension.

coordt

Optional numeric vector containing the temporal coordinates of the observations. If missing, a purely spatial random field is assumed. Temporal coordinates may be irregularly spaced; temporal lags are computed from the supplied coordinate values.

coordx_dyn

List of one two- or three-column observation-coordinate matrix per temporal instant. Blocks are concatenated by time; rows within each block retain their matrix order. See GeoModels-spacetime-ordering.

corrmodel

Character string naming a valid correlation model. See GeoCovmatrix for admissible choices.

distance

Character string specifying the spatial distance. Default is "Eucl" (Euclidean). See GeoFit.

grid

Logical. If TRUE, coordinates are interpreted as defining a regular grid (see GeoKrig).

loc

Numeric (n\times 2) matrix of locations for which the kriging weights are required.

neighb

Numeric; an optional positive integer indicating the order of the neighborhood.

maxdist

Numeric; an optional positive value indicating the distance in the spatial neighborhood.

maxtime

Numeric; an optional non-negative maximum temporal-distance threshold, expressed in the same units as coordt, used for the local temporal neighborhood.

method

Character string indicating the matrix factorisation used to solve the kriging system: "cholesky" (default) or "svd".

model

Character string. The validated public implementation currently requires "Gaussian" (the alias "Gauss" is accepted).

n

Integer. Number of trials for Binomial random fields (default 1).

nloc

Integer. Number of trials for the prediction locations in Binomial random fields (default 1).

param

Named list of covariance and mean parameters. See CorrParam and GeoCovmatrix.

anisopars

List with components angle and ratio defining geometric anisotropy (optional).

radius

Positive numeric value: sphere radius when coordinates are lon/lat (default 1).

sparse

Logical. If TRUE, sparse‐matrix algorithms (package spam) are employed. Only effective with compactly supported covariance functions.

time

Numeric vector giving the temporal instants for which weights are required. Values need not be equally spaced and are interpreted on the same numeric time scale as coordt. Ignored if coordt is missing.

which

Integer (1 or 2) selecting the variable whose weights are returned in the bivariate case.

copula

Must be NULL.

X

Numeric design matrix at observation locations. Fixed-location observations are ordered time then site; dynamic observations are ordered by the temporal blocks of coordx_dyn.

Xloc

Numeric design matrix at prediction tasks, ordered location then time: all requested times for the first row of loc, then all requested times for the second row, and so on.

Mloc

Numeric vector of known prediction means in the same location-major order as Xloc. Use either Mloc or Xloc, not both.

parallel

Logical; default FALSE. Set TRUE to compute independent local kriging systems in parallel where supported.

ncores

Positive integer or NULL; default 6. With parallel=TRUE, an explicit integer requests that many workers, capped by detected cores and the number of available jobs. Set ncores=NULL for automatic selection, capped at six workers and normally leaving one detected core free.

compact

Logical. If FALSE (default), each local element contains the full GeoKrigWeights result for backward compatibility. If TRUE, each non-empty element keeps only the numeric weights and neighbor_indices; this memory-saving representation is used internally by GeoSimcond(local=TRUE).

Details

The optional pair cache is bounded by getOption("GeoModels.local_pair_cache_max_bytes", 256 * 1024^2). This is a per-process budget in bytes for native cache workspace and CSR output, not a limit on total R memory. The peak during hash growth is included. A zero budget disables cache construction. If the budget or integer-index limit would be exceeded, the uncached calculation is used automatically. Each parallel worker may hold its own R objects.

Mean inputs follow GeoKrigloc. Coefficients mean, mean1, and so on correspond in order to the columns of X; an intercept-only model uses only mean. A vector param$mean is a known observation mean and is mutually exclusive with X. At local prediction tasks, use either Xloc or Mloc, not both.

For every prediction task the function builds and solves the local kriging system

\Sigma \mathbf{w} = \boldsymbol{\sigma}_0

, where \Sigma is the Gaussian covariance matrix among the selected observations and \boldsymbol{\sigma}_0 contains their covariances with the prediction location. No actual prediction is carried out; for model-specific local prediction use GeoKrigloc. Local results are returned directly rather than through temporary-file references, so their components remain available after the parallel workers have terminated.

Value

An object of class GeoKriglocWeights. Its component weights is a list ordered by prediction task. With compact=FALSE, each non-NULL element is the local result returned by GeoKrigWeights, augmented with neighbor_indices. With compact=TRUE, each non-NULL element contains only weights and neighbor_indices. An element is NULL when the requested neighborhood contains no usable observations. For purely spatial and bivariate models there is one list element per row of loc; for space-time models the order is location then requested time. The remaining components record the coordinates, model, parameters, neighborhood settings, and function call used to construct the local systems.

Spatio-temporal ordering

Observation-level rows follow time-major order. For fixed sites this is the order of c(t(data)); for dynamic sites it is the row-binding of coordx_dyn by list element. Prediction tasks follow location-major order, so rows of Xloc and elements of Mloc enumerate all requested times for the first prediction location before moving to the next location. See GeoModels-spacetime-ordering.

Author(s)

Moreno Bevilacqua, moreno.bevilacqua@uai.cl, Víctor Morales-Oñate, victor.morales@uv.cl, Christian Caamaño-Carrillo, chcaaman@ubiobio.cl

References

Gaetan, C. and Guyon, X. (2010) Spatial Statistics and Modeling. Springer-Verlag, New York.

See Also

GeoKrigloc for local kriging prediction, GeoKrigWeights for global kriging weights, GeoCovmatrix for covariance matrix construction.


GeoModels documentation built on Sept. 23, 2026, 5:07 p.m.