Cokriging

CoKriging extends ordinary kriging by adding one or more secondary variables that are related to the primary. For example, a dense NDVI or soil EC surface can help estimate a sparse yield sample when that relationship is real and admissible (Myers, 1982; Goovaerts, 1997; Wackernagel, 2003; Chilès and Delfiner, 2012). Run covariate screening first: CoKriging does not test its inputs itself, and an unrelated or inadmissible secondary degrades the estimate rather than improving it.

This is an advanced method, not the default apbase.Map path. The default pipeline chooses between IDW and ordinary kriging. Use co-kriging only after screening the secondary variables and comparing the result with a plain kriging baseline.

Estimator and constraint

Given a primary Z0Z_0 and KK secondaries Z1,…,ZKZ_1, \dots, Z_K, the estimate at a target x0x_0 pools weighted contributions from every variable's own local neighborhood:

Z^0(x0)=∑u=0K∑i=1nuλu,i Zu(xu,i)\hat{Z}_0(x_0) = \sum_{u=0}^{K} \sum_{i=1}^{n_u} \lambda_{u,i} \, Z_u(x_{u,i})

where nun_u is variable uu's own neighbor count: primary neighbors for u=0u=0 and secondary-uu neighbors for u≥1u \geq 1. All three methods below use one global unbiasedness constraint ∑u,iλu,i=1\sum_{u,i} \lambda_{u,i} = 1 (standardized ordinary cokriging), rather than one constraint per variable -- this is what keeps the system solvable while combining weights across variables that are in different units and different local neighborhoods.

Each secondary is rescaled to the primary's mean/variance before fitting or interpolating:

Zu′(x)=Zˉ0+(Zu(x)−Zˉu)σ0σuZ_u'(x) = \bar{Z}_0 + \left(Z_u(x) - \bar{Z}_u\right)\frac{\sigma_0}{\sigma_u}

This keeps the shared constraint meaningful even when the secondary variables use different units. The equations below assume the variables have already been standardized this way.

The block system (ICM and LMC)

For ICM and LMC, each variable searches its own local neighborhood. radius and max_neighbors apply to every variable, not only the primary, so secondary variables do not need to share the primary's sample locations. Writing Cuv(h)C_{uv}(h) for the fitted cross-covariance between variables uu and vv at separation hh, the weights and Lagrange multiplier μ\mu solve

[C00C01⋯C0K1C10C11⋯C1K1⋮⋱⋮CK0CK1⋯CKK11⊤1⊤⋯1⊤0][λ0λ1⋮λKμ]=[c0c1⋮cK1]\begin{bmatrix} \mathbf{C}_{00} & \mathbf{C}_{01} & \cdots & \mathbf{C}_{0K} & \mathbf{1} \\ \mathbf{C}_{10} & \mathbf{C}_{11} & \cdots & \mathbf{C}_{1K} & \mathbf{1} \\ \vdots & & \ddots & & \vdots \\ \mathbf{C}_{K0} & \mathbf{C}_{K1} & \cdots & \mathbf{C}_{KK} & \mathbf{1} \\ \mathbf{1}^\top & \mathbf{1}^\top & \cdots & \mathbf{1}^\top & 0 \end{bmatrix} \begin{bmatrix} \boldsymbol\lambda_0 \\ \boldsymbol\lambda_1 \\ \vdots \\ \boldsymbol\lambda_K \\ \mu \end{bmatrix} = \begin{bmatrix} \mathbf{c}_0 \\ \mathbf{c}_1 \\ \vdots \\ \mathbf{c}_K \\ 1 \end{bmatrix}

where block Cuv\mathbf{C}_{uv} holds Cuv(dij)C_{uv}(d_{ij}) between variable uu's neighbors and variable vv's neighbors, and cu\mathbf{c}_u holds C0u(di0)C_{0u}(d_{i0}) from variable uu's neighbors to the target. This gives one linear system of size (n0+⋯+nK+1)(n_0 + \cdots + n_K + 1) per target, extending the single-variable kriging system to K+1K+1 variables.

ICM and LMC differ only in how Cuv(h)C_{uv}(h) is built from the fitted model:

ICM (Intrinsic Coregionalization Model). ICM uses one shared shape (model and range), fitted jointly over every one of the (K+12)\binom{K+1}{2} variable pairs, scaled per pair by two (K+1)×(K+1)(K+1)\times(K+1) matrices -- a nugget matrix B0\mathbf{B}_0 and a partial-sill matrix B1\mathbf{B}_1:

