GeoKrigWeights: Compute validated Gaussian kriging weights for spatial and...

View source: R/GeoKrigWeights.R

GeoKrigWeightsR Documentation

Compute validated Gaussian kriging weights for spatial and spatio-temporal random fields

Description

Given a set of spatial locations (and possibly temporal instants), the function returns Gaussian kriging weights and the covariance quantities used to build the kriging system. Model-specific non-Gaussian prediction is provided by GeoKrig and GeoKrigloc rather than by this low-level weights helper.

Usage

GeoKrigWeights(
 coordx, coordy = NULL, coordz = NULL, coordt = NULL,
 coordx_dyn = NULL, corrmodel, distance = "Eucl",
 grid = FALSE, loc, 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)

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.

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. Copula conditional-simulation code requests these weights on the latent Gaussian scale.

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.

Details

Mean inputs follow GeoKrig. 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 prediction locations, use either Xloc or Mloc, not both.

The function builds the kriging system

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

where \Sigma is the covariance matrix between observed locations and \boldsymbol{\sigma}_0 the vector of covariances between observed and prediction locations. The solution \mathbf{w} is returned together with \Sigma and, optionally, \Sigma^{-1}. The returned weights solve the Gaussian covariance system only. Mean inputs are validated for ordering compatibility, but no non-Gaussian covariance transform is performed here. No actual prediction is carried out; for full Gaussian or non-Gaussian prediction use GeoKrig.

Value

A list containing:

weights

Numeric matrix of Gaussian kriging weights. The validated orientation is observations by prediction tasks, as recorded in weights_orientation.

weights_orientation

Character string describing the weight-matrix orientation.

covmatrix

Observed Gaussian covariance matrix.

CC

Observation–prediction Gaussian cross-covariance matrix.

model

The canonical model name (currently "Gaussian").

corrmodel

Input correlation model.

param

Parameters used to construct the Gaussian covariance matrix.

bivariate

Logical indicating a bivariate Gaussian correlation model.

spacetime

Logical indicating a space-time correlation model.

loc

Prediction locations.

tloc

Number of requested prediction times.

Xloc, Mloc, mean_obs

Normalized mean inputs retained for alignment and conditional-simulation workflows.

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

GeoKrig for full prediction, GeoKrigloc for local prediction, GeoCovmatrix for covariance model details,

Examples

library(GeoModels)
################################################################

################################################################
###
### Example 1. Spatial kriging weights for
### Gaussian random fields with Gen wendland correlation.
###
################################################################

model="Gaussian"
set.seed(79)
x = runif(300, 0, 1)
y = runif(300, 0, 1)
coords=cbind(x,y)

corrmodel = "GenWend"
mean=0; sill=5; nugget=0
scale=0.2;smooth=0;power2=4

param=list(mean=mean,sill=sill,nugget=nugget,scale=scale,smooth=smooth,power2=power2)

# Simulation of the spatial Gaussian random field:
data = GeoSim(coordx=coords, corrmodel=corrmodel,model=model,
 param=param)$data

xx=seq(0,1,0.25)
loc_to_pred=as.matrix(expand.grid(xx,xx))

W=GeoKrigWeights(,coordx=coords,loc=loc_to_pred,corrmodel=corrmodel,
 model=model,param=param)

dim(W$weights) ### kriging weights

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