← Back to all sparks
S

spmodel

ANALYTICS
Velocity0.0

spmodel: Spatial Statistical Modeling and Prediction in R

Spatial regression in R, adding block kriging and then tuning the numerics underneath it

spatial-statisticsregression-modellingkrigingr-packagenumerical-stability
Current state
spmodel fits spatial linear and generalised linear models, for both point-referenced and areal data, with prediction and diagnostics attached. Block prediction arrived in 0.11.0 and the releases since have refined it. The most recent release changes optimiser behaviour: the default Nelder-Mead relative stopping tolerance tightens from 1e-4 to 1e-6 to reduce convergence on local rather than global maxima.
Where it's heading
Two threads run in parallel. The first is expanding what can be predicted — point predictions, then areal averages over a region via block kriging, then better accuracy and efficiency for that path as the block size default moved from 1000 to 4000 in 0.12.0. The second is numerical trustworthiness, and it is unusually prominent here: a range-constraint option for stability in 0.9.0, a corrected log determinant of the fixed effects in the restricted log likelihood in 0.11.0, a cloud semivariogram that had been doubling the semivariance fixed in 0.11.1, and now a tighter optimiser tolerance. Several of these silently changed results before they were caught.
Prediction
Expect the maintainers to keep publishing explicit reproduction instructions alongside numerical default changes, as 0.13.0 does by documenting the `control = list(reltol = 1e-4)` escape hatch. The entries give no signal of expansion beyond the current model families.

Recent moves

  1. 2mo ago

    Tighter optimiser tolerance to avoid local maxima

    The default Nelder-Mead relative stopping tolerance tightens from 1e-4 to 1e-6 across `splm()`, `spglm()`, `spautor()`, `spgautor()` and `splmRF()`, to reduce convergence on a local rather than global maximum. It can change previously fitted models, and the release documents `control = list(reltol = 1e-4)` as the way to reproduce the old fit. Prediction with many unseen random effect or partition factor levels also gets faster.

    View source ↗
  2. 6mo ago

    Empirical autocovariance function and better block kriging accuracy

    Adds `eacf()` for the empirical autocovariance function and raises the default block prediction `size` from 1000 to 4000, trading some computation for a more accurate kriging approximation. It also fixes `predict()` and `augment()` returning `NA` when a Matern covariance was used and a `newdata` location exactly matched a fitting location.

    View source ↗
  3. 9mo ago

    Cloud semivariogram doubling fixed; geometry warnings added

    Fixes a cloud semivariogram bug that incorrectly doubled the semivariance — a wrong-answer defect rather than a crash. New warnings surface two silent geometry assumptions: when non-POINT geometries are converted via `sf::st_centroid()`, and when distances are computed in a geographic rather than projected coordinate system.

    View source ↗
  4. 1y ago

    Block kriging for areal averages and their uncertainty

    ⚡ SPARK

    Block prediction, or block kriging, arrives — estimating averages and their uncertainties over a geographic region rather than at points. Later releases refine its accuracy and efficiency rather than replacing it, and a documentation bug in the restricted log likelihood's fixed-effects log determinant is corrected in the same release.

    View source ↗
  5. 1y ago

    Robust semivariogram and new covariance types for areal models

    Adds a robust semivariogram option to `esv()` and the `"none"` and `"ie"` spatial covariance types to the areal model functions, extending choices already available elsewhere in the package. Level curve plots get a fixed aspect ratio and a corrected title when the fitted model is isotropic.

    View source ↗
  6. 1y ago

    Range constraint option and redefined covariance type names

    Adds `range_constrain` to `splm()` and `spglm()` for numerical stability, defaulting to off, and reworks what `"none"` and `"ie"` covariance types mean — `"none"` from v0.8.0 and earlier now corresponds to `"ie"`, a redefinition that changes model specifications written against the old naming.

    View source ↗