Written and maintained by CASRAI Editorial Board
Last updated
Kriging is a geostatistical interpolation method that predicts a value at an unsampled location as a weighted average of nearby measurements, with weights chosen from a fitted model of how similar values are at different distances. Unlike simpler distance-based methods, it also returns a prediction variance, so every mapped value comes with a measure of uncertainty. This page gives the formula with every symbol explained, a three-point example computed by hand, a comparison with inverse distance weighting (IDW) and with Gaussian process regression, and short code for Excel, R and Python.
Definition: what is kriging and what is it used for?
Kriging estimates a spatially continuous quantity, such as soil contamination, groundwater level, rainfall, ore grade or air pollution, at places where it was not measured. It is named after the South African mining engineer Danie G. Krige, who developed the approach for gold grades in the Witwatersrand; the theory was formalised by Georges Matheron in 1960 (Wikipedia, “Kriging”, read 2026-11-07). Researchers use it to build a surface from scattered samples, to choose where to sample next (high prediction variance marks poorly constrained areas) and to interpolate before downstream modelling. It sits within the wider toolkit described in spatial data analysis.
Under suitable assumptions the kriging predictor is the best linear unbiased predictor (BLUP): of all weighted averages of the data whose expected error is zero, it has the smallest error variance.
Kriging formula
For ordinary kriging, the most widely used form, the prediction at location x0 is:
Ẑ(x₀) = Σ λᵢ Z(xᵢ), with Σ λᵢ = 1
- Z(xᵢ): the measured value at sampled location i (i = 1 … n).
- Ẑ(x₀): the predicted value at the unsampled location x₀.
- λᵢ: the kriging weight for sample i. Unlike IDW, it depends on the distance to x₀ and on the spatial arrangement of the samples, through the semivariogram.
- Σ λᵢ = 1: the condition that makes the predictor unbiased when the mean is an unknown constant.
The weights come from the semivariogram γ(h), which describes how dissimilar two measurements are at separation h. Its empirical estimate is:
γ(h) = 1 / (2·|N(h)|) · Σ (Z(xᵢ) − Z(xⱼ))², summed over the pairs in N(h), the set of point pairs separated by lag h.
A smooth model is fitted to those estimates (spherical, exponential, Gaussian, circular or linear are the common choices in Esri’s documentation, read 2026-11-07). Three parameters describe it:
- Nugget: the semivariance near zero separation, from measurement error or variation at a scale finer than the sampling.
- Sill: the level at which the model flattens; the partial sill is the sill minus the nugget.
- Range: the distance at which the model first flattens. Beyond it, samples are effectively uncorrelated.
The weights solve the ordinary kriging system, in which γᵢⱼ is the model semivariance between samples i and j, γᵢ₀ the semivariance between sample i and x₀, and μ a Lagrange multiplier that enforces Σ λᵢ = 1:
[ Γ 1 ; 1ᵀ 0 ] · [ λ ; μ ] = [ γ₀ ; 1 ], and the kriging variance is σ²(x₀) = Σ λᵢ γᵢ₀ + μ.
Worked example: ordinary kriging with three points
Three samples (coordinates in km): Z(0,0) = 10, Z(4,0) = 14, Z(0,3) = 12. Predict at x₀ = (1,1). Assume an exponential semivariogram with nugget 0, sill 4 and scale 3 km: γ(h) = 4·(1 − e−h/3).
Step 1, distances between samples: d₁₂ = 4, d₁₃ = 3, d₂₃ = 5. Step 2, model semivariances: γ₁₂ = 4(1 − e−4/3) = 2.9456; γ₁₃ = 4(1 − e−1) = 2.5285; γ₂₃ = 4(1 − e−5/3) = 3.2445. Step 3, distances to x₀: √2 = 1.4142, √10 = 3.1623, √5 = 2.2361, giving γ₁₀ = 1.5035, γ₂₀ = 2.6060, γ₃₀ = 2.1017.
Step 4, the system:
| λ₁ | λ₂ | λ₃ | μ | = | |
|---|---|---|---|---|---|
| Row 1 | 0 | 2.9456 | 2.5285 | 1 | 1.5035 |
| Row 2 | 2.9456 | 0 | 3.2445 | 1 | 2.6060 |
| Row 3 | 2.5285 | 3.2445 | 0 | 1 | 2.1017 |
| Row 4 | 1 | 1 | 1 | 0 | 1 |
Step 5, solution: λ₁ = 0.5053, λ₂ = 0.2021, λ₃ = 0.2926 (sum 1.0000), μ = 0.1683.
Step 6, prediction: Ẑ(x₀) = 0.5053·10 + 0.2021·14 + 0.2926·12 = 5.053 + 2.830 + 3.511 = 11.39. Kriging variance: 0.5053·1.5035 + 0.2021·2.6060 + 0.2926·2.1017 + 0.1683 = 0.7597 + 0.5267 + 0.6149 + 0.1683 = 2.07 (standard error about 1.44).
Interpretation: reading kriging output
| Output | How to read it |
|---|---|
| Prediction Ẑ(x₀) | Best linear unbiased estimate of the value at x₀, here 11.39. |
| Kriging variance σ²(x₀) | Model-based prediction uncertainty; it grows with distance from samples. It depends on the sample layout and the semivariogram, not on the measured values. |
| Weights λᵢ | Contribution of each sample. Weights can be larger for a more distant sample than for a nearer one when the layout makes the near one redundant or the model says it is less informative. |
| Nugget relative to sill | A large nugget means much of the variation is noise or sub-sample-scale; predictions are smoother. |
| Range | Samples farther than the range from x₀ carry little weight. |
IDW vs kriging: which is better?
Neither is better in general. In IDW the weight depends solely on the distance to the prediction location; kriging weights also reflect the spatial arrangement of the points, via the fitted semivariogram (Esri, read 2026-11-07). On the example above, IDW with power 2 weights the samples 0.625, 0.125 and 0.250 and predicts 11.00, against 11.39 from kriging. Kriging gives a variance; IDW gives none.
| Question | IDW | Kriging |
|---|---|---|
| What sets the weights? | Distance to the prediction point only | Distance plus sample arrangement, from the semivariogram |
| Uncertainty estimate? | No | Yes, the kriging variance |
| Model fitting needed? | Choice of power only | Semivariogram must be estimated and fitted, which needs enough points |
Kriging vs Gaussian process
Kriging is Gaussian process regression: a Gaussian process prior with a covariance kernel, combined with the data, gives a Gaussian posterior with a mean (the kriging prediction) and covariance (the kriging variance) (Wikipedia, read 2026-11-07). The vocabulary differs. Geostatisticians fit a semivariogram, where machine-learning users choose a kernel and tune its hyperparameters; the two are linked because covariance C(h) = sill − γ(h) when a sill exists. The nugget corresponds to a noise (white-noise) term. Machine-learning formulations usually assume a fixed or zero mean and estimate hyperparameters by marginal likelihood; classic geostatistics usually fits the semivariogram to binned empirical estimates.
Types of kriging and kriging method
- Simple kriging: the mean is a known constant.
- Ordinary kriging: the mean is an unknown constant, estimated locally; the default in most software.
- Universal kriging: assumes an overriding trend (such as a polynomial in the coordinates) plus a correlated residual.
- Others include indicator, disjunctive, log-normal, co-kriging (uses a secondary variable) and Bayesian kriging.
Assumptions and common mistakes
- Stationarity. Ordinary kriging assumes a constant mean and a semivariogram that depends only on separation. A strong trend calls for universal kriging or detrending.
- Too few pairs per lag. A semivariogram estimated from a handful of pairs is unstable; the example above is for illustrating the arithmetic, not a recommended sample size.
- Treating the variance as a confidence interval. It is model-based and conditional on the fitted semivariogram being right.
- Skipping validation. Check the fit with cross-validation: leave one point out, predict it, and compare.
- Biased sampling. Clustered or preferential sampling distorts the semivariogram; see sampling bias.
How to report kriging results (APA style)
Report the method, software, semivariogram model and fitted parameters, and a cross-validation statistic. Template, with values in brackets to replace with your own: Values were interpolated by ordinary kriging in [software and version] using an [exponential] semivariogram (nugget = [value], partial sill = [value], range = [value] [unit]). Leave-one-out cross-validation gave a root mean square error of [value] [unit] and a mean error of [value] [unit]. Report the sample count and any transformation applied.
Kriging in Excel, R and Python
Excel. Excel has no kriging function, but for a small system you can solve the matrix above with an array formula: =MMULT(MINVERSE(A1:D4), F1:F4), with the 4×4 matrix in A1:D4 and the right-hand side in F1:F4. The first three results are the weights, the fourth is μ.
R (package gstat; its exponential model uses the scale parameter, as in the example):
library(sp); library(gstat)
d <- data.frame(x=c(0,4,0), y=c(0,0,3), z=c(10,14,12)); coordinates(d) <- ~x+y
g <- gstat(formula=z~1, data=d, model=vgm(psill=4, model="Exp", range=3, nugget=0))
nd <- data.frame(x=1, y=1); coordinates(nd) <- ~x+y
predict(g, nd) # var1.pred, var1.var
Python (PyKrige; its exponential range is the practical range, three times the scale, so 9 here; run and checked, it returns a variance of 2.0697):
from pykrige.ok import OrdinaryKriging
ok = OrdinaryKriging([0.,4.,0.], [0.,0.,3.], [10.,14.,12.], variogram_model="exponential",
variogram_parameters={"sill":4, "range":9, "nugget":0})
z, var = ok.execute("points", [1.], [1.])
Frequently asked questions
What is kriging used for?
Predicting a spatial variable at unsampled locations from scattered measurements, with an uncertainty estimate: mining grades, soil and water quality, climate and environmental surfaces, and spatial public-health data.
Which is better, IDW or kriging?
Kriging is more flexible and provides a variance, but requires fitting a semivariogram; IDW is simpler and needs no model of spatial structure. See the comparison table above.
What is the difference between kriging and a Gaussian process?
They are the same predictor under different vocabulary: semivariogram or covariance function versus kernel, nugget versus noise term.
What is the formula for kriging?
Ẑ(x₀) = Σ λᵢ Z(xᵢ) with Σ λᵢ = 1, with weights from the kriging system above and variance σ² = Σ λᵢ γᵢ₀ + μ.
Sources
- Esri, “How Kriging works” (ArcGIS desktop documentation), desktop.arcgis.com/en/arcmap/latest/tools/spatial-analyst-toolbox/how-kriging-works.htm, read 2026-11-07.
- Wikipedia, “Kriging”, en.wikipedia.org/wiki/Kriging, read 2026-11-07.
- Further reading: Cressie, N. (1993). Statistics for Spatial Data. Wiley. Isaaks, E. H., and Srivastava, R. M. (1989). An Introduction to Applied Geostatistics. Oxford University Press. Rasmussen, C. E., and Williams, C. K. I. (2006). Gaussian Processes for Machine Learning. MIT Press.
Related reading on CASRAI: Kalman filter, covariance matrix, regression analysis.







