| Title: | Spatiotemporal Propagation for Multivariate Bayesian Dynamic Learning |
| Version: | 1.0-1 |
| Maintainer: | Luca Presicce <l.presicce@campus.unimib.it> |
| Description: | Implementation of the Forward Filtering Backward Sampling (FFBS) algorithm with Dynamic Bayesian Predictive Stacking (DYNBPS) integration for multivariate spatiotemporal models, as introduced in "Adaptive Markovian Spatiotemporal Transfer Learning in Multivariate Bayesian Modeling" (Presicce and Banerjee, 2026+) <doi:10.48550/arXiv.2602.08544>. This methodology enables efficient Bayesian multivariate spatiotemporal modeling, utilizing dynamic predictive stacking to improve inference across multivariate time series of spatial datasets. The core functions leverage 'C++' for high-performance computation, making the framework well-suited for large-scale spatiotemporal data analysis in parallel computing environments. |
| LinkingTo: | Rcpp, RcppArmadillo |
| Imports: | spBPS, Rcpp (≥ 1.1.1), abind |
| Suggests: | doParallel, mniw, MBA, ggplot2, patchwork, reshape2, knitr, rmarkdown |
| License: | GPL (≥ 3) |
| Encoding: | UTF-8 |
| RoxygenNote: | 7.3.3 |
| VignetteBuilder: | knitr |
| URL: | https://lucapresicce.github.io/spFFBS/ |
| NeedsCompilation: | yes |
| Packaged: | 2026-07-15 17:16:35 UTC; presi |
| Author: | Luca Presicce |
| Repository: | CRAN |
| Date/Publication: | 2026-07-15 19:20:02 UTC |
spFFBS: Spatiotemporal Propagation for Multivariate Bayesian Dynamic Learning
Description
Implementation of the Forward Filtering Backward Sampling (FFBS) algorithm with Dynamic Bayesian Predictive Stacking (DYNBPS) integration for multivariate spatiotemporal models, as introduced in "Adaptive Markovian Spatiotemporal Transfer Learning in Multivariate Bayesian Modeling" (Presicce and Banerjee, 2026+) doi:10.48550/arXiv.2602.08544. This methodology enables efficient Bayesian multivariate spatiotemporal modeling, utilizing dynamic predictive stacking to improve inference across multivariate time series of spatial datasets. The core functions leverage 'C++' for high-performance computation, making the framework well-suited for large-scale spatiotemporal data analysis in parallel computing environments.
Author(s)
Maintainer: Luca Presicce l.presicce@campus.unimib.it (ORCID)
See Also
Useful links:
Compute dynamic Bayesian predictive stacking weights (v2)
Description
Calls compute_Wt_cpp_v2() directly - no foreach overhead.
Usage
compute_Wt(out_FF, tau, phi, n_threads = 1L, verbose = TRUE)
Arguments
out_FF |
Output of |
tau |
Numeric vector of tau grid values (for column names only). |
phi |
Numeric vector of phi grid values (for column names only). |
n_threads |
Number of OpenMP threads (default 1). |
verbose |
Logical; print progress? Default TRUE. |
Value
n x J weight matrix.
Convert a full prior covariance matrix to block form for spFFBS
Description
Convert a full prior covariance matrix to block form for spFFBS
Usage
make_prior(m0, C0, nu0, Psi0, p)
Arguments
m0 |
(p+n) x q prior mean matrix. |
C0 |
(p+n) x (p+n) prior covariance matrix (full). |
nu0 |
Prior degrees of freedom (scalar). |
Psi0 |
q x q prior scale matrix. |
p |
Number of regression coefficients (integer). |
Value
A list with elements m, C_bb, C_bw, C_ww, nu, Psi
ready to pass as prior to spFFBS.
spFFBS: Spatiotemporal Bayesian Pipeline (optimised)
Description
Optimised wrapper for the spFFBS v2 C++ backend. Runs forward filtering, dynamic stacking weight computation, and optionally backward sampling, temporal forecasting, and spatial interpolation.
Usage
spFFBS(
Y,
X,
D,
grid = list(tau = NULL, phi = NULL),
prior,
G_beta = NULL,
rho = 1,
do_BS = FALSE,
do_forecast = FALSE,
do_spatial = FALSE,
L = 200L,
tnew = NULL,
X_all = NULL,
spatial = NULL,
n_threads = 1L,
verbose = TRUE
)
Arguments
Y |
Response array, n x q x T. |
X |
Covariate array, n x p x T. Replaces |
D |
n x n spatial distance matrix. |
grid |
List with elements |
prior |
Block-form prior list; see |
G_beta |
pxp upper-left block of the system matrix G.
Default |
rho |
Scalar multiplier for the lower-right nxn identity block of G. Default 1. |
do_BS |
Logical; run backward sampling? Default FALSE. |
do_forecast |
Logical; run temporal forecast? Default FALSE. |
do_spatial |
Logical; run spatial interpolation? Default FALSE. |
L |
Number of posterior samples. Default 200. |
tnew |
Forecast horizon (required when |
X_all |
nxpx(T+tnew) covariate array for forecasting (required when
|
spatial |
List for spatial interpolation:
|
n_threads |
Number of OpenMP threads. Default 1. |
verbose |
Logical; print progress? Default TRUE. |
Value
A list with (depending on flags):
FFForward filter output from
spFF3_v2.WinxJ dynamic weight matrix.
WglobalJx1 global (averaged) weight vector.
BS(if
do_BS) T-list of nxqxL sample cubes.forecast(if
do_forecast) List withY_predarray of dimensions nxqxLxT.spatial(if
do_spatial) Named list of L-lists of prediction matrices, one per requested time.
Differences from spFFBS (v1)
-
Gis now a pxp matrix (G_beta) plus a scalarrho, representing the block-diagonal system matrixG = \mathrm{diag}(G_{\beta},\, \rho I_n). Defaults to the identity (G_beta = NULL, rho = 1). -
X(nxpxT array of covariates) replaces thePcube. The observation matrixP_t = [X_t \mid I_n]is formed implicitly inside C++. -
priorshould be in block form; usemake_prior()to convert a fullC_0matrix if needed.
Examples
set.seed(42)
n <- 50; T <- 10; p <- 2; q <- 2
coords <- matrix(runif(n * 2), ncol = 2)
D <- as.matrix(dist(coords))
Y <- array(rnorm(n * q * T), dim = c(n, q, T))
X <- array(rnorm(n * p * T), dim = c(n, p, T))
prior <- make_prior(
m0 = matrix(0, n + p, q),
C0 = diag(n + p),
nu0 = 3,
Psi0 = diag(q),
p = p
)
res <- spFFBS(
Y = Y, X = X, D = D,
grid = list(tau = c(0.8, 0.9), phi = c(1, 2)),
prior = prior,
L = 50
)