# A quick derivation of geostatistical Kriging

William S. Harlan

Date: July 2013

# Introduction

A casual encounter with geostatistics can be baffling because of some non-standard terminology. As it turns out, Kriging,'' the core numerical method of geostatistics, can be derived on a napkin, if you are already familiar with some standard least-squares methods.

If you want to appreciate geostatistical applications, then try the popular book An introduction to Applied Geostatistics," by Isaaks and Srivastava [3]. If you want a clean mathematical notation, then try Multivariate Geostatistics: An introduction with Applications," by Wackernagel [5];

Kriging is just the least-squares solution of a purely under-determined linear inverse problem. Once you see this equivalence, you can see some simple ways to improve distance-weighted interpolation methods.

# Posing the problem

Geostatistics poses a useful problem that you are unlikely to have encountered elsewhere in least-squares. The solution looks very familiar, but it has unique elements that make it very useful.

Assume that you have a continuous function of a spatial vector . Usually has two dimensions, but nothing about the derivation limits us to two dimensions.

The actual function is unknown and needs to be reconstructed from a collection of samples at arbitrarily chosen locations.

 for (1)

We will interpolate a value at an unsampled location as a linearly weighted sum of the known values , at sampled locations :

 (2) or where and

In the last version we switch to vector notation.

Our problem: how do we optimally estimate weights given what we know about the distribution of ?

# Assumptions

We will make a few more assumptions appropriate to a linear least-squares solution.

We will treat all our values as random variables. Without loss of generality (changing variables if necessary), we will assume these variables have zero expected mean:

 for (3)

Assume a constant stationary variance for all samples
 for (4)

Notice that we have included the unmeasured value in our assumptions.

We will find it convenient to construct a covariance matrix for our measured values:

 (5)

Note that the covariance is symmetric: .

Define a covariance vector for our unknown value relative to the measured values:

 (6)

Much of geostatistics concentrates on the estimation of these covariances. For now we assume they are known.

Notice that none of our assumptions require that our interpolated value share the same physical units as the values we are interpolating from. Co-kriging differs from Simple Kriging largely by combining values with mixed units. (See Wackernagel for a demonstration of their equivalence.)

# Least-squares solution

Next we estimate our weights as a least-squares optimization, and take advantage of our assumptions.

Define an estimation error as the expected error between the true value and our interpolated value.

 (7) (8)

Naturally we want this error to be small. Since this expression is a quadratic of the weights , we can minimize by differentiating with respect to the weights and setting the value to zero.
 (9) (10) (11)

This result is entirely equivalent to Simple Kriging. The optimum weights are intuitive when you see them in this form.

Naive weights would simply use the covariance vector between values at the known and the unknown locations. Because the known locations are also correlated with each other, we must remove that effect by multiplying by their inverse covariance .

Once we have our estimated weights , we can explicitly quantify the error in our estimate. This will allow us to put Gaussian error bars on each interpolated value. Substitute our solution (10) into our estimation error (8) for

 (12)

Notice that this expected error is independent of correlations between measured samples. If it were not, then the estimate could be improved.

# Choosing covariances

Geostatistics usually concentrates on the estimation of covariances (or variograms, discussed later).

Here is the most geostatistical assumption of all. The covariance between values depends only on the vector distance between their sampled positions:

 (13) forand

In the absence of other information, it would be appealing to choose a scale-invariant version of a covariance. Scale-invariance allows covariances to be independent of the units chosen for spatial distance. Covariance would similar at any scale, like a fractal.

Unfortunately, this assumption leads to a degenerate solution. Scale-invariance requires covariances to go to infinity at a distance of zero, which should have a finite variance . As we approach infinity, the covariance matrix becomes diagonal like an identity matrix, and so the inverse covariance has no effect on weights.

We see this degeneracy with a popular interpolation known as Shepard's Inverse Distance Weighting'':

 where (14)

This weight decreases with distance squared, like gravity. The denominator is just a normalization over all samples.

If we are assuming a specific correlation between our measured and interpolated values, then we ought to be able to assume the same correlation between measured values.

Unfortunately, this covariance approaches infinity at a zero distance:

 (15) (16)

Sure enough, this degenerate solution tells us to ignore covariances between our known values.

As it turns out, the degeneracy is easily remedied if we sacrifice scale invariance below the density of our samples. Choose a small distance below which the correlation does not increase any further.

 (17)

Covariances at any smaller distance will all equal the marginal .

Let's see how this assumption works with a simple example.

# A simple example

Let's say we have two measured values to interpolate along a one-dimensional dimension .

One value is twice as far as from the interpolated point . Specifically and .

If we are using Shepard's interpolation, then we already know enough to estimate the weights as .

However, it should matter very much if the point we are interpolating is between the two measured points, or on the same side of both.

