
Package index
Emulation
Fit a dynamic Bayesian emulator to simulator runs and predict the spatiotemporal output at new inputs. Exact (MCMC-free) posterior updates.
-
prepare_data() - Prepare PDE emulator training and testing data from CSV files
-
emulator_learn() - Fit an FFBS-based dynamic emulator
-
emulator_predict() - Predict simulator output from a fitted emulator
-
print(<spDBL_emulator>)summary(<spDBL_emulator>)predict(<spDBL_emulator>) - Print, summarize and predict from a fitted emulator
Calibration
Infer mechanistic parameters from field data without new PDE solves. Requires an emulator fitted with covariance = "sigma2R"; the sampler uses RStan (suggested package).
-
calibration_prepare() - Prepare a fitted emulator for PDE-free calibration
-
print(<spDBL_calibration_input>)predict(<spDBL_calibration_input>) - Print and predict from a prepared calibration object
-
calibration_validate() - Validate offline calibration predictions against held-out simulations
-
calibration_fit() - Fit modular calibration conditional on emulator posterior draws
-
calibration_predict() - Recover fields at the calibrated observation times and locations
-
summary(<spDBL_calibration>) - Summarize modular calibration samples
-
plot(<spDBL_calibration>) - Plot calibrated mechanistic parameter samples
-
dt_emulation - Example emulation dataset
-
dt_calibration - Saved SIR simulations and synthetic field observations for calibration
Forward filtering and backward sampling
Advanced. The matrix-variate dynamic linear model kernels behind emulator_learn(). Three covariance models: inverse-Wishart (no suffix), scalar variance times a fixed correlation (_sigma2R), and identity (_I).
-
FF() - Forward Filter for the MNIW dynamic linear model
-
FF_sigma2R() - Forward Filter for the scalar-sigma-squared-times-R model
-
FF_I() - Forward Filter with identity right-covariance
-
FF_1step_R_sigma2R() - Single forward filter step (scalar right-covariance, sigma-squared times R)
-
FF_1step_R_I() - Single forward filter step (identity right-covariance)
-
BS() - Backward sampler for the Forward Filter Backward Sampler (FFBS)
-
FFBS() - Forward Filter Backward Sampler (MNIW model)
-
FFBS_sigma2R() - Forward Filter Backward Sampler (scalar sigma-squared-times-R model)
-
FFBS_I() - Forward Filter Backward Sampler (identity right-covariance)
-
FFBS_sampling() - Draw posterior samples from FFBS output (MNIW model)
-
FFBS_sampling_sigma2R() - Draw posterior samples from FFBS output (scalar sigma-squared-times-R model)
-
FFBS_sampling_I() - Draw posterior samples from FFBS output (identity right-covariance)
-
FFBS_predict_exact() - Exact posterior predictive mean using FFBS smoothed states (MNIW model)
-
FFBS_predict_MC() - Monte Carlo prediction using FFBS output (MNIW model)
Large data and episode partitioning
Out-of-core filtering, smoothing and prediction from CSV blocks, grid traversal, autoregressive design construction, and mapping episode blocks back to time.
-
FF_bigdata_R() - Forward Filter for big data stored in CSV files (MNIW model)
-
BS_bigdata_R() - Out-of-core backward smoothing
-
FFBS_predict_bigdata_R() - Out-of-core exact prediction
-
read_big_csv_quick() - Read a rectangular block from a large CSV file
-
generate_grid() - Generate block indices for big data grid traversal
-
generate.grid.exact() - Generate an exact block grid analytically
-
generate.grid.rowsnake() - Generate a flexible block grid with snake traversal
-
generate.grid.lr() - Generate a flexible block grid with left-to-right traversal
-
gen_F_ls_AR1() - Build AR(1) covariate list from a list of response matrices
-
gen_F_ls_AR2() - Build AR(2) covariate list from a list of response matrices
-
gen_F_ls_AR1_EP() - Build AR(1) covariate list for the episode-block model
-
gen_F_ls_AR2_EP() - Build AR(2) covariate list for the episode-block model
-
recover_from_EP_exact() - Recover episode-partitioned data to original time dimension (exact)
-
recover_from_EP_MC() - Recover episode-partitioned posterior samples to original time dimension
-
MNIW_R() - MNIW posterior update
-
MNIW_R_naiive() - Naive MNIW posterior update
-
MNIW_sampler() - Sample from the Matrix Normal Inverse Wishart (MNIW) distribution
-
MNIG_sampler() - Sample from the Matrix Normal Inverse Gamma (MNIG) distribution
-
rmn_chol() - Draw one sample from a matrix-normal distribution (Cholesky parameterisation)
-
rmn_chol_more() - Draw multiple samples from a matrix-normal distribution (Cholesky parameterisation)
-
dMTig() - Log density of the matrix-T distribution with inverse-gamma right covariance
-
check_pds() - Check and repair a matrix to be positive definite and symmetric
-
make_pds() - Force a matrix to be positive definite and symmetric
-
inv_chol() - Invert a matrix via its Cholesky factorisation
-
gen_pd_matrix() - Generate a random positive definite matrix
-
gen_ran_matrix() - Generate a random matrix with entries scaled to \([-1, 1]\)
Model assessment
One-step log posterior predictive densities for each covariance model, and WAIC for MNIW multivariate regression.
-
lppd_IW_1t() - One-step log posterior predictive density (MNIW / inverse-Wishart model)
-
lppd_IG_1t() - One-step log posterior predictive density (scalar sigma-squared-times-R model)
-
lppd_id_1t() - One-step log posterior predictive density (identity right-covariance model)
-
compute_analytical_waic() - Analytical WAIC for an MNIW multivariate regression posterior
-
compute_sample_waic() - WAIC from paired coefficient and covariance draws
-
gen_gp_kernel() - Compute a Gaussian Process covariance kernel matrix
-
gen_exp_kernel() - Compute an exponential GP kernel matrix
-
gen_expsq_kernel() - Compute a squared-exponential (Gaussian) GP kernel matrix
-
gen_Jt() - Compute the cross-covariance matrix between observed and new locations
-
SIR() - Right-hand side of the spatially extended SIR ODE
-
gen_pde() - Simulate a spatially extended SIR PDE model
-
gen_ffbs_data() - Generate synthetic FFBS data in memory
-
gen_ffbs_csv() - Generate synthetic FFBS data and write to CSV files
-
gen_calibrate_data() - Generate synthetic calibration data with correlated discrepancy
-
gen_calibrate_data_uncorr() - Generate synthetic calibration data with uncorrelated discrepancy
-
gen_prior_u_tau2() - Sample prior discrepancy trajectory and variance sequence
-
quick_heat() - Quick raster heatmap
-
quick_save() - Save a ggplot to a timestamped PNG file
-
plot_panel_heatmap_9() - Plot a 3-by-3 panel of heatmaps across selected time stamps
-
plot_panel_heatmap_9_cal() - Plot a 3-by-3 panel of calibration heatmaps
-
plot_panel_heatmap_9_cal_nolab() - Plot a 3-by-3 panel of calibration heatmaps without axis labels
-
cal_errorbar() - Compute median and 95% credible interval across rows
-
cal_errorbar_mean() - Compute mean and 95% credible interval across rows
Legacy calibration helpers
Building blocks from the research code of Banerjee et al. (2025), where calibration solved the PDE at every MCMC iteration. No other package function calls them. New work should use calibration_prepare() and calibration_fit().
-
update_y_eta() - Update the likelihood of observations given PDE parameters (Monte Carlo)
-
update_y_eta_one() - Update the likelihood of observations given PDE parameters (single sample)
-
update_muSigma_eta_one() - Compute posterior predictive mean and covariance without sampling (single sample)
-
sample_y_eta_one() - Draw predictive samples from a precomputed mean and covariance
-
cal_Bt_bt() - Update the posterior mean and covariance of the discrepancy field
-
scale_uniform() - Scale a vector to the unit interval via a uniform transformation
-
scale_back_uniform() - Invert a uniform scaling transformation
-
expit() - Logistic (expit) function
-
cal_jacobian_logit_uniform() - Log absolute Jacobian of the logit-uniform transformation
-
spDBLspDBL-package - spDBL: Dynamic Bayesian Learning for Spatiotemporal Mechanistic Models