View source: R/GeoKrigWeights.R
| GeoKrigWeights | R Documentation |
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.
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)
coordx |
Numeric ( |
coordy |
Optional numeric vector giving an additional spatial coordinate
dimension. Ignored if |
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 |
corrmodel |
Character string naming a valid correlation model.
See |
distance |
Character string specifying the spatial distance.
Default is |
grid |
Logical. If |
loc |
Numeric ( |
method |
Character string indicating the matrix factorisation
used to solve the kriging system: |
model |
Character string. The validated public implementation currently
requires |
n |
Integer. Number of trials for Binomial random fields
(default |
nloc |
Integer. Number of trials for the prediction locations
in Binomial random fields (default |
param |
Named list of covariance and mean parameters.
See |
anisopars |
List with components |
radius |
Positive numeric value: sphere radius when
coordinates are lon/lat (default |
sparse |
Logical. If |
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 |
which |
Integer ( |
copula |
Must be |
X |
Numeric design matrix at observation locations. Fixed-location observations are ordered time then site; dynamic observations are ordered by the temporal blocks of |
Xloc |
Numeric design matrix at prediction tasks, ordered location then time: all requested times for the first row of |
Mloc |
Numeric vector of known prediction means in the same location-major order as |
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.
A list containing:
weights |
Numeric matrix of Gaussian kriging weights. The validated
orientation is observations by prediction tasks, as recorded in
|
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 |
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. |
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.
Moreno Bevilacqua, moreno.bevilacqua@uai.cl, Víctor Morales-Oñate, victor.morales@uv.cl, Christian Caamaño-Carrillo, chcaaman@ubiobio.cl
Gaetan, C. and Guyon, X. (2010) Spatial Statistics and Modeling. Springer-Verlag, New York.
GeoKrig for full prediction,
GeoKrigloc for local prediction,
GeoCovmatrix for covariance model details,
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.