For a non-degenerate covariance, we will assume in our covariance (17).

On opposite sides of the interpolated point, the two measured points are weakly correlated with . We get adjusted weights of , which is very close to the Shepard's interpolation weights.

On the same side of the interpolated point, the two measured points are strongly correlated with . The value is actually better correlated with than it is with the interpolated . We expect the nearer value to override and diminish the contribution of . And sure enough, the adjusted weights are actually , which ignores the second point entirely.

# Variograms

Most geostatistics literature prefers variograms'' to covariances. This is one of the biggest and most unnecessary obstacles to newcomers. The two quantities have a simple equivalence:

 (18)

Variograms have the minor convenience that values no longer need a zero mean.

The geostatistical assumption (13) can be rewritten

 (19)

Usually variograms are defined in terms of an offset :
 (20)

Considering only offsets and ignoring sampling, we can write the equivalence this way:
 (21)

If we assume values are uncorrelated at infinite distance, we find
 0 (22)

The most popular of standard analytic variograms is an exponential:

 or (23) (24)

The constant is the distance over which about 95% of the correlation occurs. Unlike our distance weighting, this function is not scale invariant over any range of offsets.

A user must prepare scatterplots and histograms to scan possible values for the constant , then choose a best fitting value before kriging can begin. For this sort of analysis, variograms have proven more popular than covariances.

# Kriging as a posterior estimate

It is also possible to recognize Kriging as a special case of a least-squares inverse problem, without postulating the specific weighted solution (2). I thank Dave Hale [1] for explaining this equivalence to me. Kriging is a purely underdetermined inverse problem, which makes it a bit unusual and less familiar.

We assume that we have a model vector and a data vector . The data are assumed to be a linear transform (matrix multiplication) of the model, plus a vector of noise:

 (25)

We assume that our model and noise are selected from stationary correlated Gaussian random processes. The expected value of a model given the data (a posterior estimate) should minimize the following objective function:
 (26)

The covariance is the Gaussian covariance of the model , and covariance is the Gaussian covariance of the noise. We also assume that the noise is uncorrelated to the model. The definition (25) determines the data covariance :
 (27)

Since this objective function is a quadratic in , we can find an optimum by setting the derivative to zero:

 (28) (29) (30)

The first solution (29) is directly solved from the derivative (28). The second solution (30) was shown by Tarantola [4] (Appendix 6.30) to be entirely equivalent. If (29) is equivalent to (30), then
 (31) (32) (33)

Both sides of (32) are trivially equal to (33).

This alternate solution (30) is less often used because it requires a matrix inversion in the data space rather than in the model space. Most typically, an overdetermined problem has a greater number of data values than model values. In the case of Kriging, however, the situation is reversed.

Others such as Hansen et al [2] have observed that this alternate solution (30) is equivalent to Kriging. We will elaborate below.

In the case of geostatistical Kriging, we assume that our model is a large dense grid of regularly distributed values. The forward operator merely subsamples that grid for the values . The dimensionality of is possibly orders of magnitude smaller than that of the model . The transform is a rectangular matrix that has many more columns than rows. Each row contains mostly zeros and a single column with a value of 1. Most columns do not have a value of 1 on any row.

Applying the transposed operator to subsampled data merely repopulates the sampled values of and leaves all other values set to 0. This is also the right inverse of the original transform, so that .

If we have sampled the model directly, there is no need to assume any noise at all. If we allow , then the usual estimate (29) becomes degenerate, and . Rather than interpolating any unsampled values, this estimate sets them all to zero.

The alternate form (30) lets us set the noise variance directly to 0. We can then find the following covariances of our sampled data :

 Assume (34) (35)

and then rewrite our alternate estimate (30) as
 (36) (37) (38) where (39)

These weights (39) for all samples are entirely equivalent to those for a single sample (11). Each measured sample of is weighted by its covariance to an interpolated point, then these weights are adjusted by the inverse covariance of the data samples. We now have the advantage of directly relating data covariances to that of the model. This expression is also much easier to generalize to data that do more than merely subsample the model.

## Bibliography

1
Dave Hale.
Personal communication, 2013.

2
Thomas Mejer Hansen, Andre Journel, Albert Tarantola, and Klaus Mosegaard.
Linear inverse gaussian theory and geostatistics.
Geophysics, pages 101-111, 2006.

3
Edward H. Isaaks and Mohan R. Srivastava.
An Introduction to Applied Geostatistics.
Oxford University Press, USA, January 1990.

4
Albert Tarantola.
Inverse Problem Theory and Methods for Model Parameter Estimation.
Society for Industrial and Applied Mathematics, Philadelphia, PA, USA, 2004.

5
H. Wackernagel.
Multivariate geostatistics: an introduction with applications.
Springer-Verlag, 2nd edition, 2003.

harlan 2018-08-08