Regression Methods for Geospatial DataPart 2 of 4Intermediate · Updated December 1, 2026
Kernel Regression
A neighbourhood average weights every observation inside the cutoff equally and every observation outside it at zero, so the estimate jumps as points cross the boundary. Kernel regression replaces the boundary with a weight that decreases smoothly with distance, and a prior gives the estimate a defined value where observations are sparse.
A smooth weight replaces the hard neighbourhood boundary
A neighbourhood average is a weighted average whose weights are 0 or 1:
Replacing the indicator with any non-negative, decreasing function of the normalised distance gives the Nadaraya–Watson estimator:
It is still a weighted mean, so it lies between the smallest and largest observed values: it cannot extrapolate or overshoot. This limits what it can represent and also makes it robust.
The kernel’s tail sets how far evidence reaches
Two kernels are common, and they differ mainly in the tail:
The Gaussian decays quickly: its weight is at and at , so an observation four length scales away has effectively no influence. The exponential (Laplace) kernel, also called Matérn-, decays more slowly and keeps distant observations at a reduced weight. This suits a sparse dataset of a field with long-range structure, such as atmospheric humidity, where distant observations still carry information.
A Beta prior fills in where observations are sparse
Where the neighbourhood is empty or nearly so, and the estimate becomes . Over sparsely flown regions or unused flight levels this is the normal case, not an edge case. A single distant observation also produces an estimate that looks as definite as one built on many.
The remedy is to add fictitious observations at a default value, with a total weight that expresses confidence in that default. For a probability this is a Beta prior with mean carrying pseudo-observations: pseudo-counts of “yes” and of “no”. Each observation adds to the “yes” count and to the “no” count, and the posterior mean is
Three limits summarise its behaviour:
- : the estimator reduces to Nadaraya–Watson.
- : the data are ignored and .
- : data and prior have equal influence.
The last limit gives its meaning. It has the same units as the kernel weights, so it is the amount of evidence needed to move the estimate halfway from the prior: corresponds to ten observations located at the query point, and to a prior that yields to almost any data. The estimate moves smoothly between the two regimes with no special case, and as a Beta posterior mean it stays in whenever the observations do.
need not be constant. It can vary with the query, as a climatology or the probability a numerical weather forecast assigns to that place and time; then sets how far to trust that forecast against the observations.
Rescaled weights and a radius cutoff keep the computation stable and tractable
Rescaling the weights before exponentiating. Computing directly underflows when every neighbour is far away, giving for numerical rather than statistical reasons. Because the estimator is a ratio, subtracting a constant from every exponent leaves it unchanged:
With subtracted, the largest weight is exactly 1 (the log-sum-exp trick). The rescaled weights are no longer in the same units as , so the prior term must be scaled by the same factor; otherwise the amount of shrinkage depends on how far away the neighbours are.
Keeping a radius cutoff. A kernel gives every point a weight, so truncation is no longer needed for the estimator to be defined. It is kept for cost: without it every query touches every observation, which is infeasible with millions of trajectory points, so only observations with are used. With large the cutoff is a computational approximation; at the largest discarded weight is , under 1% of the weight of an observation at the query point. With smaller, the cutoff changes the estimate and becomes part of the model.
Length scales are fitted on held-out groups
The parameters , , , and are chosen by minimising a loss on held-out data; for a probability, binary cross-entropy:
Holding out random observations does not work here. Consecutive points along one flight are close together, so a held-out point almost always has a near-duplicate in the training set, and the score measures recall of that duplicate rather than generalisation. Grouped cross-validation holds out entire flights instead, so every validation query is separated from the data the model sees. In general, when observations arrive in correlated groups, cross-validation should split by group.
Assumptions and failure modes
The estimator treats its observations as independent. Ten observations from one flight within a kilometre of each other receive ten times the weight of one, although they are nearly the same measurement; counts evidence without accounting for its correlation.
It also returns no uncertainty. is a single number whether it rests on hundreds of nearby observations or on the prior alone. Both limitations have the same origin and are addressed by Gaussian Process Regression.
Summary
- Nadaraya–Watson regression is a weighted mean with weights that decrease with normalised distance.
- The exponential kernel keeps distant observations at a reduced weight; the Gaussian effectively discards them.
- A Beta prior with strength , in units of observations, makes the estimate relax smoothly to where data are sparse.
- Parameters are fitted by cross-entropy on held-out groups (for example, whole flights), not random points.
The output is a number in ; whether it behaves as a probability is the subject of the next tutorial.
References
- Nadaraya, E. A. (1964). On estimating regression. Theory of Probability & Its Applications, 9(1), 141–142. doi:10.1137/1109020
- Watson, G. S. (1964). Smooth regression analysis. Sankhyā: The Indian Journal of Statistics, Series A, 26(4), 359–372. JSTOR 25049340
- Roberts, D. R., Bahn, V., Ciuti, S., Boyce, M. S., Elith, J., Guillera-Arroita, G., Hauenstein, S., Lahoz-Monfort, J. J., Schröder, B., Thuiller, W., Warton, D. I., Wintle, B. A., Hartig, F., & Dormann, C. F. (2017). Cross-validation strategies for data with temporal, spatial, hierarchical, or phylogenetic structure. Ecography, 40(8), 913–929. doi:10.1111/ecog.02881