Cuv(h)={(B0)uv+(B1)uvh=0(B1)uv(1−g(h))h>0C_{uv}(h) = \begin{cases} \left(\mathbf{B}_0\right)_{uv} + \left(\mathbf{B}_1\right)_{uv} & h = 0 \\ \left(\mathbf{B}_1\right)_{uv} \left(1 - g(h)\right) & h > 0 \end{cases}

with gg the shared shape function (spherical/exponential/gaussian, selected the same way as Variogram, chosen by total fit error summed across all pairs). B0\mathbf{B}_0 and B1\mathbf{B}_1 are fit independently per pair by closed-form weighted least squares, then each checked for positive semidefiniteness (PSD) via a Cholesky attempt with a small relative floor (CoKrigingNonPSDCoregionalizationError if either fails) -- both matrices are checked, not just the sill: the nugget contributes its own additive covariance component at h=0h=0 (structurally identical to LMC's own nugget structure below), so a nugget matrix that is not itself PSD corrupts the block system with a negative eigenvalue just as readily as a bad sill matrix would, even though independent per-pair fits routinely produce a near-zero nugget diagonal for low-noise data.

LMC (full Linear Model of Coregionalization). LMC uses SS nested structures (index 00 = nugget, 1,…,S−11, \dots, S{-}1 continuous, at geometrically spread ranges), each with its own (K+1)×(K+1)(K+1)\times(K+1) coefficient matrix B(l)\mathbf{B}^{(l)}:

Cuv(h)=∑l:h=0 or l>0(B(l))uv(1−gl(h))[l>0]C_{uv}(h) = \sum_{l : h=0 \text{ or } l>0} \left(\mathbf{B}^{(l)}\right)_{uv} \left(1 - g_l(h)\right)_{[l>0]}

i.e. every structure contributes at h=0h=0, only the continuous structures (l≥1l \geq 1) attenuate with glg_l for h>0h>0. Coefficients are fit by the Goulard & Voltz (1992) algorithm (Goulard and Voltz, 1992): block-coordinate descent, alternating a closed-form weighted-least-squares update per structure (holding the others fixed) with an eigendecomposition-based projection onto the PSD cone (clip negative eigenvalues to 0, reconstruct) after each update. Unlike ICM, PSD-ness is guaranteed by construction every sweep, not checked post-hoc -- LMC trades ICM's single shared shape for S−1S{-}1 independently-shaped continuous structures, at the cost of a heavier iterative fit.

Collocated cokriging (MM1)

Collocated cokriging (Markov Model 1) (Xu et al., 1992; Journel, 1999) uses the primary's neighborhood plus one colocated datum for each secondary: the secondary value at, or nearest to, the target. It does not use a full secondary neighborhood. Under the Markov screening assumption, the secondary informs the primary through their shared location rather than its own spatial structure, so the cross-covariance collapses to a fixed multiple of the primary's own covariance:

C0u(h)=ρu C00(h)Cuv(0)=ρuρv C00(0)  (u,v≥1)C_{0u}(h) = \rho_u \, C_{00}(h) \qquad\qquad C_{uv}(0) = \rho_u \rho_v \, C_{00}(0) \; (u, v \geq 1)

where ρu\rho_u is the primary-secondary correlation from CrossVariogram. This reduces the system to primary-neighborhood size plus KK (one row/column per secondary) plus one constraint row -- far smaller than ICM/LMC's full block system, at the cost of needing the secondary value available at every interpolation target (pre-interpolate a sparse secondary onto a denser point set first if needed) and of the simpler screening assumption itself.

Choosing a method

Secondaries need own local search System size per target Coregionalization fit
Collocated No -- one colocated value at target primary neighbors + KK + 1 closed-form ρu\rho_u per secondary
ICM Yes ∑unu\sum_u n_u + 1 one shared shape, joint pair fit
LMC Yes ∑unu\sum_u n_u + 1 SS shapes, Goulard-Voltz iterative

Collocated is the cheapest option and needs the least fitting, but it assumes the Markov relationship and requires secondary coverage at every target. ICM captures multi-point secondary structure with one shared shape. LMC allows a different shape for each structure when one shared shape is not enough, at a higher fitting cost.

Local parameters

As with Kriging, radius and max_neighbors bound each local search, while min_neighbors is the minimum needed for a finite estimate. ICM and LMC apply these bounds independently to each variable, so a sparse secondary and a dense primary can use different neighborhoods at the same target.