# kriging: Simple kriging interpolation In SpatialExtremes: Modelling Spatial Extremes

 kriging R Documentation

## Simple kriging interpolation

### Description

This function interpolates a zero mean Gaussian random field using the simple kriging predictor.

### Usage

kriging(data, data.coord, krig.coord, cov.mod = "whitmat", sill, range,
smooth, smooth2 = NULL, grid = FALSE, only.weights = FALSE)

### Arguments

 data A numeric vector or matrix. If data is a matrix then the simple kriging predictor is given for each realisation, i.e., each row of data. data.coord A numeric vector or matrix specifying the coordinates of the observed data. If data.coord is a matrix, each row must corresponds to one location. krig.coord A numeric vector or matrix specifying the coordinates where the kriging predictor has to be computed. If krig.coord is a matrix, each row must correspond to one location. cov.mod A character string specifying the covariance function family. Must be one of "whitmat", "powexp", "cauchy", "bessel" or "caugen" for the Whittle-Matern, the powered exponential, the Cauchy, the Bessel or the generalized Cauchy covariance families. sill,range,smooth,smooth2 Numerics specifiying the sill, range, smooth and, if any, the second smooth parameters of the covariance function. grid Logical. Does krig.coord specifies a grid? only.weights Logical. Should only the kriging weights be computed? If FALSE, the kriging predictor isn't computed.

### Value

A list with components

 coord The coordinates where the kriging predictor has been computed; krig.est The kriging predictor estimates; grid Does coord define a grid?; weights A matrix giving the kriging weights: each column corresponds to one prediction location.

Mathieu Ribatet

### References

Chiles, J.-P. and Delfiner, P. (1999) Geostatistics, Modeling Spatial Uncertainty Wiley Series in Probability and Statistics.

condrgp, rgp, covariance.

### Examples

## Kriging from a single realisation
n.site <- 50
n.pred <- 512

x.obs <- runif(n.site, -100, 100)
x.pred <- seq(-100, 100, length = n.pred)

data <- rgp(1, x.obs, "whitmat", sill = 1, range = 10, smooth = 0.75)

krig <- kriging(data, x.obs, x.pred, "whitmat", sill = 1, range = 10,
smooth = 0.75)

plot(krig\$coord, krig\$krig.est, type = "l", xlab = "x", ylab =
expression(hat(Y)(x)))
points(x.obs, data, col = 2, pch = 21, bg = 2)

## Kriging from several realisations
n.real <- 3
data <- rgp(n.real, x.obs, "whitmat", sill = 1, range = 10, smooth = 0.75)

krig <- kriging(data, x.obs, x.pred, "whitmat", sill = 1, range = 10,
smooth = 0.75)

matplot(krig\$coord, t(krig\$krig.est), type = "l", xlab = "x", ylab =
expression(hat(Y)(x)), lty = 1)
matpoints(x.obs, t(data), pch = 21, col = 1:n.real, bg = 1:n.real)
title("Three kriging predictors in one shot")

## Two dimensional kriging on a grid
x.obs <- matrix(runif(2 * n.site, -100, 100), ncol = 2)
x <- y <- seq(-100, 100, length = 100)
x.pred <- cbind(x, y)

data <- rgp(1, x.obs, "whitmat", sill = 1, range = 10, smooth = 0.75)

krig <- kriging(data, x.obs, x.pred, "whitmat", sill = 1, range = 10,
smooth = 0.75, grid = TRUE)

z.lim <- range(c(data, krig\$krig.est))
breaks <- seq(z.lim[1], z.lim[2], length = 65)
col <- heat.colors(64)
idx <- as.numeric(cut(data, breaks))

image(x, y, krig\$krig.est, col = col, breaks = breaks)
points(x.obs, bg = col[idx], pch = 21)
## Note how the background colors of the above points matches the ones
## returned by the image function

SpatialExtremes documentation built on April 19, 2022, 5:06 p.m.