Package: Stem 2.0.0

Paolo Maranzano

Stem: Spatio-Temporal Expectation-Maximization Models

Estimation of hierarchical spatio-temporal models through the Expectation-Maximization (EM) algorithm within a likelihood-based framework, following Fasso and Cameletti (2010) <doi:10.1177/0037549709102150> and the heterogeneous-network model of Fasso, Cameletti and Nicolis (2007) <doi:10.1002/env.837>, with the EM machinery of McLachlan and Krishnan (2008, ISBN:9780470191613). Parameters are estimated by maximum likelihood via Kalman filtering and smoothing; standard errors and spatial prediction uncertainty are obtained by a spatio-temporal parametric bootstrap. The package also provides the spatially-clustered STEM (SC-STEM) models, an extension in which regression coefficients, variance components and latent dynamics vary across spatial regimes estimated from the data by maximizing a Potts-penalized likelihood, in the spirit of the spatially-clustered regression of Sugasawa and Murakami (2021) <doi:10.1016/j.spasta.2021.100525> and of the spatially-clustered spatial autoregressive models of Cerqueti, Maranzano and Mattera (2025) <doi:10.1007/s13253-025-00685-7>. SC-STEM comes with likelihood-based information criteria, a two-step rule based on the Bayesian information criterion for selecting the number of regimes and the spatial penalty, and a refit-with-clustering parametric bootstrap that propagates the uncertainty of the estimated partition into intervals and tests.

Authors:Michela Cameletti [aut, cph], Francesco Caccia [ctb, cph], Paolo Maranzano [aut, cre, cph]

Stem_2.0.0.tar.gz
Stem_2.0.0.zip(r-4.7-any)Stem_2.0.0.zip(r-4.6-any)
Stem_2.0.0.tar.gz(r-4.7-any)Stem_2.0.0.tar.gz(r-4.6-any)
Stem_2.0.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
Stem/json (API)

# Install 'Stem' in R:
install.packages('Stem', repos = c('https://cran.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/paolomaranzano/stem/issues

Datasets:
  • pm10 - Realistic data which illustrate the usage of the package Stem
  • povalley - Daily particulate matter in the Po Valley, 2019-2023

On CRAN:

Conda:

4.40 score 16 downloads 10 mentions 17 exports 19 dependencies

Last updated from:e257e493f6. Checks:6 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-develOK166
source / vignettesOK277
linux-releaseOK161
windows-develOK85
windows-releaseOK111
wasm-releaseOK124

Exports:SCSTEM_BootInferenceSCSTEM_BootstrapSCSTEM_CompleteSCSTEM_CVSCSTEM_EstimationSCSTEM_InfocritSCSTEM_SelectSCSTEM_SignalSTEM_BootstrapSTEM_CompleteSTEM_controlSTEM_EstimationSTEM_FitSTEM_KrigingSTEM_ModelSTEM_SignalSTEM_Simulation

Dependencies:bootclassclassIntDBIdeldire1071geodistKernSmoothlatticeMASSproxyRcpps2sfspspDataspdepunitswk

Getting started with STEM models
The model | Data | Building a model object | Estimation | Uncertainty: the parametric bootstrap | Spatial prediction | Where to go next | References

Last update: 2026-11-21
Started: 2026-11-21

Spatially-clustered STEM models
Why cluster the regression | The data | Fitting an SC-STEM model | Two safeguards worth knowing about | The scale of the penalty | Choosing $K$ and $\phi$ | Uncertainty: the refit-with-clustering bootstrap | References

Last update: 2026-11-21
Started: 2026-11-21

Map of the package
The four layers | 1. Data and the model object | 2. The estimation engine | 3. Simulation, prediction and uncertainty | 4. Spatially-clustered STEM | A typical session | Regenerating the map | Is the implementation faithful to the papers?

Last update: 2026-11-21
Started: 2026-11-21

Computational notes
1. What "cost $O(T d^3)$" means | 2. Why the Woodbury identity helps | 3. Under what conditions | 4. The log-density, which is a different problem | 5. The M-step, written as matrix products | 6. What it is worth | 7. Where to look in the sources | References

Last update: 2026-11-21
Started: 2026-11-21

Numerical experiments on the estimation algorithms
1. Design | 2. Correctness of the implementation | 3. Exactness of what the package reports | 4. The four algorithms reach the same maximum | 5. Accuracy against the true values | 6. Computing time on whole fits | 7. The limits of the range | 8. Why the iterations add no jitter

Last update: 2026-11-21
Started: 2026-11-21

Readme and manuals

Help Manual

Help pageTopics
Realistic data which illustrate the usage of the package Stempm10
Daily particulate matter in the Po Valley, 2019-2023povalley
Print method for the SC-STEM bootstrap inferenceprint.SCSTEM_BootInference
Print method for the SC-STEM parametric bootstrapprint.SCSTEM_Bootstrap
Print method for the blocked cross-validation of STEM and SC-STEM fitsprint.SCSTEM_CV
Print method for SC-STEM fitsprint.SCSTEM_Estimation
Print method for SC-STEM information criteriaprint.SCSTEM_Infocrit
Print method for the SC-STEM selection ruleprint.SCSTEM_Select
Inference from the SC-STEM parametric bootstrapSCSTEM_BootInference
Refit-with-clustering parametric bootstrap for SC-STEM modelsSCSTEM_Bootstrap
Completed response of a fitted SC-STEM modelSCSTEM_Complete
Blocked cross-validation of the predictive accuracy of STEM and SC-STEM fitsSCSTEM_CV
Spatially-clustered STEM estimationSCSTEM_Estimation
Information criteria over a grid of SC-STEM configurationsSCSTEM_Infocrit
Two-step selection of the SC-STEM hyperparametersSCSTEM_Select
Fitted values of a fitted SC-STEM modelSCSTEM_Signal
Parametric bootstrapSTEM_Bootstrap
Completed response of a fitted STEM modelSTEM_Complete
Computational settings of the STEM and SC-STEM estimatorsSTEM_control
ML EstimationSTEM_Estimation
Fit a STEM or SC-STEM model, with or without a penalty on the coefficientsSTEM_Fit
Dynamical spatial mappingSTEM_Kriging
Create a Stem ModelSTEM_Model
Fitted values of a STEM modelSTEM_Signal
Simulation of spatio-temporal dataSTEM_Simulation