EpiBranch.jl is a Julia package for stochastic branching process simulation of infectious disease outbreaks. It brings together the functionality of several R packages (ringbp, simulist, epichains, superspreading, pepbp) in a single package with one shared simulation engine.
The package can be installed using
using Pkg
Pkg.add(url="https://github.com/epiforecasts/EpiBranch.jl")using EpiBranch
using Distributions
model = BranchingProcess(NegBin(2.5, 0.16), LogNormal(1.6, 0.5))
iso = Isolation(delay = Exponential(2.0))
ct = ContactTracing(probability = 0.5, delay = Exponential(1.5))
results = simulate_batch(model, 500;
interventions = [iso, ct],
attributes = Disease(incubation_period = LogNormal(1.5, 0.5)),
sim_opts = SimOpts(max_cases = 5000),
)
containment_probability(results)In R, branching process simulation, chain statistics, line list generation, intervention modelling, and offspring fitting live in separate CRAN packages with separate codebases. This means, for example, that likelihoods cannot be evaluated under interventions because the simulation engine and the likelihood code don't share a common interface.
Julia's multiple dispatch makes it natural to unify these into a single package where components compose freely:
- Same
loglikelihoodfunction works with offspring counts, chain sizes, or chain lengths — dispatch on the data type selects the right method - Same
fitfunction estimates offspring distribution parameters from any of those data types - Same simulation engine runs with or without interventions, and the simulation-based likelihood reuses it directly — enabling likelihood evaluation under interventions
- Stack interventions freely: isolation, contact tracing, ring vaccination, and time-dependent scheduling all go in a vector and interact through competing risks on individual state
- AD-compatible likelihoods work with Turing.jl for Bayesian inference — including parameter estimation under interventions, which is not possible when simulation and inference live in separate packages
Benchmark scripts comparing EpiBranch.jl against R equivalents (epichains, ringbp) are in benchmarks/. See the benchmarks page in the documentation for details.
For information on how to use the package, see the documentation.