ksline: Spatial Prediction - Conventional Kriging

kslineR Documentation

Spatial Prediction – Conventional Kriging


This function performs spatial prediction for given covariance parameters. Options implement the following kriging types: SK (simple kriging), OK (ordinary kriging), KTE (external trend kriging) and UK (universal kriging).

The function krige.conv should be preferred, unless moving neighborhood is to be used.


ksline(geodata, coords = geodata$coords, data = geodata$data,
       locations, borders = NULL, 
       cov.model = "matern",
       cov.pars=stop("covariance parameters (sigmasq and phi) needed"),
       kappa = 0.5, nugget = 0, micro.scale = 0,
       lambda = 1, m0 = "ok", nwin = "full",
       n.samples.backtransform = 500, trend = 1, d = 2,
       ktedata = NULL, ktelocations = NULL, aniso.pars = NULL,
       signal = FALSE, dist.epsilon = 1e-10, messages)



a list containing elements coords and data as described next. Typically an object of the class "geodata" - a geoR data-set. If not provided the arguments coords and data must be provided instead.


an n x 2 matrix where each row has the 2-D coordinates of the n data locations. By default it takes the component coords of the argument geodata, if provided.


a vector with n data values. By default it takes the component data of the argument geodata, if provided.


an N x 2 matrix or data-frame with the 2-D coordinates of the N prediction locations, or a list for which the first two components are used. Input is internally checked by the function check.locations.


optional. If a two column matrix defining a polygon is provided the prediction is performed only at locations inside this polygon.


a vector with 2 elements or an n x 2 matrix with the covariance parameters sigma^2 (partial sill) and phi (range parameter). If a vector, the elements are the values of sigma^2 and phi, respectively. If a matrix, corresponding to a model with several structures, the values of sigma^2 are in the first column and the values of phi are in the second.


the value of the nugget variance parameter tau^2. Defaults to zero.


micro-scale variance. If different from zero, the nugget variance is divided into 2 terms: micro-scale variance and measurement error. This might affect the precision of the predictions. In practice, these two variance components are usually indistinguishable but the distinction can be made here if justifiable.


string indicating the name of the model for the correlation function. Further details in the documentation for cov.spatial. Defaults are equivalent to the exponential model.


additional smoothness parameter required by the following correlation functions: "matern", "powered.exponential", "cauchy" and "gneiting.matern".


numeric value of the Box-Cox transformation parameter. The value lambda = 1 corresponds to no transformation and lambda = 0 corresponds to the log-transformation. Prediction results are back-transformed and returned is the same scale as for the original data.


The default value "ok" indicates that ordinary kriging will be performed. Other options are "kt" for kriging with a trend model (universal kriging) and "kte" for kriging with external trend (covariates). If a numeric value is provided it is assumed to be the value of a know mean and simple kriging is then performed. If "av" the arithmetic mean of the data is assumed to be the know mean for simple kriging algorithm.


If "full" global neighborhood is used i.e., all data values are used in the prediction of every prediction location. An integer number defines the moving neighborhood algorithm. The number provided is used as the number closest neighbors to be used for the prediction at each location. Defaults to "full".


number of samples used in the back-transformation. When transformations are used (specified by an argument lambda), back-transformations are usually performed by sampling from the predictive distribution and then back-transforming the sampled values. The exceptions are for lambda = 0 (log-transformation) and lambda = 1 (no transformation).


only required if m0 = "kt" (universal kriging). Possible values are 1 or 2, corresponding to a first or second degree polynomial trend on the coordinates, respectively.


spatial dimension, 1 defines a prediction on a line, 2 on a plane (the default).


only required if m0 = "kte". A vector or matrix with the values of the external trend (covariates) at the data locations.


only required if m0 = "kte". A vector or matrix with the values of the external trend (covariates) at the prediction locations.


parameters for geometric anisotropy correction. If aniso.pars = FALSE no correction is made, otherwise a two elements vector with values for the anisotropy parameters must be provided. Anisotropy correction consists of a transformation of the data and prediction coordinates performed by the function coords.aniso.


logical. If TRUE the signal is predicted, otherwise the variable is predicted. If no transformation is performed the expectations are the same in both cases and the difference is only for values of the kriging variance, if the value of the nugget is different from zero.


a numeric value. Points which are separated by a distance less than this value are considered co-located.


logical. Indicates whether or not status messages are printed on the screen (or other output device) while the function is running.


An object of the class kriging which is a list with the following components:


the predicted values.


the kriging variances.


the difference between the predicted value and the global mean. Represents the contribution to the neighboring data to the prediction at each point.


values of the arithmetic and weighted mean of the data and standard deviations. The weighted mean corresponds to the estimated value of the global mean.


the matrix with trend if m0 = "kt" (universal kriging).


the matrix with trend if m0 = "kte" (external trend kriging).


the value of the mean which is implicitly estimated for m0 = "ok", "kte" or "kt".


weight of mean. The predicted value is an weighted average between the global mean and the values at the neighboring locations. The value returned is the weight of the mean.


the coordinates of the prediction locations.


status messages returned by the algorithm.


the function call.


This is a preliminary and inefficient function implementing kriging methods. For predictions using global neighborhood the function krige.conv should be used instead.


Paulo J. Ribeiro Jr. paulojus@leg.ufpr.br,
Peter J. Diggle p.diggle@lancaster.ac.uk.


Further information on the package geoR can be found at:

See Also

krige.conv for a more efficient implementation of conventional kriging methods,
krige.bayes for Bayesian prediction.


loci <- expand.grid(seq(0,1,l=31), seq(0,1,l=31))
kc <- ksline(s100, loc=loci, cov.pars=c(1, .25))
image(kc, main="kriging estimates")
image(kc, val=sqrt(kc$krige.var), main="kriging std. errors")

geoR documentation built on Aug. 9, 2022, 5:11 p.m.

Related to ksline in geoR...