Kriging with External Drift

D. Renard

21 August 2017

RGeostats is a library of geostatistical procedures available in the R environment. It is based on the geostatistical library Geoslib written in C language. The specificity of RGeostats is that it can deal with information defined in a space of any dimension, and can process any number of variables simultaneously.

This note describes the way to estimate a variable using an exhaustive information (available on a regular grid) as external drift.

Note that the files contained in the distribution have specific names to appear in a legible way with the package index. In this script, they are systematically renamed to shorten the text (using rg.load facility).

Data description

We consider the case of a top variable defined on a 2-D data set. This file is loaded from the internal demonstration files by typing:

rg.load("Exdemo_ext.data","data")

The previous command loads the Db called data and constituted of 82 isolated samples. Its contents can be visualized using the plot function. We obtain the following figure where the samples are represented using symbols whose sizes are proportional to the top values.

plot(data)

We also benefit from an auxiliary information defined on a regular grid. This information can be loaded from the internal demonstration files by typing:

rg.load("Exdemo_ext.grid","grid")

This file contains the variable Drift which is exhaustively defined over the grid. Its locator is set to f1 so as to specify that this variable will be used further as an external drift. To visualize it, we can use the plot method as long as we also designate the variable to be represented (by its locator for example):

plot(grid,name.image="f1")

Estimation

The first task is to perform a standard kriging starting from the isolated information in order to estimate the top variable over the grid. For that sake, we need to define a model and a neighborhood. These sets of parameters are loaded from the internal demonstration by typing:

rg.load("Exdemo_ext.model","model")
rg.load("Exdemo_ext.neigh","neigh")

The corresponding items are then respectively called: model and neigh. We can then perform the estimation using the kriging procedure by typing:

grid <- kriging(dbin=data,dbout=grid,model=model,neigh=neigh)

The results are stored in the grid Db in the following variables:

The resulting estimation map can be visualized together with the information samples by typing:

plot(grid,name="Kriging.top.estim",
     title="Estimation (Standard Kriging)")
plot(data,add=T,pch=21,col="blue")

Changing the argument of the first plot to Kriging.top.stdev, we obtain the map of the standard deviation of the estimation error:

plot(grid,name="Kriging.top.stdev",
     title="Standard deviation (Standard Kriging)")
plot(data,add=T,pch=21,col="blue")

Estimation using an external drift

The next step consists in estimating the top variable, starting from the 82 isolated samples but using the exhaustive information defined on the grid as an external drift. This requires the locator of the variable Drift contained in the grid file to be set to f1 (this is the convention for the first external drift). If not yet performed (as in our case), we can define this locator by typing:

grid <- db.locate(grid,"drift","f")

The the kriging step must simply be launched using:

grid <- kriging(dbin=data,dbout=grid,model=model,neigh=neigh,
                uc=c("1","f1"),radix="Ext")

The parameter uc is the way to define the set of drift functions to be used in the kriging system: the element 1 designates the universality condition, the term f1 refers to the first external drift. Note that the quotes are compulsory.

Obviously, if several external drifts are used, the parameter can be extended to include more terms. In parallel, several variables should be defined in the grid file, with the corresponding locators.

The estimation can be represented typing:

plot(grid,name="Ext.top.estim",
     title="Estimation (with Kriging with External Drift)")
plot(data,add=T,pch=21,col="blue")

Changing the argument of the first plot to Ext.top.stdev, we obtain the map of the standard deviation of the estimation error:

plot(grid,name="Ext.top.stdev",
     title="Stdndard Deviation (Kriging with External Drift)")
plot(data,add=T,pch=21,col="blue")