Ordinary kriging
Kriging implements local ordinary kriging. For each target, it combines
nearby source values using the spatial correlation described by the fitted
variogram. The weights give the best linear
unbiased estimator (BLUE) under that model
(Matheron, 1971; Cressie, 1993; Isaaks and Srivastava, 1989).
Setup
Given source points with values , the estimate at a target is a weighted sum
The weights are chosen so that the estimator is:
- Unbiased: . In ordinary kriging, the process mean is unknown but treated as constant within the local neighborhood. This constraint accounts for that unknown mean.
- Minimum variance: among all weights that satisfy the unbiasedness constraint, the chosen weights minimize . The semivariance describes how similar values tend to be at separation .
The kriging system
Minimizing variance subject to a linear equality constraint is a Lagrange-multiplier problem. Introducing multiplier for the unbiasedness constraint and solving the resulting stationarity conditions gives a linear system in the weights plus :
where is the distance between source points and , and is the distance from source point to the target . The matrix on the left is symmetric except for the constraint row/column; the bottom row and right column (all ones, with a zero corner) are exactly what enforces .
Solving this system gives both the kriging weights and the kriging variance -- an estimate of the uncertainty at :
Unlike IDW's fixed distance-decay weights, kriging accounts for redundancy between clustered source points. Two nearby points that are also close to each other contribute less independent information than two points spread farther apart at the same average distance from the target.
Local kriging
Solving the full system over every source point would become expensive as the
dataset grows. Kriging instead builds and solves the system for each target
using only the nearest max_neighbors source points within radius, just as
IDW does. min_neighbors sets a floor below which a target returns NaN
rather than a poorly constrained estimate.
Supplying a variogram directly
model_values lets you pass a precomputed variogram model instead of fitting
one from x/y/z. This is useful when several interpolation runs should
share exactly one model, as in apbase.cross_validate, which fits one
variogram and reuses it for both IDW and kriging.