Learn R Programming

geoR (version 1.2-5)

ksline: Spatial Prediction -- Conventional Kriging

Description

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.

Usage

ksline(geodata, coords = geodata$coords, data = geodata$data,
       locations, borders = NULL, 
       cov.model = "matern",
       cov.pars=stop("cov. 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.screen = TRUE)

Arguments

geodata
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
an $n \times 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.
data
a vector with n data values. By default it takes the component data of the argument geodata, if provided.
locations
an $N \times 2$ matrix or data-frame with the 2-D coordinates of the $N$ prediction locations.
borders
optional. If a two column matrix defining a polygon is provided the prediction is performed only at locations inside this polygon.
cov.pars
a vector with 2 elements or an $n \times 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, correspond
nugget
the value of the nugget variance parameter $\tau^2$. Defaults to zero.
micro.scale
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 c
cov.model
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.
kappa
additional smoothness parameter required by the following correlation functions: "matern", "powered.exponential", "cauchy" and "gneiting.matern".
lambda
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
m0
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).
nwin
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
n.samples.backtransform
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-transfor
trend
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.
d
spatial dimension, $1$ defines a prediction on a line, $2$ on a plane (the default).
ktedata
only required if m0 = "kte". A vector or matrix with the values of the external trend (covariates) at the data locations.
ktelocations
only required if m0 = "kte". A vector or matrix with the values of the external trend (covariates) at the prediction locations.
aniso.pars
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 trans
signal
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 val
dist.epsilon
a numeric value. Points which are separated by a distance less than this value are considered co-located.
messages.screen
logical. Indicates whether or not status messages are printed on the screen (or other output device) while the function is running.

Value

  • An object of the class kriging which is a list with the following components:
  • predictthe predicted values.
  • krige.varthe kriging variances.
  • difthe difference between the predicted value and the global mean. Represents the contribution to the neighboring data to the prediction at each point.
  • summaryvalues of the arithmetic and weighted mean of the data and standard deviations. The weighted mean corresponds to the estimated value of the global mean.
  • ktrendthe matrix with trend if m0 = "kt" (universal kriging).
  • ktetrendthe matrix with trend if m0 = "kte" (external trend kriging).
  • betathe value of the mean which is implicitly estimated for m0 = "ok", "kte" or "kt".
  • wofmeanweight 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.
  • locationsthe coordinates of the prediction locations.
  • messagestatus messages returned by the algorithm.
  • callthe function call.

References

Further information about geoR can be found at: http://www.maths.lancs.ac.uk/~ribeiro/geoR.

See Also

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

Examples

Run this code
if(is.R()) data(s100)
loci <- expand.grid(seq(0,1,l=31), seq(0,1,l=31))
kc <- ksline(s100, loc=loci, cov.pars=c(1, .25))
par(mfrow=c(1,2))
image.kriging(kc, loc=loci, main="kriging estimates")
image.kriging(kc, loc=loci, val=sqrt(kc$krige.var),
              main="kriging std. errors")

Run the code above in your browser using DataLab