Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

A spatial GEV — location as a Gaussian process

Pooling that respects geography, fit fast with a Laplace approximation

Abstract

The hierarchical model pooled the stations, but blindly — it pulled every station toward one global mean regardless of where it sits. Here we make the pooling spatial: the GEV location becomes μ(s) = μ₀ + f(s) + εₛ, with f a Gaussian-process field over (lon, lat) so nearby stations inform each other, plus a per-station nugget that absorbs local, sub-grid structure. We fit it first with a fast Laplace approximation — a Gaussian centred at the posterior mode — and then confirm that approximation against full NUTS. The result is a continuous location surface with calibrated uncertainty everywhere, including ungauged ground, and 100-year levels far tighter than the independent fits.

Keywords:Gaussian processspatial poolingLaplace approximationMatérn kernelnuggetreturn levels

A spatial GEV: location as a Gaussian process

Notebook 05 pooled the stations with a hierarchical prior and cut the tail uncertainty sharply — but the pooling was spatially blind. Its prior, μs∼N(μ0,τμ2)\mu_s \sim \mathcal N(\mu_0, \tau_\mu^2), is exchangeable: it pulls a station in the cool northern interior and a station on the warm Mediterranean coast toward the same global mean μ0\mu_0. Geography never enters.

This notebook fixes that. We let the GEV location be a smooth spatial function plus local structure,

ys,t∼GEV(μ(s), σ, ξ),μ(s)=μ0+f(s)+εs,y_{s,t} \sim \mathrm{GEV}\big(\mu(s),\ \sigma,\ \xi\big), \qquad \mu(s) = \mu_0 + f(s) + \varepsilon_s,

with the pieces

On inference. A latent GP field over many stations is a big correlated object, so we start with a Laplace approximation: optimise to the posterior mode (the MAP), then approximate the posterior by the Gaussian whose covariance is the curvature (inverse Hessian) at that mode. It costs a single optimisation — seconds — and is exact when the posterior is roughly Gaussian. We lead with it, read off the maps, and then check it honestly against a full NUTS run.

/Users/eman/code_projects/research_notebook/projects/spatial_extremes/.venv/lib/python3.12/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html
  from .autonotebook import tqdm as notebook_tqdm
source: REAL | stations 107 | years 1897-2025 (125)
coverage: 23-120 yrs/station, 49% of the 107×125 grid observed

The model

The GP field is sampled in whitened coordinates (f=L uf = L\,u with u∼N(0,I)u \sim \mathcal N(0, I) and LL the Cholesky factor of the kernel matrix), which turns the strongly-correlated field into independent standard-normal draws — far easier for any sampler or optimiser. We centre ff to remove its additive degeneracy with μ0\mu_0, keep the log⁡σ\log\sigma / bounded-ξ\xi reparameterisation from notebook 04, and give the nugget a non-centred form εs=τεzs\varepsilon_s = \tau_\varepsilon z_s. The records are ragged (we keep stations with ≥20\ge 20 years), so the likelihood masks missing station-years — only observed entries enter the numpyro.factor.

Fit, fast — the Laplace approximation

AutoLaplaceApproximation optimises the model to its MAP and reads the Gaussian posterior off the curvature there. We drive the optimisation with Adam (guarding against the occasional out-of-support GEV gradient), and the ELBO loss curve below should settle to a flat plateau — the sign it has found the mode.

Laplace fit in 6.6s · final ELBO loss 15290.2
<Figure size 600x320 with 1 Axes>

Read off the posterior

We draw from the Laplace Gaussian with guide.sample_posterior, then push those draws back through the model with Predictive to get posterior samples of every derived quantity — the location field μ(s)\mu(s), the smooth component f(s)f(s), and the global σ,ξ\sigma, \xi.

global tail   ξ = -0.206 ± 0.006
global scale  σ = 1.96 ± 0.02 °C
GP amplitude  √var = 2.38 °C, fixed lengthscale = 0.8 (≈ 2.3° lon)
smooth field vs latitude: corr = -0.80

What the GP extracts: a regional field

The location splits into a smooth regional field f(s)f(s) — the part the GP can explain from position alone — and the per-station remainder. The smooth field tracks the north–south temperature gradient (its correlation with latitude is printed above): the GP has discovered the large-scale geography that the exchangeable hierarchical prior could not represent.

<Figure size 620x520 with 2 Axes>
<Figure size 620x520 with 2 Axes>

The GP’s superpower: a continuous surface with honest uncertainty

Neither the no-pooling nor the hierarchical model can say anything about a location without a station. A GP can: conditioning the fitted field on the stations gives a posterior over ff at every point on a grid — a continuous map, and an uncertainty that is small near stations and grows into the gaps. We interpolate the posterior-mean field onto a 60×60 grid over Iberia.

<Figure size 1300x520 with 4 Axes>

The payoff: 100-year return levels

The pooled, spatially-aware fit gives the 100-year level at every station with tight credible intervals — the location borrows strength from neighbours and the tail is shared. We print the average 95%-interval width below; for context, it was ≈ 7.8 °C with no pooling and ≈ 2.7 °C under the hierarchical model. (These are the Laplace intervals; the next section checks their width against NUTS, where there turns out to be a catch.)

z100 median range : 27.2 -> 48.1 °C
z100 95% CI width : 2.9 °C avg (max 3.6)
<Figure size 620x520 with 2 Axes>
<Figure size 620x520 with 2 Axes>

Takeaway

Making the pooling spatial was the right last move. The GP location field recovers the regional geography the exchangeable hierarchy ignored, gives a continuous map with uncertainty that honestly grows away from stations, and keeps the 100-year intervals tight — all from a Laplace fit in a few seconds.

One honest caveat travels with that speed: Laplace centres a Gaussian at the posterior mode, so its point estimates (the station maps, the global ξ\xi) are trustworthy, but its calibrated interval widths are only as good as that Gaussian. The non-Gaussian geometry of a latent GP field plus a smooth/nugget ridge can make the mode-centred bands too wide or too narrow. The working rule: start fast with Laplace for the answer, and reach for full MCMC when the calibrated uncertainty is the thing you are selling.

Two further caveats, each a door to the capstones:

  • We fixed the GP lengthscale to a regional scale. Left free, the data pull it much shorter — the location really does vary at fine, elevation-driven scales that (lon,lat)(\text{lon}, \text{lat}) cannot see, which is exactly why the nugget earns its place. Adding elevation as a covariate is the natural fix.

  • We kept σ,ξ\sigma, \xi global. The capstones relax this — a spatial warming rate β(s)\beta(s), then non-stationary σ(s),ξ(s)\sigma(s), \xi(s), then a copula for joint exceedances across stations.