Package: dgtf 0.1.0

Meini Tang

dgtf: Variational and Monte Carlo Inference for Bayesian State-Space Models of Count Data

Bayesian inference for a general class of state-space models for count data, providing a unified interface to variational Bayes and Markov chain Monte Carlo. Models are assembled from modular components for the observation distribution, link function, gain function, lag distribution, system equation, and system error, and support Poisson and negative binomial observations together with seasonality terms. The model class and the hybrid variational approximation are described in Tang and Prado (2026) <doi:10.1016/j.csda.2026.108368>.

Authors:Meini Tang [aut, cre], Raquel Prado [aut]

dgtf_0.1.0.tar.gz
dgtf_0.1.0.zip(r-4.7-x86_64)dgtf_0.1.0.zip(r-4.7-arm64)dgtf_0.1.0.zip(r-4.6-x86_64)dgtf_0.1.0.zip(r-4.6-arm64)
dgtf_0.1.0.tar.gz(r-4.7-arm64)dgtf_0.1.0.tar.gz(r-4.7-x86_64)dgtf_0.1.0.tar.gz(r-4.6-arm64)dgtf_0.1.0.tar.gz(r-4.6-x86_64)
dgtf_0.1.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION
card.svg |card.png
dgtf/json (API)

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

Bug tracker:https://github.com/minimeini/dgtf/issues

Uses libs:
  • openblas– Optimized BLAS
  • c++– GNU Standard C++ Library v3
Datasets:
  • covid_scz_2020 - Daily new COVID-19 cases, Santa Cruz County, California
  • sim_hawkes - Default simulated count series with ground-truth model and latents

On CRAN:

Conda:

openblascpp

3.00 score 67 exports 22 dependencies

Last updated from:fddeb62e87. Checks:10 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64OK162
linux-devel-x86_64OK198
source / vignettesOK264
linux-release-arm64OK202
linux-release-x86_64OK422
windows-devel-arm64OK296
windows-devel-x86_64OK256
windows-release-arm64OK297
windows-release-x86_64OK194
wasm-releaseOK139

Exports:as_dgtf_simas_settingsdgtfdgtf_comparedgtf_compare_paramsdgtf_compare_plotdgtf_default_algo_settingsdgtf_default_modeldgtf_distributed_lagdgtf_forecastdgtf_forecast_fitdgtf_hawkesdgtf_inferdgtf_koyckdgtf_modeldgtf_nb_ardgtf_poisson_ardgtf_posterior_predictivedgtf_priordgtf_simulatedgtf_simulate_modeldist_betadist_gammadlognorm0dnbinom0epiestim_baselineerr_constanterr_gaussianessextract_state_drawsgain_exponentialgain_identitygain_logisticgain_rampgain_softplushalf_cauchyhalf_normalhalf_tinv_gammalag_lognormallag_nbinomlag_uniformlink_exponentiallink_identitylink_logisticlognorm2serialmcmc_controlnormalobs_nbinomobs_nbinom_pobs_normalobs_poissonparam_recoveryplot_dgtf_lagplot_dgtf_yplot_dgtf_y_compareposterior_predictrhatseas_noneseas_periodseas_weeklyserial2lognormsys_identitysys_nbinomsys_shiftuniformvb_control

Dependencies:BHclicpp11farverggplot2gluegtableisobandlabelinglifecyclepgR6RColorBrewerRcppRcppArmadilloRcppProgressrlangS7scalesvctrsviridisLitewithr

COVID modeling with dgtf
1. Load Data | 2. Model configurations | 3. Posterior inference | 4. Posterior predictive checks and HVA-versus-MCMC comparison | 5. In-sample comparison | EpiEstim baseline | 6. Out-of-sample forecasting

Last update: 2026-10-28
Started: 2026-10-28

Getting started with dgtf
1. The DGTF model class | 2. Simulate | 3. Inference | 3.1 Prior specification | 3.2 Fitting the model | 3.3 Recovery check | 4. Inspecting the fit | 4.1 Posterior plots | 4.2 Posterior predictive check | 4.3 Forecasting | 5. Switching the inference method | 6. Model comparison | 6.1 Build and fit the alternative models | 6.2 Visual comparison | 6.3 Tabular comparison | 7. EpiEstim baseline

Last update: 2026-10-28
Started: 2026-10-28

Readme and manuals

Help Manual

Help pageTopics
Coerce a list of simulated data to a 'dgtf_sim' objectas_dgtf_sim
Daily new COVID-19 cases, Santa Cruz County, Californiacovid_scz_2020
Fit a DGTF modeldgtf
Side-by-side comparison of fitted DGTF models, PPC objects, or forecastsdgtf_compare
Per-parameter posterior summaries across multiple fitsdgtf_compare_params
Compare fitted DGTF model plotsdgtf_compare_plot
Distributed lag modeldgtf_distributed_lag
Out-of-sample forecasts from a DGTF fitdgtf_forecast_fit
Discretized Hawkes modeldgtf_hawkes
Koyck distributed lag modeldgtf_koyck
Build a DGTF modeldgtf_model
Negative binomial AR model with time-varying coefficientsdgtf_nb_ar
Poisson AR model with time-varying coefficientsdgtf_poisson_ar
Aggregate priors for inferencedgtf_prior
Simulate from a DGTF modeldgtf_simulate_model
System error distribution componentsdgtf-err err_constant err_gaussian
Gain function componentsdgtf-gain gain_exponential gain_identity gain_logistic gain_ramp gain_softplus
Lag distribution componentsdgtf-lag lag_lognormal lag_nbinom lag_uniform
Link-function componentsdgtf-link link_exponential link_identity link_logistic
Observation distribution componentsdgtf-obs obs_nbinom obs_nbinom_p obs_normal obs_poisson
Prior distribution constructorsdgtf-priors dist_beta dist_gamma half_cauchy half_normal half_t inv_gamma normal uniform
Seasonality constructorsdgtf-seasonality seas_none seas_period seas_weekly
System-equation componentsdgtf-sys sys_identity sys_nbinom sys_shift
EpiEstim R_t baseline for model comparisonepiestim_baseline
Effective sample size of an MCMC chainess
Latent state posterior drawsextract_state_draws
Fitted values, residuals and predictions of a fitted DGTF modelfitted.dgtf_fit predict.dgtf_fit residuals.dgtf_fit
MCMC controlmcmc_control
Posterior recovery of static parameters against truthparam_recovery
Lag distribution comparison plotplot_dgtf_lag
In-sample fit and out-of-sample forecast on one plotplot_dgtf_y
Multi-method in-sample + forecast comparison plotplot_dgtf_y_compare
Plot a posterior predictive forecastplot.dgtf_forecast
Plot a simulated DGTF seriesplot.dgtf_sim
Posterior predictive drawsposterior_predict posterior_predict.dgtf_fit
Split-Rhat (Gelman-Rubin) convergence diagnosticrhat
Default simulated count series with ground-truth model and latentssim_hawkes
Summarize a fitted DGTF modelprint.summary.dgtf_fit summary.dgtf_fit
Hybrid variational approximation controlvb_control