New Tool Fits Waiting-Time Distributions to Improve Compartmental Epidemic
Researchers have introduced GenErlangFit, an open-source R package and interactive Shiny web application designed to estimate empirical waiting-time distributions for compartmental epidemic models. In infectious disease epidemiology, compartmental frameworks r
Illustrative imageResearchers have introduced GenErlangFit, an open-source R package and interactive Shiny web application designed to estimate empirical waiting-time distributions for compartmental epidemic models. In infectious disease epidemiology, compartmental frameworks represented as ordinary differential equations or continuous-time Markov chains routinely assume constant transition rates between health states. This widespread assumption implicitly imposes an exponential distribution of waiting times within each compartment, such as the latent or infectious period. However, this foundational simplification contradicts observed clinical data for many pathogens and distorts outbreak projections. GenErlangFit addresses this challenge by providing a data-driven workflow that fits Erlang and Erlang-exponential distributions to empirical duration data. By combining maximum likelihood estimation with parametric bootstrap hypothesis testing, the software helps researchers identify parsimonious model structures consistent with observed biological dynamics while maintaining the analytical tractability of differential equations.
The reliance on constant transition rates in compartmental epidemiology introduces structural limitations when projecting outbreak trajectories and evaluating public health policies. This assumes many individuals experience unrealistically brief dwell times while others remain extraordinarily long, leaving low density near the actual mean duration. Epidemiological research shows that this divergence from empirical reality fundamentally alters modeled trajectories, distorts calculations of the basic reproduction number, and misjudges intervention effectiveness. While integro-differential equations can accommodate arbitrary waiting-time distributions, they present substantial practical obstacles. Such formulations remain unfamiliar to most public health modelers lacking advanced mathematical training, are unsupported by widely used simulation packages, and sacrifice the extensive analytical infrastructure developed for ordinary differential equations.
To overcome these limitations while preserving mathematical tractability, modelers frequently implement the linear chain trick, an established technique that represents a single disease compartment as a series of identical substates. In this formulation, an individual progresses through an ordered chain of identical compartments, each governed by an identical exponential substate transition rate. Traversing this sequence yields an Erlang-distributed total waiting time characterized by two parameters: the integer substate count and the transition rate. The resulting distribution exhibits a mean equal to the substate count divided by the transition rate, alongside a variance equal to the square of the mean divided by the substate count. With only two parameters, Erlang distributions can approximate a broad spectrum of unimodal shapes commonly fitted to epidemiological durations, including lognormal, Weibull, and Gamma distributions, without sacrificing the computational efficiency of ordinary differential equations.
Despite the theoretical familiarity of the linear chain trick, applied epidemiological modeling has long lacked accessible, data-driven workflows for determining the optimal number of substates from empirical observations. Conventional statistical software packages are typically engineered to fit continuous-parameter Gamma or custom parametric distributions, whereas the linear chain trick strictly requires an integer number of discrete substates. While researchers can attempt to select parameters by matching the empirical mean and variance, this moment-matching approach is statistically inefficient and routinely yields fractional values that require arbitrary rounding, degrading agreement with empirical moments. Furthermore, standard Erlang distributions remain constrained in flexibility, struggling to capture empirical distributions exhibiting pronounced rightward skewness or heavy tail behavior. These persistent obstacles have historically forced modelers to rely on guesswork when deciding how many substates to introduce into operational disease transmission models.
GenErlangFit resolves these structural limitations by supporting both standard Erlang distributions and an extended formulation known as the Erlang-exponential distribution. In this expanded architecture, a disease compartment is modeled as a chain of identical substates followed by a final, non-identical exponential stage governed by a unique transition rate. This three-parameter configuration enables the model to reproduce empirical distributions characterized by pronounced positive skewness and distinct tail dynamics that standard Erlang distributions cannot adequately capture. Within compartmental ordinary differential equation models, this Erlang-exponential structure is implemented by adding an extra substate with its own outbound rate parameter, a technique previously employed in cellular biology to model cell division times. By extending the linear chain trick to include this hybrid configuration, GenErlangFit provides modelers with the mathematical flexibility needed to represent heterogeneous waiting times while preserving compatibility with mainstream simulation frameworks.
The computational engine powering GenErlangFit executes parameter estimation through maximum likelihood methods, systematically identifying optimal parameters across user-supplied empirical duration datasets. The software determines the integer substate count alongside the substate transition rate for Erlang models, as well as the additional rate parameter required for Erlang-exponential distributions. Rather than acting as a forward epidemic simulator, the tool operates upstream in the analytical pipeline, focusing specifically on model specification and parameter identification. Researchers can subsequently transfer the resulting optimal parameters into any standard ordinary differential equation simulation framework. To accommodate diverse user workflows, the package provides three distinct fitting modalities: users may estimate Erlang and Erlang-exponential models simultaneously for direct comparative evaluation, or fit either distribution individually to specify custom initial parameter guesses and fine-tune optimization routines according to the specific characteristics of their empirical datasets.
A core methodological feature within GenErlangFit is its integration of parametric bootstrap hypothesis testing to assess model adequacy and goodness of fit rigorously. Rather than relying solely on point estimates, the software evaluates whether observed empirical data could plausibly have been generated by the fitted Erlang or Erlang-exponential distribution. The application calculates an empirical test statistic between the observed dataset and the fitted distribution, subsequently comparing this observed metric against an empirical null distribution derived from synthetic datasets repeatedly sampled from the fitted model. The resulting p-value quantifies the probability of observing data as extreme as the empirical sample under the null hypothesis that the fitted distribution represents the true data-generating process. Higher p-values denote closer alignment between the model and empirical observations, whereas values below a chosen significance threshold indicate that the fitted distribution is statistically inconsistent with the observed data.
To maximize statistical flexibility across diverse data types, GenErlangFit provides users with multiple goodness-of-fit metrics, incorporating the Kolmogorov-Smirnov, Anderson-Darling, and Cramér-von Mises test statistics alongside customizable significance levels and bootstrap sample counts. By default, the software applies the Kolmogorov-Smirnov statistic at a five percent significance level, classifying outcomes into an unambiguous binary decision of passing or failing. Beyond evaluating goodness of fit for a single specified model, GenErlangFit includes an automated feature that identifies the most parsimonious model structure consistent with the data. This algorithm searches for the smallest integer substate count that maintains a passing goodness-of-fit test at the designated significance level. By pinpointing the minimal number of compartments required to generate a distribution statistically indistinguishable from observations, the tool prevents unnecessary model complexity, which is particularly vital when working with sparse epidemiological datasets where overparameterization must be avoided.
The implementation of GenErlangFit spans both a programmatic software library and an interactive, browser-based graphical user interface to serve technical and non-technical researchers alike. The R package encapsulates the complete mathematical and statistical workflow within a primary function that requires only a numeric vector of positive waiting times, accepting optional arguments for model selection, initial optimization conditions, and bootstrap parameters. Concurrently, the Shiny web application provides an intuitive graphical interface structured around four functional tabs: About, Data Entry, Compute Fit, and Goodness of Fit. Users can upload comma-separated values files containing non-negative waiting-time observations, inspect data distributions through interactive histograms, execute simultaneous or single-distribution maximum likelihood estimation, and visualize fitted curves overlaid directly onto empirical histograms alongside comprehensive summary tables reporting parameter estimates, log-likelihood values, test statistics, p-values, and model adequacy decisions.
To demonstrate the practical utility and epidemiological consequences of data-driven substate selection, the authors applied GenErlangFit to published COVID-19 latent period data originally gathered by Xin and colleagues. In that empirical study, researchers monitored a cohort of 177 closely tracked contacts of confirmed cases, estimating the latent period between viral exposure and the onset of detectable shedding, which yielded an inferred mean duration of 5.5 days and a 95th percentile of 10.6 days. Because the original clinical dataset contained interval-censored windows rather than exact transition times, exact latent periods were sampled for each participant to demonstrate the software workflow. When fitted to these empirical latent period data, GenErlangFit determined that an Erlang distribution with four substates represented the optimal mathematical structure, providing an analytically tractable ordinary differential equation formulation that accurately reflected the observed variance and duration profile.
The authors subsequently integrated these fitted parameters into epidemic simulations, comparing a standard single-stage exposed SEIR model against a four-stage SE4IR model parameterized to match the same early exponential growth rate and identical 5.5-day mean latent period. When simulating an unmitigated outbreak, the exponential model projected that 82 percent of the population would become infected, whereas the four-stage Erlang model predicted an 87 percent cumulative attack rate. However, when the authors introduced a public health intervention that reduced the transmission rate by 50 percent at week six, the discrepancy between the two models expanded dramatically.
Subject of Research: Estimation of empirical waiting-time distributions for compartmental epidemic models
Article Title: GenErlangFit: a tool for estimating empirical waiting-time distributions to inform compartmental epidemic models
Article References: Murali, V., Nande, A., & Hill, A. L. (2026). GenErlangFit: a tool for estimating empirical waiting-time distributions to inform compartmental epidemic models. BMC Global and Public Health, 4(1), Article 116. https://doi.org/10.1186/s44263-026-00344-0
Image Credits: AI Generated
DOI: 10.1186/s44263-026-00344-0
Keywords: compartmental epidemic models, GenErlangFit, waiting-time distributions, linear chain trick, Erlang distribution, Erlang-exponential distribution, maximum likelihood estimation, parametric bootstrap, ordinary differential equations, SEIR model, COVID-19 latent period, basic reproduction number, Markov chains, Kolmogorov-Smirnov test, goodness-of-fit testing, mathematical biology
News Source: Kristina Jarvis. (November 27, 2026). New Tool Fits Waiting-Time Distributions to Improve Compartmental Epidemic Model Accuracy. Scienmag.
