denim: An R package for deterministic compartmental models with flexible dwell‐time distributions
Open Access
- 12 February 2026
- journal article
- Published by Wiley in Methods in Ecology and Evolution
- Vol. 17 (4) , 1060-1068
Abstract
Compartmental models are widely used for dynamical systems where states are discrete, such as in infectious disease epidemiology with the so‐called Susceptible‐Infectious‐Recovered (SIR) framework. For mathematical simplicity, rates of transition between compartments are generally assumed to be independent of the dwell time (or secondary timescale in survival analysis): they are either constant or dependent on the epidemiological time (or primary timescale in survival analysis) only, either directly (e.g. environmental or behavioural forcings in epidemiological models) or indirectly through dependence on other variables of the system (e.g. the force of infection in epidemiological models). In some domains of application, this memoryless assumption leads to distributions of dwelling times that are incompatible with those observed in data (e.g. infectious periods for childhood diseases), which can lead to serious problems since the model predictions are highly sensitive to the exact shape of these distributions. Here, we propose a deterministic, continuous‐variable, numerical modelling approach that allows full flexibility on the dwell‐time distributions. The accompanying denim package provides a user‐friendly interface to implement our proposed method through a dedicated language for model definition. The package is open source and available on CRAN. As more detailed data on the clinical process of infections become available, the denim package will be extremely useful for building more realistic epidemiological models that provide more accurate projections.Keywords
All Related Versions
Funding Information
- Wellcome Trust (225167/A/22/Z)
This publication has 14 references indexed in Scilit:
- Serodynamics: A primer and synthetic review of methods for epidemiological inference using serological dataEpidemics, 2024
- The effects of local homogeneity assumptions in metapopulation models of infectious diseaseRoyal Society Open Science, 2022
- A new formulation of compartmental epidemic modelling for arbitrary distributions of incubation and removal timesPLOS ONE, 2021
- Effects of the infectious period distribution on predicted transitions in childhood disease dynamicsJournal of The Royal Society Interface, 2013
- Epidemic Percolation Networks, Epidemic Outcomes, and InterventionsInterdisciplinary Perspectives on Infectious Diseases, 2011
- Infectiousness of smallpox relative to disease age: estimates based on transmission network and incubation periodEpidemiology and Infection, 2006
- Appropriate Models for the Management of Infectious DiseasesPLOS Medicine, 2005
- The estimation of SARS incubation distribution from serial interval data using a convolution likelihoodStatistics in Medicine, 2005
- Realistic Distributions of Infectious Periods in Epidemic Models: Changing Patterns of Persistence and DynamicsTheoretical Population Biology, 2001
- Semi-markov processes and their applicationsJournal of Mathematical Sciences, 1975