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 estimation variance . This variance is written in terms of the semivariance , which describes how dissimilar 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. Its bottom row and right column (all ones, with a zero corner) enforce .
Solving this system gives both the kriging weights and the kriging variance, an estimate of the uncertainty at :
APbase does not compute or return the kriging variance: Kriging.interpolate
returns only the estimates.
Unlike IDW's fixed distance-decay weights, kriging accounts for redundancy between source points. Points clustered together carry partly redundant information, so kriging gives them less combined weight than the same number of points spread around the target at similar distances.
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, with the
same min_neighbors fallback as IDW.
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 uses it for the shared search radius and the kriging model.