| Documentation | Build Status | Code Quality | License & DOI | Downloads |
|---|---|---|---|---|
| ForwardDiff | ReverseDiff (tape) | Enzyme forward | Enzyme reverse | Mooncake reverse | Mooncake forward |
|---|---|---|---|---|---|
A toolkit for composable probabilistic infectious disease modelling in Julia.
- Composable models: Assemble a model from interchangeable infection and observation parts — each infection model owning its own latent process — instead of writing one monolithic model.
- Swap a part to change an assumption: Change the latent process, infection process, or observation model on its own to test how each assumption shapes your conclusions.
- One interface: Every part becomes a Turing /
DynamicPPL model through the
single
as_turing_modelconstructor, so parts nest freely as submodels. The full Turing inference toolbox (NUTS, prior simulation) applies. - Simulate and infer: Generate synthetic data from any model, then run Bayesian inference on the same model with real data.
- A library of parts: Random walks, AR/MA/ARIMA latent processes, renewal and exponential-growth infection models, ODE (SIR/SEIR) processes, Poisson and negative-binomial observations, reporting delays, ascertainment, and aggregation — all interchangeable.
You assemble a model from parts, and ComposableTuringIDModels turns the assembly into
a single Turing model you can simulate from and fit.
Each part is itself a model, joined through the generic as_turing_model
constructor.
Compose a model: an ARIMA-style latent process (a differenced AR) folded into a direct-infections process, observed with Poisson error.
using ComposableTuringIDModels, Distributions, Turing
model = IDModel(
DirectInfections(;
Z = DiffLatentModel(; model = AR(), init = [Normal(), Normal()]),
initialisation = Normal()),
PoissonError())Build a Turing model; missing observations simulate from the prior.
n = 30
prior_model = as_turing_model(model, missing, n)Sample from the prior and inspect the generated quantities.
draw = rand(prior_model)
(; generated_y_t, I_t, Z_t) = prior_model()Condition on data and run inference.
posterior_model = as_turing_model(model, generated_y_t, n)
chain = sample(posterior_model, NUTS(), 1_000)Install the package from the Julia General registry:
using Pkg
Pkg.add("ComposableTuringIDModels")Because every part is interchangeable, the same swap-in/swap-out pattern applies
throughout.
Replace PoissonError() with NegativeBinomialError(), wrap the observation in
a LatentDelay, or change the latent process — without touching the rest of
the model.
Same infection process, two observation assumptions.
latent = DiffLatentModel(; model = AR(), init = [Normal(), Normal()])
infections = DirectInfections(; Z = latent, initialisation = Normal())
poisson_model = IDModel(infections, PoissonError())
negbin_model = IDModel(infections, NegativeBinomialError())That is the point: you compare modelling assumptions by swapping parts, not by rewriting models.
- New here? Start with the Overview and the Composable design page.
- Want worked examples? See the case studies, which fit complete models to real surveillance data.
- Want the full interface? Browse the Public API.
- Want to see the code or report a problem? Check the GitHub repository.
The modelling code in this package is ported and adapted from the
open-source, Apache-2.0 licensed EpiAware package
(CDCgov/Rt-without-renewal,
ported from the fork seabbs/Rt-without-renewal).
ComposableTuringIDModels is a modified, derived work: it has been renamed, re-architected
around the generic as_turing_model constructor, and upgraded to build against
the latest Turing.jl. See the NOTICE file for full attribution and a
summary of the changes, and LICENSE for the Apache-2.0 terms.
We welcome contributions and new contributors! Please open an issue or pull request on GitHub. This package follows ColPrac and the SciML style.
If you use ComposableTuringIDModels in your work, please cite it. Citation metadata lives in CITATION.cff, which GitHub renders as a "Cite this repository" button on the repository page.
Please note that the ComposableTuringIDModels project is released with a Contributor Code of Conduct. By contributing, you agree to abide by its terms.