betaFeedback

WorksMathematics

Higher order schemes for the numerical solution of integro-differential equation-based age-of-infection models with time-dependent contact rates

Abstract

Age-of-infection models, formulated as integro-differential equations (IDEs), provide elegant mathematical descriptions for the spread of infectious diseases. In contrast to ordinary differential equation (ODE)-based models, IDE-based models can accommodate general distributions of transition times between disease stages. Yet, the accurate numerical assessment of the solution of IDE models remains challenging. Here, we extend a recently proposed fixed-point method based on Gregory quadrature. We generalize the formulation to time-dependent contact rates whose changes at discrete time points are represented by continuously differentiable sigmoidal interpolants, and suggest additional finite difference approximations to obtain higher-order schemes for susceptible, infected and recovered subpopulations. The resulting numerical schemes achieve convergence orders of two, three and four for all three subpopulations, enabling accurate and flexible simulations of IDE-based epidemic models with general sojourn time distributions and changing contact patterns.

Highlights

  • Time-dependent contact rates for age-of-infection models

  • Higher order numerical schemes including infected and recovered populations

  • Combination of Gregory quadrature rules with finite difference approximations

  • Numerical validation of higher order convergence for discretized model

  • Assessment of extended model with respect to its impact on epidemic outcomes

Introduction

Ordinary differential equation (ODE) models are among the most popular tools for describing and analyzing infectious disease dynamics in a population [1]. These models allow for the computation of reproduction numbers and (endemic) equilibria; however, they implicitly assume exponentially distributed sojourn times in the different disease states, an assumption that is often unrealistic [2]. More complex sojourn-time distributions can be represented within the ODE framework using the Linear Chain Trick (LCT), which yields Erlang-distributed transition times [3], or its generalizations [4, 5, 6]. Although these approaches provide greater modeling flexibility and can reveal dynamics absent from simpler ODE models [7], they require the introduction of auxiliary states. This increases the dimensionality of the model and can lead to intricate systems, particularly when complex sojourn-time distributions are considered.

A mathematically direct and more elegant alternative to expanded ODE models is provided by integro-differential equation-based (IDE) models which accommodate general sojourn-time distributions without

Email addresses: [email protected] (Anna Wendler), [email protected] (Jan Hasenauer), [email protected] (Martin J. Kühn) introducing auxiliary states. IDE-based epidemic models were already considered by Kermack and McKendrick [8] and by Hethcote and Tudor [9]. These models have also commonly been referred to as age-of-infection models [10, 11, 12, 13, 14].

A substantial body of analytical work has established the theoretical foundations for SIR-type age-of-infection models. These contributions include analyses of the classical Kermack–McKendrick model [15], final-size relations [16], reproduction numbers and final sizes under heterogeneous mixing [10], endemic equilibria [17], and the dynamics of disease-specific models [18]. More recently, the COVID-19 pandemic motivated the development of more advanced models that distinguish between symptomatic and asymptomatic infections [19, 20]. Further work also demonstrated that the long-term dynamics can depend on the distributional shape of the infectious period [21]. Despite this extensive foundation, important questions concerning the accurate and efficient numerical solution of nonlinear IDE-based epidemic models remain open. The lack of established numerical methods represents a practical barrier to the broader use of these models, particularly when compared with the wide range of mature integration schemes available for ODE models.

Numerical methods for IDE-based epidemic models are a field of active research, and the absence of user-friendly computational tools remains a recognized limitation [22]. An early contribution was the nonstandard scheme developed by Lubuma and Terefe for an SIS model [23]. Building on this, Messina, Pezzella, and Vecchio introduced a nonstandard finite difference scheme that applies modified left- and right-rectangle rules to different terms of the integral equation [14, 24]. This construction resolves the nonlinear coupling between the susceptible population and the force of infection while preserving positivity, monotonicity, and boundedness independently of the step size hh. The scheme was subsequently applied to models incorporating heterogeneous population mixing [25] and behavioral changes in contact patterns [26], and it underlies the EPITIME computational framework for behavioral epidemic modeling [27]. We further extended the approach to a SECIR-type IDE model that includes disease-related deaths and established preservation properties for its eight compartments and the flows between them [20]. Despite these advantages, the nonstandard scheme is only first-order convergent.

Enabling efficient, high-accuracy simulations of complex models demands higher-order methods. Promising approaches have been given by [14, 28], where the authors combine a fixed-point iteration with Gregory’s quadrature method for the differential equation of the susceptible population. The Gregory quadrature weights used for methods of order n∈Nn \in\mathbb{N} are obtained when adding further correction terms to the composite trapezoidal rule; see also [29].

In this paper, we consider a generalized version of the continuous IDE-based model of [14, 28], allowing for time-dependent contact rates and the isolation of infected individuals as in [20] for which we extend the numerical scheme accordingly. More explicitly, we examine the convergence for scenarios with changing contact rates, e.g., due to nonpharmaceutical interventions and apply kk-times continuously differentiable interpolation functions to smooth the transition step. Using the fixed-point iteration of [14, 28] and higher-order finite differences, we develop combined higher-order methods, which are not restricted to but numerically validated for orders n∈{2,3,4}n \in\{2, 3, 4\}, for the differential equations describing the susceptible, infected, and recovered population.

The paper is structured as follows: In § 3, we introduce the generalized continuous IDE formulation. In § 4, we present the discretization of the continuous formulation through our suggested numerical scheme. In § 5, we provide numerical results for different aspects of a ground truth solution and the suggested numerical scheme before drawing a conclusion in § 6.

An age-of-infection model through a continuous formulation with integro-differential equations

Preliminaries and general description of dynamics

We consider a continuous SIR-type epidemic model that subdivides the population into the following three, time-dependent compartments:

  • Susceptible individuals S:R→R≥0S : \mathbb{R} \to\mathbb{R}_{\ge0} who have not been infected with the disease yet but are infected upon contact with a nonisolated infected individual with probability ρ\rho (that may depend on the time since infection);

  • Infected individuals I:R→R≥0I : \mathbb{R} \to\mathbb{R}_{\ge0} who are infected and infectious;

  • Recovered individuals R:R→R≥0R : \mathbb{R} \to\mathbb{R}_{\ge0} who are immune through prior infection and cannot be infected again.

We define the contact rate ϕ:R→R≥0\phi: \mathbb{R} \to\mathbb{R}_{\ge0}, the transmission probability ρ:R≥0→[0,1]\rho: \mathbb{R}_{\ge0} \to[0,1], and the fraction of infected individuals that is not isolated as ξ:R≥0→[0,1]\xi: \mathbb{R}_{\ge0} \to[0,1]. While ϕ\phi is evaluated along with the compartments, the functions ρ\rho and ξ\xi depend on the time since infection. Correspondingly, γIR:R≥0→[0,1]\gamma_I^R : \mathbb{R}_{\ge0} \to[0,1] denotes the survival function of the sojourn time distribution in the infected compartment. It is monotonically decreasing, satisfies γIR(0)=1\gamma_I^R(0)=1, and is assumed to be continuously differentiable on (0,∞)(0,\infty), with

∫0∞γIR(s) ds<∞.\int_0^\infty\gamma_I^R(s)\,\mathrm{d}s < \infty.

Thus, the expected sojourn time is finite and individuals eventually leave the infected compartment. These infection age-dependent functions also govern the future evolution of individuals infected before time zero. With lim⁡t→−∞S(t)=N\lim_{t\to-\infty} S(t)=N, we define the change in the susceptible population by

S′(t)=ϕ(t)NS(t)∫0∞ρ(s)ξ(s)γIR(s)S′(t−s) ds.(1)S'(t)=\frac{\phi(t)}{N}S(t)\int_0^\infty\rho(s)\xi(s)\gamma_I^R(s)S'(t-s)\,\mathrm{d}s. \tag*{(1)}

The corresponding cohort expressions for the number of individuals in infected and recovered state are

I(t)=−∫−∞tγIR(t−s)S′(s) ds,(2)I(t)=-\int_{-\infty}^{t}\gamma_I^R(t-s)S'(s)\,\mathrm{d}s, \tag*{(2)}
R(t)=−∫−∞t(1−γIR(t−s))S′(s) ds.R(t)=-\int_{-\infty}^{t}\left(1-\gamma_I^R(t-s)\right)S'(s)\,\mathrm{d}s.

For a shorter notation, we follow [24] and set

A(s)=ρ(s)ξ(s)γIR(s),β(t)=ϕ(t)N,A(s)=\rho(s)\xi(s)\gamma_I^R(s), \qquad\beta(t)=\frac{\phi(t)}{N},

to also use

S′(t)=β(t)S(t)∫−∞tA(t−s)S′(s) ds.(3)S'(t)=\beta(t)S(t)\int_{-\infty}^{t}A(t-s)S'(s)\,\mathrm{d}s. \tag*{(3)}

Finite-history approximation

We assume that the total population N∈NN \in\mathbb{N} is constant and choose a simulation start T~≤0\widetilde{T} \le0, which does not necessarily coincide with the start of the epidemic. To obtain a finite-history formulation, we approximate the infection-age distribution at T~\widetilde{T} by assigning infection age zero to all individuals infected at that time. The resulting approximation error generally depends on the choice of T~\widetilde{T}. For the initial values, we require S(T~)+I(T~)+R(T~)=NS(\widetilde{T}) + I(\widetilde{T}) + R(\widetilde{T}) = N. The case I(T~)=0I(\widetilde{T}) = 0 is trivial, with the system remaining in the disease-free equilibrium (S(T~),0,R(T~))(S(\widetilde{T}), 0, R(\widetilde{T})). Commonly, the simulation start is chosen as T~=0\widetilde{T} = 0 together with R(T~)=0R(\widetilde{T}) = 0; see [14, 15].

Mathematically, we proceed as follows and split the integral in (3) as

S′(t)=β(t)S(t)(∫T~tA(t−s)S′(s) ds+BT~(t)),(4)S'(t) = \beta(t) S(t) \left(\int_{\widetilde{T}}^t A(t-s)S'(s)\,\mathrm{d}s + B_{\widetilde{T}}(t)\right), \tag*{(4)}
BT~(t):=∫−∞T~A(t−s)S′(s) ds.(5)B_{\widetilde{T}}(t) := \int_{-\infty}^{\widetilde{T}} A(t-s)S'(s)\,\mathrm{d}s. \tag*{(5)}

The function BT~B_{\widetilde{T}} contains the contribution from infections predating T~\widetilde{T}. To approximate this contribution, we proceed as [16, 28] and assume that all infected at time T~\widetilde{T} have infection age zero. However, in order to allow simulation starts after the occurrence of the first infection(s) of the epidemic, we need to take into account potential recoveries. Thus, we have

BT~(t)≈A(t−T~)(∫t−T~∞S′(t−s) ds+R(T~))=(S(T~)−N+R(T~))A(t−T~)=−I(T~)A(t−T~),(6)\begin{aligned} B_{\widetilde{T}}(t) &\approx A(t-\widetilde{T})\left(\int_{t-\widetilde{T}}^\infty S'(t-s)\,\mathrm{d}s + R(\widetilde{T})\right) \\ &= \left(S(\widetilde{T}) - N + R(\widetilde{T})\right) A(t-\widetilde{T}) \\ &= -I(\widetilde{T})A(t-\widetilde{T}), \tag*{(6)} \end{aligned}

This representation is exact for a cohort that is newly infected at T~\widetilde{T}. For a population with a nontrivial infection-age distribution at T~\widetilde{T}, it is generally an approximation to the older history. With T~=0\widetilde{T} = 0 and R(T~)=0R(\widetilde{T}) = 0, it yields the initialization considered in [28 Eq. 2].

The error describing the difference between the full and approximated historical contributions is

ES′,T~(t):=BT~(t)+I(T~)A(t−T~).(7)E_{S',\widetilde{T}}(t) := B_{\widetilde{T}}(t) + I(\widetilde{T})A(t-\widetilde{T}). \tag*{(7)}

For the sake of a simplified presentation, we do not distinguish the notation for the functions SS, II, RR defined on R\mathbb{R} through (1) and (2) and their corresponding counterparts defined through the following system using Assumption (6), i.e., on the left-closed interval with finite history [T~,t)[\widetilde{T}, t). The finite-history model with the derivative for S(t)S(t) obtained using (6) is given by

S′(t)=β(t)S(t)(∫T~tA(t−s)S′(s) ds−I(T~)A(t−T~))(8)S'(t) = \beta(t)S(t)\left(\int_{\widetilde{T}}^t A(t-s)S'(s)\,\mathrm{d}s - I(\widetilde{T})A(t-\widetilde{T})\right) \tag*{(8)}

and

I(t)=γIR(t−T~)I(T~)−∫T~tγIR(t−s)S′(s) ds,R(t)=R(T~)+(1−γIR(t−T~))I(T~)−∫T~t(1−γIR(t−s))S′(s) ds=N−S(t)−I(t).(9)\begin{aligned} I(t) &= \gamma_I^R(t-\widetilde{T})I(\widetilde{T}) - \int_{\widetilde{T}}^t \gamma_I^R(t-s)S'(s)\,\mathrm{d}s, \\ R(t) &= R(\widetilde{T}) + \left(1-\gamma_I^R(t-\widetilde{T})\right)I(\widetilde{T}) - \int_{\widetilde{T}}^t \left(1-\gamma_I^R(t-s)\right)S'(s)\,\mathrm{d}s \\ &= N-S(t)-I(t). \tag*{(9)} \end{aligned}

Here, the first term in I(t)I(t) describes survivors of the cohort assigned infection age zero at T~\widetilde{T}; the integral describes survivors of subsequent infections. Analogously to (7), we can define

EI,T~(t):=∫−∞T~γIR(t−s)S′(s) ds+γIR(t−T~)I(T~)E_{I,\widetilde{T}}(t) := \int_{-\infty}^{\widetilde{T}} \gamma_I^R(t-s)S'(s)\,\mathrm{d}s + \gamma_I^R(t-\widetilde{T})I(\widetilde{T})

and

ER,T~(t):=∫−∞T~(1−γIR(t−s))S′(s) ds+R(T~)+(1−γIR(t−T~))I(T~)(10)E_{R,\widetilde{T}}(t) := \int_{-\infty}^{\widetilde{T}} (1-\gamma_I^R(t-s))S'(s)\,\mathrm{d}s + R(\widetilde{T}) + (1-\gamma_I^R(t-\widetilde{T}))I(\widetilde{T}) \tag*{(10)}

Particular results for exponential sojourn time distribution

While our motivation for IDE formulations is explicitly based on nonexponential sojourn times, an important special case is exponential survival, γIR(s)=e−s/TI\gamma_I^R(s)=e^{-s/T_I}, with TIT_I the expected sojourn time in the infected compartment and where, additionally, ρ(s)=ρ\rho(s)=\rho and ξ(s)=ξ\xi(s)=\xi are assumed to be infection age-independent. We now formulate two simple lemmas which will be used in the numerical results.

Lemma 2.1. Consider the model of (1) and (2) and assume γIR(s)=e−s/TI\gamma_I^R(s)=e^{-s/T_I} as well as ρ(s)=ρ\rho(s)=\rho and ξ(s)=ξ\xi(s)=\xi. Then, no error is introduced when reducing the model as in (1) and (2) to its finite history approximation as in (8) and (9).

Proof. We only need to show that the error terms (7) and (10) vanish. In the case of exponentially distributed sojourn time distributions, the two identities

γIR(u+v)=γIR(u)γIR(v)andγIR(−u)=1γIR(u)\gamma_I^R(u+v)=\gamma_I^R(u)\gamma_I^R(v) \qquad\text{and}\qquad \gamma_I^R(-u)=\frac{1}{\gamma_I^R(u)}

hold. With the first identity, we obtain from (2) that

I(T~)=−∫−∞T~γIR(T~−s)S′(s) ds=−∫−∞T~γIR(T~−t)γIR(t−s)S′(s) ds=−γIR(T~−t)∫−∞T~γIR(t−s)S′(s) ds.\begin{aligned} I(\widetilde{T})=-\int_{-\infty}^{\widetilde{T}}\gamma_I^R(\widetilde{T}-s)S'(s)\,\mathrm{d}s \\ &=-\int_{-\infty}^{\widetilde{T}}\gamma_I^R(\widetilde{T}-t)\gamma_I^R(t-s)S'(s)\,\mathrm{d}s \\ &=-\gamma_I^R(\widetilde{T}-t)\int_{-\infty}^{\widetilde{T}}\gamma_I^R(t-s)S'(s)\,\mathrm{d}s. \end{aligned}

Multiplying with constant −ρξ-\rho\xi and using the second identity on γIR(t−T~)\gamma_I^R(t-\widetilde{T}) yields

−ρξγIR(t−T~)I(T~)=∫−∞T~ρξγIR(t−s)S′(s) ds=BT~(t),-\rho\xi\gamma_I^R(t-\widetilde{T})I(\widetilde{T}) =\int_{-\infty}^{\widetilde{T}}\rho\xi\gamma_I^R(t-s)S'(s)\,\mathrm{d}s =B_{\widetilde{T}}(t),

which implies ES′,T~(t)=0E_{S',\widetilde{T}}(t)=0. With similar arguments as above, we also obtain EI,T~(t)=0E_{I,\widetilde{T}}(t)=0 and

ER,T~(t)=EI,T~(t)+∫−∞T~S′(s) ds+R(T~)+I(T~)=S(T~)−lim⁡t→−∞S(t)+R(T~)+I(T~),E_{R,\widetilde{T}}(t)=E_{I,\widetilde{T}}(t)+\int_{-\infty}^{\widetilde{T}}S'(s)\,\mathrm{d}s+R(\widetilde{T})+I(\widetilde{T}) =S(\widetilde{T})-\lim_{t\to-\infty}S(t)+R(\widetilde{T})+I(\widetilde{T}),

which vanishes with our assumption on the initial population S(T~)+I(T~)+R(T~)=NS(\widetilde{T})+I(\widetilde{T})+R(\widetilde{T})=N and lim⁡t→−∞S(t)=N\lim_{t\to-\infty}S(t)=N.

The consequence of Theorem 2.1 is that there is no difference between the outcome of an IDE model with full or approximated historical contributions when using exponential sojourn time distributions.

Lemma 2.2. Consider the model of (8) and (9) and assume γ1R(s)=e−s/TI\gamma_{1}^{R}(s)=e^{-s/T_{I}} as well as ρ(s)=ρ\rho(s)=\rho and ξ(s)=ξ\xi(s)=\xi. Then, (8) and (9) can be simplified to the ODE formulation

S′(t)=−ϕ(t)NS(t)ρξI(t),I′(t)=ϕ(t)NS(t)ρξI(t)−1TII(t),R′(t)=1TII(t).(11)\begin{aligned} S'(t)&=-\frac{\phi(t)}{N}S(t)\rho\xi I(t),\\ I'(t)&=\frac{\phi(t)}{N}S(t)\rho\xi I(t)-\frac{1}{T_{I}}I(t),\\ R'(t)&=\frac{1}{T_{I}}I(t). \tag*{(11)} \end{aligned}

Proof. The proof is obtained by straightforward computation using the Leibniz integral rule.

Analytical reformulation of the expression for susceptible individuals

A direct expression for SS. In order to obtain an expression that is not given for the derivative but the function S(t)S(t) itself, we use an exponential operator. Assuming β(t)\beta(t) to be continuously differentiable and adopting the finite-history approximation, we can use a variable transformation and the Leibniz integral rule to rewrite (8) as

S′(t)=β(t)S(t){ddt∫0t−T~A(s)S(t−s) ds+(R(T~)−N)A(t−T~)}.(12)S'(t)=\beta(t)S(t)\left\{\frac{\mathrm{d}}{\mathrm{d}t}\int_{0}^{t-\widetilde{T}}A(s)S(t-s)\,\mathrm{d}s+\left(R(\widetilde{T})-N\right)A(t-\widetilde{T})\right\}. \tag*{(12)}

When the contact rate is time-dependent, the model introduces additional terms compared to the constant contact rate considered in [28]. To handle these terms, we begin with the following observation

ddt(β(t)∫0t−T~A(s)S(t−s) ds)=β′(t)∫0t−T~A(s)S(t−s) ds+β(t)ddt∫0t−T~A(s)S(t−s) ds.(13)\frac{\mathrm{d}}{\mathrm{d}t}\left(\beta(t)\int_{0}^{t-\widetilde{T}}A(s)S(t-s)\,\mathrm{d}s\right)=\beta'(t)\int_{0}^{t-\widetilde{T}}A(s)S(t-s)\,\mathrm{d}s+\beta(t)\frac{\mathrm{d}}{\mathrm{d}t}\int_{0}^{t-\widetilde{T}}A(s)S(t-s)\,\mathrm{d}s. \tag*{(13)}

Analogously to [28], we start from (12) and divide by S(t)S(t), for which we require the initial value to be positive, i.e., S(T~)>0S(\widetilde{T})>0. Integrating from T~\widetilde{T} to tt, using (13) and multiple variable transformations of the form x=t−sx=t-s and x−T~=t−sx-\widetilde{T}=t-s yields

∫T~tS′(x)S(x) dx=∫T~tβ(x)ddx∫0x−T~A(s)S(x−s) ds dx+∫T~tβ(x)A(x−T~)(R(T~)−N) dx=∫T~tddx{β(x)∫0x−T~A(s)S(x−s) ds} dx−∫T~tβ′(x)∫0x−T~A(s)S(x−s) ds dx+∫T~tβ(x)A(x−T~)(R(T~)−N) dx=β(t)∫0t−T~A(s)S(t−s) ds−∫T~tβ′(x)∫0x−T~A(s)S(x−s) ds dx+∫T~tβ(x)A(x−T~)(R(T~)−N) dx=β(t)∫T~tA(t−s)S(s) ds−∫T~tβ′(x)∫T~xA(x−s)S(s) ds dx+∫T~tβ(t−s+T~)A(t−s)(R(T~)−N) ds=∫T~tA(t−s)(β(t)S(s)+β(t−s+T~)(R(T~)−N)) ds−∫T~tβ′(x)∫T~xA(x−s)S(s) ds dx.(14)\begin{aligned} \int_{\widetilde{T}}^{t}\frac{S'(x)}{S(x)}\,\mathrm{d}x ={}&\int_{\widetilde{T}}^{t}\beta(x)\frac{\mathrm{d}}{\mathrm{d}x}\int_{0}^{x-\widetilde{T}}A(s)S(x-s)\,\mathrm{d}s\,\mathrm{d}x\\ &+\int_{\widetilde{T}}^{t}\beta(x)A(x-\widetilde{T})\left(R(\widetilde{T})-N\right)\,\mathrm{d}x\\ ={}&\int_{\widetilde{T}}^{t}\frac{\mathrm{d}}{\mathrm{d}x}\left\{\beta(x)\int_{0}^{x-\widetilde{T}}A(s)S(x-s)\,\mathrm{d}s\right\}\,\mathrm{d}x\\ &-\int_{\widetilde{T}}^{t}\beta'(x)\int_{0}^{x-\widetilde{T}}A(s)S(x-s)\,\mathrm{d}s\,\mathrm{d}x\\ &+\int_{\widetilde{T}}^{t}\beta(x)A(x-\widetilde{T})\left(R(\widetilde{T})-N\right)\,\mathrm{d}x\\ ={}&\beta(t)\int_{0}^{t-\widetilde{T}}A(s)S(t-s)\,\mathrm{d}s-\int_{\widetilde{T}}^{t}\beta'(x)\int_{0}^{x-\widetilde{T}}A(s)S(x-s)\,\mathrm{d}s\,\mathrm{d}x\\ &+\int_{\widetilde{T}}^{t}\beta(x)A(x-\widetilde{T})\left(R(\widetilde{T})-N\right)\,\mathrm{d}x\\ ={}&\beta(t)\int_{\widetilde{T}}^{t}A(t-s)S(s)\,\mathrm{d}s-\int_{\widetilde{T}}^{t}\beta'(x)\int_{\widetilde{T}}^{x}A(x-s)S(s)\,\mathrm{d}s\,\mathrm{d}x\\ &+\int_{\widetilde{T}}^{t}\beta(t-s+\widetilde{T})A(t-s)\left(R(\widetilde{T})-N\right)\,\mathrm{d}s\\ ={}&\int_{\widetilde{T}}^{t}A(t-s)\left(\beta(t)S(s)+\beta(t-s+\widetilde{T})\left(R(\widetilde{T})-N\right)\right)\,\mathrm{d}s\\ &-\int_{\widetilde{T}}^{t}\beta'(x)\int_{\widetilde{T}}^{x}A(x-s)S(s)\,\mathrm{d}s\,\mathrm{d}x. \tag*{(14)} \end{aligned}

By substituting the derivative within the integral and applying the substitution rule, we obtain the solution for the integral on the left hand side of (14). Separating S(t)S(t) leads to

S(t)=S(T~)exp⁡(∫T~tA(t−s)(β(t)S(s)+β(t−s+T~)(R(T~)−N)) ds−∫T~tβ′(x)∫T~xA(x−s)S(s) ds dx).(15)S(t)=S(\widetilde{T})\exp\left(\int_{\widetilde{T}}^{t} A(t-s)\left(\beta(t)S(s)+\beta(t-s+\widetilde{T})\left(R(\widetilde{T})-N\right)\right)\,\mathrm{d}s-\int_{\widetilde{T}}^{t}\beta'(x)\int_{\widetilde{T}}^{x}A(x-s)S(s)\,\mathrm{d}s\,\mathrm{d}x\right). \tag*{(15)}

An explicit expression for S′S'. For the computation of I(t)I(t) and R(t)R(t), we require the derivative S′(t)S'(t). Assuming A(t)A(t) to be continuously differentiable, we provide an explicit expression based on the availability of S(t)S(t).

For convenience, we define

C:=R(T~)−N,C:=R(\widetilde{T})-N,

and denote the exponent in (15) by

H(t):=∫T~tA(t−s)(β(t)S(s)+β(t−s+T~)C) ds−∫T~tβ′(x)∫T~xA(x−s)S(s) ds dx.(16)H(t):=\int_{\widetilde{T}}^{t}A(t-s)\left(\beta(t)S(s)+\beta(t-s+\widetilde{T})C\right)\,\mathrm{d}s-\int_{\widetilde{T}}^{t}\beta'(x)\int_{\widetilde{T}}^{x}A(x-s)S(s)\,\mathrm{d}s\,\mathrm{d}x. \tag*{(16)}

Thus,

S(t)=S(T~)exp⁡(H(t))S(t)=S(\widetilde{T})\exp(H(t))

and consequently

S′(t)=S(t)H′(t).(17)S'(t)=S(t)H'(t). \tag*{(17)}

Applying the Leibniz integral rule to (16) yields

H′(t)=A(0)(β(t)S(t)+β(T~)C)+∫T~tA′(t−s)(β(t)S(s)+β(t−s+T~)C) ds+∫T~tA(t−s)(β′(t)S(s)+β′(t−s+T~)C) ds−β′(t)∫T~tA(t−s)S(s) ds.\begin{aligned} H'(t)={}&A(0)\left(\beta(t)S(t)+\beta(\widetilde{T})C\right)+\int_{\widetilde{T}}^{t}A'(t-s)\left(\beta(t)S(s)+\beta(t-s+\widetilde{T})C\right)\,\mathrm{d}s\\ &+\int_{\widetilde{T}}^{t}A(t-s)\left(\beta'(t)S(s)+\beta'(t-s+\widetilde{T})C\right)\,\mathrm{d}s-\beta'(t)\int_{\widetilde{T}}^{t}A(t-s)S(s)\,\mathrm{d}s. \end{aligned}

The terms containing

β′(t)∫T~tA(t−s)S(s) ds\beta'(t)\int_{\widetilde{T}}^{t}A(t-s)S(s)\,\mathrm{d}s

cancel. Therefore,

H′(t)=A(0)β(t)S(t)+β(t)∫T~tA′(t−s)S(s) ds+C(A(0)β(T~)+∫T~t(A′(t−s)β(t−s+T~)+A(t−s)β′(t−s+T~)) ds).\begin{aligned} H'(t)={}&A(0)\beta(t)S(t)+\beta(t)\int_{\widetilde{T}}^{t}A'(t-s)S(s)\,\mathrm{d}s\\ &+C\left(A(0)\beta(\widetilde{T})+\int_{\widetilde{T}}^{t}\left(A'(t-s)\beta(t-s+\widetilde{T})+A(t-s)\beta'(t-s+\widetilde{T})\right)\,\mathrm{d}s\right). \end{aligned}

Using the substitution u=t−su=t-s, the remaining integral satisfies

∫T~t(A′(t−s)β(t−s+T~)+A(t−s)β′(t−s+T~)) ds=∫0t−T~ddu(A(u)β(u+T~)) du=A(t−T~)β(t)−A(0)β(T~).\begin{aligned} \int_{\widetilde{T}}^{t}\left(A'(t-s)\beta(t-s+\widetilde{T})+A(t-s)\beta'(t-s+\widetilde{T})\right)\,\mathrm{d}s=\int_{0}^{t-\widetilde{T}}\frac{\mathrm{d}}{\mathrm{d}u}\left(A(u)\beta(u+\widetilde{T})\right)\,\mathrm{d}u \\ &=A(t-\widetilde{T})\beta(t)-A(0)\beta(\widetilde{T}). \end{aligned}

The term A(0)β(T~)CA(0)\beta(\widetilde{T})C consequently cancels as well and we obtain

H′(t)=β(t)(A(0)S(t)+∫T~tA′(t−s)S(s) ds+CA(t−T~)).(18)H'(t)=\beta(t)\left(A(0)S(t)+\int_{\widetilde{T}}^{t}A'(t-s)S(s)\,\mathrm{d}s+CA(t-\widetilde{T})\right). \tag*{(18)}

Combining (17) and (18) gives the explicit expression

S′(t)=β(t)S(t)(A(0)S(t)+∫T~tA′(t−s)S(s) ds+CA(t−T~)),(19)S'(t)=\beta(t)S(t)\left(A(0)S(t)+\int_{\widetilde{T}}^{t}A'(t-s)S(s)\,\mathrm{d}s+CA(t-\widetilde{T})\right), \tag*{(19)}

where the right-hand side does not depend on S′(t)S'(t).

We can easily show that the above formulation is consistent with the original formulation. Assuming that S(t)S(t) is sufficiently smooth, integration by parts gives

∫T~tA′(t−s)S(s) ds=−A(0)S(t)+A(t−T~)S(T~)+∫T~tA(t−s)S′(s) ds.(20)\int_{\widetilde{T}}^{t}A'(t-s)S(s)\,\mathrm{d}s=-A(0)S(t)+A(t-\widetilde{T})S(\widetilde{T})+\int_{\widetilde{T}}^{t}A(t-s)S'(s)\,\mathrm{d}s. \tag*{(20)}

Using S(T~)+I(T~)+R(T~)=NS(\widetilde{T})+I(\widetilde{T})+R(\widetilde{T})=N, the expression in parentheses in (19) becomes

A(t−T~)(S(T~)+R(T~)−N)+∫T~tA(t−s)S′(s) ds=−I(T~)A(t−T~)+∫T~tA(t−s)S′(s) ds.A(t-\widetilde{T})\left(S(\widetilde{T})+R(\widetilde{T})-N\right)+\int_{\widetilde{T}}^{t}A(t-s)S'(s)\,\mathrm{d}s=-I(\widetilde{T})A(t-\widetilde{T})+\int_{\widetilde{T}}^{t}A(t-s)S'(s)\,\mathrm{d}s.

Modeling the contact rate

An essential contribution of this work is the systematic accommodation of time-dependent contact rates, which are critical for modeling nonpharmaceutical interventions [30] but often disregarded in analytical IDE studies. While our theoretical and numerical framework naturally supports any sufficiently differentiable contact rate function ϕ∈Ck(R)\phi\in C^k(\mathbb{R}), realistic intervention scenarios such as sudden venue closures often involve abrupt, non-smooth changes. Treating these as raw step functions would degrade the convergence order of our high-accuracy numerical schemes; consequently, explicit smoothing must be implemented.

To handle such discrete policy changes accordingly close to reality, we simulate contact rates that transition over a small finite interval. More precisely, for a change effective at tD∈Rt_D\in\mathbb{R} that changes a prior contact rate ϕ0>0\phi_0>0 to (1−r)ϕ0(1-r)\phi_0, we define

ϕ(t):={ϕ0,t≤tD−δ,ϕ∗(t),t∈(tD−δ,tD),(1−r)ϕ0,t≥tD.(21)\phi(t):= \begin{cases} \phi_0, & t\le t_D-\delta,\\ \phi^*(t), & t\in(t_D-\delta,t_D),\\ (1-r)\phi_0, & t\ge t_D. \end{cases} \tag*{(21)}

Here, r∈(−∞,1]r\in(-\infty,1] denotes the relative change of the contact rate. Positive values of rr correspond to a contact reduction in which case we sometimes refer to the new contact rate as damped value; negative values of rr allow for an increase beyond the baseline. The term δ>0\delta>0 defines the length of the transition interval, and ϕ∗:(tD−δ,tD)→((1−r)ϕ0,ϕ0)\phi^*:(t_D-\delta,t_D)\to((1-r)\phi_0,\phi_0) represents a transition contact rate to ensure a smooth transition; see, e.g., [31]. Note that the length of the transition interval can be chosen arbitrarily for 0<δ<∞0<\delta<\infty. In [20] and the MEmilio framework [32] itself, we used the smoothed contact rates ϕ∗=ϕ~C\phi^*=\widetilde{\phi}^{C} defined as

ϕ~C(t):=12(rϕ0)cos⁡(π(t−tD+δδ))+12(2ϕ0−rϕ0);(22)\widetilde{\phi}^{C}(t):=\frac{1}{2}(r\phi_0)\cos\left(\pi\left(\frac{t-t_D+\delta}{\delta}\right)\right)+\frac{1}{2}(2\phi_0-r\phi_0); \tag*{(22)}

cf. Figure 1 (left). Based on the cosine function, it is guaranteed that ϕ∈C1(R)\phi\in C^1(\mathbb{R}). However, to fully benefit from the higher-order numerical schemes discussed in this paper, we need an interpolation function that satisfies ϕ∈Ck(R)\phi\in C^k(\mathbb{R}) with k>1k>1. Choosing the polynomial interpolation or smoothstep function ϕ~∗=P~4\tilde{\phi}^{*}=\tilde{\mathcal{P}}^4 defined on (tD−δ,tD)(t_D-\delta,t_D) as

Figure 1. Two sigmoidal interpolation functions to smooth a stepwise defined function between tD−δt_D-\delta and tDt_D. Left: The cosine-based interpolation of (22) ensures C1C^1 smoothness. Right: The polynomial interpolation of (23) ensures C4C^4 smoothness.

P~4(t):=ϕ0+((1−r)ϕ0−ϕ0)(126(t−tD+δδ)5−420(t−tD+δδ)6+540(t−tD+δδ)7−315(t−tD+δδ)8+70(t−tD+δδ)9)(23)\widetilde{\mathcal{P}}^4(t):=\phi_0+\left((1-r)\phi_0-\phi_0\right)\left(126\left(\frac{t-t_D+\delta}{\delta}\right)^5-420\left(\frac{t-t_D+\delta}{\delta}\right)^6+540\left(\frac{t-t_D+\delta}{\delta}\right)^7-315\left(\frac{t-t_D+\delta}{\delta}\right)^8+70\left(\frac{t-t_D+\delta}{\delta}\right)^9\right) \tag*{(23)}

is sufficient to ensure ϕ∈C4(R)\phi\in C^4(\mathbb{R}); cf. Figure 1 (right) for a visualization.

A discretized age-of-infection model for the solution of all compartments

Preliminaries

We discretize the age-of-infection model derived in § 3 by applying a numerical scheme to the continuous model. Hereby, we distinguish between the solution scheme for the equation for the susceptibles, which mainly follows the ideas of [28], and the solution scheme for the numbers of infected and recovered individuals. In the latter, we suggest to use an additional finite difference (FD) scheme to approximate S′(t)S'(t) to reduce the number of function evaluations compared to approximating the integral within the analytical derivative, cf. (19). For a clear distinction between continuous and discretized function definitions, we use the u^\widehat{u} notation for the respective discretized version of a continuous function uu.

For a constant step size Δt>0\Delta t>0, let us define a uniform discretization of R\mathbb{R} through tn:=nΔtt_n:=n\Delta t for n∈Zn\in\mathbb{Z}. Without loss of generality, we assume that there exists a nonpositive value a∈Z≤0a\in\mathbb{Z}_{\leq0} such that

ta:=aΔt=T~.t_a:=a\Delta t=\widetilde{T}.

As the (numerical) computation of (9) and (15) always involves past values on [T~,tn][\widetilde{T},t_n], or on a numerically truncated subinterval if the corresponding kernels are negligible beyond a finite infection age, we cannot trivially adapt the step size on a considered interval. This fact renders the use of, e.g., Gaussian or adaptive Gauß-Kronrod quadrature less attractive, as these methods would require interpolation or additional evaluations of the solution history. As we similarly do not possess information on higher order derivatives, we cannot use Euler–Maclaurin’s formula. As suggested by [28], we will use Gregory’s quadrature rule. With Gregory’s rule being based on the composite trapezoidal rule and adequately weighted end-point corrections, it satisfies our requirements.

Discretization of S

Analogously to [28], we discretize (15) by a direct quadrature method with quadrature weights of the n0n_0-th Gregory rule and obtain

S^(tn)=S^(ta)exp⁡(Δt[∑j=anωn−a,j−an0ρ(tn−j)ξ(tn−j)γ1R(tn−j)(ϕ(tn)NS^(tj)+ϕ(tn−j+a)N(R^(ta)−N))]−Δt2[∑j=anωn−a,j−an0ϕ′(tj)N∑k=ajωj−a,k−an0ρ(tj−k)ξ(tj−k)γ1R(tj−k)S^(tk)])(24)\widehat{S}(t_n)=\widehat{S}(t_a)\exp\left(\Delta t\left[\sum_{j=a}^{n}\omega_{n-a,j-a}^{n_0}\rho(t_{n-j})\xi(t_{n-j})\gamma_1^R(t_{n-j})\left(\frac{\phi(t_n)}{N}\widehat{S}(t_j)+\frac{\phi(t_{n-j+a})}{N}\left(\widehat{R}(t_a)-N\right)\right)\right] -\Delta t^2\left[\sum_{j=a}^{n}\omega_{n-a,j-a}^{n_0}\frac{\phi'(t_j)}{N}\sum_{k=a}^{j}\omega_{j-a,k-a}^{n_0}\rho(t_{j-k})\xi(t_{j-k})\gamma_1^R(t_{j-k})\widehat{S}(t_k)\right]\right) \tag*{(24)}

where the weights ωn−a,j−an0\omega_{n-a,j-a}^{n_0} refer to Gregory rule n0n_0 and are defined as in [33]; see also Appendix A for a more detailed description of the Gregory weights. Here, the second sum appears due to our time-dependent contact rate which was not present in [24]. Note that this defines an implicit equation which we solve by a fixed-point iteration. As an initial guess for S^(tn)\widehat{S}(t_n), we use S^(tn−1)\widehat{S}(t_{n-1}) obtained at the previous time step. The iteration is terminated once the absolute difference between two successive approximations falls below tolFP=10−14\mathit{tol}_{\mathrm{FP}}=10^{-14}.

As demonstrated by [28] for the model with constant contact rate, we target convergence order n0+1n_0+1 when using quadrature weights of Gregory rule n0n_0 for the simplified formulation of the equation of the susceptible individuals. As a subtle requirement, we need at least n0n_0 prior values to apply Gregory rule n0n_0.

Discretization of I and R

For the discretization of the equations I(t)I(t) and R(t)R(t), we require an approximation of the derivative S′S'. In (19), we derived an analytical expression for the derivative, making it possible to approximate the integral term with higher order quadrature rules. However, given a solution for S(t)S(t), we can avoid evaluating this integral and substantially reduce the number of function evaluations or accesses to function values in the memory or cache. Using a FD scheme for approximating the derivative, only the five most recent evaluations are needed to compute a fourth order accurate approximation. For the sake of simplicity, we employ by default a fourth order FD scheme to ensure up to fourth order convergence of the numerical solution scheme. More precisely, we employ the backwards FD scheme

g4(t,f,Δt):=25f(t)−48f(t−Δt)+36f(t−2Δt)−16f(t−3Δt)+3f(t−4Δt)12Δt.(25)g_4(t,f,\Delta t):=\frac{25f(t)-48f(t-\Delta t)+36f(t-2\Delta t)-16f(t-3\Delta t)+3f(t-4\Delta t)}{12\Delta t}. \tag*{(25)}

and set

S^′(tj)=g4(tj,S^,Δt)(26)\widehat{S}'(t_j)=g_4(t_j,\widehat{S},\Delta t) \tag*{(26)}

for j>aj>a. For sufficiently smooth functions, we can easily show that

f′(tj)−g4(tj,f,Δt)=O(Δt4).(27)f'(t_j)-g_4(t_j,f,\Delta t)=O(\Delta t^4). \tag*{(27)}

For a general description of how to derive FD approximations of arbitrary order, we refer to [34 Chapter 1].

In additional numerical considerations, we will also briefly consider lower order FD schemes which are sufficient when utilizing lower order Gregory’s rules. Here, we use

g1(t,f,Δt):=f(t)−f(t−Δt)Δt,g2(t,f,Δt):=3f(t)−4f(t−Δt)+f(t−2Δt)2Δt,g3(t,f,Δt):=11f(t)−18f(t−Δt)+9f(t−2Δt)−2f(t−3Δt)6Δt.(28)\begin{aligned} g_1(t,f,\Delta t) &:= \frac{f(t)-f(t-\Delta t)}{\Delta t},\\ g_2(t,f,\Delta t) &:= \frac{3f(t)-4f(t-\Delta t)+f(t-2\Delta t)}{2\Delta t},\\ g_3(t,f,\Delta t) &:= \frac{11f(t)-18f(t-\Delta t)+9f(t-2\Delta t)-2f(t-3\Delta t)}{6\Delta t}. \tag*{(28)} \end{aligned}

where

f′(t)−gm0(t,f,Δt)=O(Δtm0),m0∈{1,2,3}.(29)f'(t)-g_{m_0}(t,f,\Delta t)=O(\Delta t^{m_0}),\qquad m_0\in\{1,2,3\}. \tag*{(29)}

With this, we can proceed to discretize the equations for II and RR, again using Gregory quadrature weights and obtain

I^(tn)=γIR(tn−a)I^(ta)−Δt∑j=anωn−a,j−an0γIR(tn−j)S^′(tj),R^(tn)=N−S^(tn)−I^(tn).(30)\begin{aligned} \widehat{I}(t_n)&=\gamma_I^R(t_{n-a})\widehat{I}(t_a)-\Delta t\sum_{j=a}^{n}\omega_{n-a,j-a}^{n_0}\gamma_I^R(t_{n-j})\widehat{S}'(t_j),\\ \widehat{R}(t_n)&=N-\widehat{S}(t_n)-\widehat{I}(t_n). \tag*{(30)} \end{aligned}

Composition of the error

We distinguish the error introduced by time discretization from the error associated with the finite-history approximation. Let uu denote the solution of (1) and (2), uT~u_{\widetilde{T}} the continuous finite-history solution of (15) and (9), and u^Δt,T~\widehat{u}_{\Delta t,\widetilde{T}} the numerical solution of (24) and (30) with time step Δt\Delta t. For each grid point tjt_j, j≥aj\ge a, the difference from the full-history solution decomposes as

u^Δt,T~(tj)−u(tj)=uT~(tj)−u(tj)⏟history approximation error+u^Δt,T~(tj)−uT~(tj)⏟numerical error.(31)\widehat{u}_{\Delta t,\widetilde{T}}(t_j)-u(t_j) = \underbrace{u_{\widetilde{T}}(t_j)-u(t_j)}_{\text{history approximation error}} + \underbrace{\widehat{u}_{\Delta t,\widetilde{T}}(t_j)-u_{\widetilde{T}}(t_j)}_{\text{numerical error}}. \tag*{(31)}

For arbitrary but fixed T~\widetilde{T}, the first term is driven by the error that may be induced by (7) and convergence of the numerical scheme concerns the second term. Consequently, comparison with a full-history reference solution measures both contributions. If the history approximation error is nonzero, refinement of the time step alone cannot produce convergence to that reference solution, although the numerical convergence order may be visible while the numerical error dominates. In the special case of exponential survival and age-independent ρξ\rho_{\xi}, Theorem 2.1 shows that the history related error vanishes.

In applications and, in particular, discretized settings, we have a T~\widetilde{T} which corresponds to the introduction of the first case(s). If the time of the first infection is known, T~\widetilde{T} can be set to this value. Alternatively, the choice of T~\widetilde{T} can be considered a modeling assumption that may introduce an approximation error if T~>T~\widetilde{T}>\widetilde{T}. We will examine the impact of different modeling errors in § 5.3.

Required function evaluations and initial step sizes

A particular problem of the numerical scheme is visible from (24), (26), and (30): For Gregory rule n0n_0 with FD scheme of order m0m_0, we have insufficient past values for n<a+max⁡{n0,m0}n<a+\max\{n_0,m_0\} and the corresponding formulas can thus not be applied.

As we require at least n0n_0 initial values for employing the n0n_0-th Gregory rule in (24), we increase the Gregory rule stepwise until we have approximated enough values to apply the n0n_0-th Gregory rule. This means that we lose accuracy over the first steps as the convergence order will not exceed O(Δtq+1)\mathcal{O}(\Delta t^{q+1}) at ta+qt_{a+q}, q=1,…,n0−1q=1,\ldots,n_0-1 for n0>1n_0>1. For n0=1n_0=1, we only require one initial value, thus the stepwise increase of Gregory rules is not necessary.

To prevent the lower-order error introduced during initialization from asymptotically dominating the error of the higher-order scheme, we choose Δt0\Delta t_0 such that

c0Δt02≤c1Δtn0+1.(32)c_0\Delta t_0^2 \le c_1\Delta t^{n_0+1}. \tag*{(32)}

where c0c_0 and c1c_1 denote problem-dependent constants. This yields

Δt0≤c1c0Δt(n0+1)/2.(33)\Delta t_0 \le\sqrt{\frac{c_1}{c_0}}\Delta t^{(n_0+1)/2}. \tag*{(33)}

Writing Δt0=Δt/k\Delta t_0=\Delta t/k, we obtain

k≥c0c1Δt−(n0−1)/2.(34)k \ge\sqrt{\frac{c_0}{c_1}}\Delta t^{-(n_0-1)/2}. \tag*{(34)}

Since the constants c0c_0 and c1c_1 are generally unknown, we use the asymptotic scaling suggested by this relation and choose

k=⌈Δt−(n0−1)/2⌉.(35)k=\left\lceil\Delta t^{-(n_0-1)/2}\right\rceil. \tag*{(35)}

Thus, the choice of Δt0\Delta t_0 is intended to provide the appropriate asymptotic scaling of the initialization error rather than a strict bound on its magnitude.

After having computed S^\widehat{S}, we can compute S^′\widehat{S}'. As the computations can be decoupled, we do not increase the order of the FD scheme step by step as done for the Gregory rule. Instead, we use a forward FD scheme of m0m_0-th order to compute the derivative for tj∈{ta,…,ta+m0−1}t_j\in\{t_a,\ldots,t_{a+m_0-1}\} before switching to a backwards FD scheme for tj>ta+m0−1t_j>t_{a+m_0-1}. Note that, here, we have to ensure to compute enough values for S(t)S(t) beforehand.

For the forward FD approximation we use

h1(t,f,Δt):=−f(t)+f(t+Δt)Δt,h2(t,f,Δt):=−3f(t)+4f(t+Δt)−f(t+2Δt)2Δt,h3(t,f,Δt):=−11f(t)+18f(t+Δt)−9f(t+2Δt)+2f(t+3Δt)6Δt,h4(t,f,Δt):=−25f(t)+48f(t+Δt)−36f(t+2Δt)+16f(t+3Δt)−3f(t+4Δt)12Δt.(36)\begin{aligned} h_1(t,f,\Delta t)&:=\frac{-f(t)+f(t+\Delta t)}{\Delta t},\\ h_2(t,f,\Delta t)&:=\frac{-3f(t)+4f(t+\Delta t)-f(t+2\Delta t)}{2\Delta t},\\ h_3(t,f,\Delta t)&:=\frac{-11f(t)+18f(t+\Delta t)-9f(t+2\Delta t)+2f(t+3\Delta t)}{6\Delta t},\\ h_4(t,f,\Delta t)&:=\frac{-25f(t)+48f(t+\Delta t)-36f(t+2\Delta t)+16f(t+3\Delta t)-3f(t+4\Delta t)}{12\Delta t}. \tag*{(36)} \end{aligned}

where

f′(t)−hm0(t,f,Δt)=O(Δtm0),m0∈{1,2,3,4}.(37)f'(t)-h_{m_0}(t,f,\Delta t)=\mathcal{O}(\Delta t^{m_0}),\qquad m_0\in\{1,2,3,4\}. \tag*{(37)}

With this, we set

S^′(tj)=hm0(tj,S^,Δt)(38)\widehat{S}'(t_j)=h_{m_0}(t_j,\widehat{S},\Delta t) \tag*{(38)}

for tj∈{ta,…,ta+m0−1}t_j\in\{t_a,\ldots,t_{a+m_0-1}\}.

These considerations are highly relevant for the first time steps to accurately approximate the right solution. However, in practical situations where our model might be iteratively advanced and we might already have historical data, i.e., the simulation with the model actually corresponds to a restart of a prior simulation until t0t_0; cf. Figure 2. No evaluations points are available for t<T~t<\widetilde{T} but at t=t0t=t_0 we actually restart the model simulation with historical data.

Epidemic history, model consideration, and simulation windows

Figure 2. Epidemic history, model consideration, and simulation windows.

Implementation

The prior considerations yield the straightforward implementation of the numerical scheme as depicted in Algorithm 1. The set of input parameters are defined via

P:={γIR,ρ,ξ,ϕ,ϕ′,n0,m0,tol⁡FP,S^(ta),I^(ta),R^(ta)}.(39)\mathcal{P} := \{\gamma_I^R,\rho,\xi,\phi,\phi',n_0,m_0,\operatorname{tol}_{\mathrm{FP}},\widehat{S}(t_a),\widehat{I}(t_a),\widehat{R}(t_a)\}. \tag*{(39)}

To reduce the error in the initial interval, we can apply our numerical scheme with a smaller initial step size Δt0\Delta t_0 up to tswitcht_{switch}, cf. (32), before switching to the larger step size Δt\Delta t for the remaining simulation steps.

We start with the initial step size Δt0\Delta t_0. First, we compute all values S^(tj)\widehat{S}(t_j), tj∈{ta,…,tswitch}t_j \in\{t_a,\ldots,t_{switch}\}. Then, we use these values to compute the derivative values S^′(tj)\widehat{S}'(t_j) together with the compartment values I^(tj)\widehat{I}(t_j) and R^(tj)\widehat{R}(t_j) until we reach tswitcht_{switch}. From there on, we use the step size Δt\Delta t and repeat the same steps for tj∈{tswitch+Δt,…,tmax⁡}t_j \in\{t_{switch}+\Delta t,\ldots,t_{\max}\} This is depicted in Algorithm 1. The implementation shown here is straightforward, in order to improve the efficiency and performance of Algorithm 1, the main loops could be combined and rearranged.

Observations regarding the numerical solution

We observe that the numerical scheme as in § 4 is mass-conserving which follows directly from the discrete formulas for the compartments as in (24) and (30).

Lemma 3.1. For all j∈Zj \in\mathbb{Z}, j≥aj \ge a, it holds that S^(tj)+I^(tj)+R^(tj)=N\widehat{S}(t_j)+\widehat{I}(t_j)+\widehat{R}(t_j)=N.

Furthermore, it is easy to show that the positivity of S^\widehat{S} is conserved due to the reformulation with an exponential operator.

Lemma 3.2. Let S^(ta)>0\widehat{S}(t_a)>0. Then it holds that S^(tj)>0\widehat{S}(t_j)>0 for all j∈Zj \in\mathbb{Z}, j>aj>a.

Numerical results

The presented IDE model together with our numerical experiments were implemented in C++ as a part of our high performance modular epidemics simulation software MEmilio [32]. We present both qualitative and detailed quantitative results on the model and its numerical solution through higher order schemes. We consider different settings regarding Gregory rules and FD approximations as well as different smooth interpolation functions on contact change points. Moreover, we examine the impact of the initialization horizon on the epidemic outcomes.

Algorithm 1 Discrete scheme.

Input: Step sizes Δt\Delta t, time points tat_a, tmax⁡t_{\max}, parameter set P\mathcal{P} according to (39)

where p=max⁡{n0−1,2m0−1}p = \max\{n_0 - 1, 2m_0 - 1\}.

  1. tswitch←ta+pΔtt_{\mathrm{switch}} \leftarrow t_a + p\Delta t

  2. Δt0←Δt/k\Delta t_0 \leftarrow\Delta t/k with (35)

  3. tj←ta+Δt0t_j \leftarrow t_a + \Delta t_0

  4. while tj≤tswitcht_j \leq t_{\mathrm{switch}} do

  5. Compute S^(tj)\widehat{S}(t_j) according to (24) with (increasing) Gregory rule n0n_0 and step size Δt0\Delta t_0.

  6. tj←tj+Δt0t_j \leftarrow t_j + \Delta t_0

  7. end while

  8. Compute S^′(ta)\widehat{S}'(t_a) according to (38) and step size Δt0\Delta t_0.

  9. tj←ta+Δt0t_j \leftarrow t_a + \Delta t_0

  10. while tj≤tswitcht_j \leq t_{\mathrm{switch}} do

  11. Compute S^′(tj)\widehat{S}'(t_j) according to (38) or (26) and step size Δt0\Delta t_0.

  12. Compute I^(tj)\widehat{I}(t_j) and R^(tj)\widehat{R}(t_j) according to (30) with (increasing) Gregory rule n0n_0 and step size Δt0\Delta t_0.

  13. tj←tj+Δt0t_j \leftarrow t_j + \Delta t_0

  14. end while

  15. tj←tswitch+Δtt_j \leftarrow t_{\mathrm{switch}} + \Delta t

  16. while tj≤tmax⁡t_j \leq t_{\max} do

  17. Compute S^(tj)\widehat{S}(t_j) according to (24) with Gregory rule n0n_0 and step size Δt\Delta t.

  18. tj←tj+Δtt_j \leftarrow t_j + \Delta t

  19. end while

  20. tj←tswitch+Δtt_j \leftarrow t_{\mathrm{switch}} + \Delta t

  21. while tj≤tmax⁡t_j \leq t_{\max} do

  22. Compute S^′(tj)\widehat{S}'(t_j) according to (26) and step size Δt\Delta t.

  23. Compute I^(tj)\widehat{I}(t_j) and R^(tj)\widehat{R}(t_j) according to (30) with Gregory rule n0n_0 and step size Δt\Delta t.

  24. tj←tj+Δtt_j \leftarrow t_j + \Delta t

  25. end while

Analysis of the convergence order

In this section, we provide the numerical convergence order for our scheme as introduced in § 4. Starting with a constant contact rate, we first consider the convergence order for different Gregory rules combined with a FD approximation of order 4. Second, we provide the convergence orders when using different FD approximation orders. Third, we consider a time-dependent contact rate.

To approximate the convergence order, we need to compute a ground truth solution. Instead of solving the IDE formulation directly, we consider an exponential sojourn time distribution. We make use of Theorems 2.1 and 2.2 to apply a high order Runge–Kutta scheme that delivers the ground truth as the solution of the corresponding ODE-based initial value problem (IVP). We denote the corresponding solution by uODE∗u_{\mathrm{ODE}}^*.

The results of the IDE model are computed with different time steps and then compared to the ground truth. The relative error is computed by normalizing the absolute error with the ground truth norm, i.e.,

err⁡rel:=∥u^IDE−uODE∗∥∞∥uODE∗∥∞(40)\operatorname{err}_{\mathrm{rel}} := \frac{\left\lVert\widehat{u}_{\mathrm{IDE}} - u_{\mathrm{ODE}}^* \right\rVert_{\infty}}{\left\lVert u_{\mathrm{ODE}}^* \right\rVert_{\infty}} \tag*{(40)}

for any compartment u^IDE(t)\widehat{u}_{\mathrm{IDE}}(t) representing one element in {S^(t),I^(t),R^(t)}\{\widehat{S}(t), \widehat{I}(t), \widehat{R}(t)\}. The maximum norm is defined on the simulation interval through

∥u∥∞:=max⁡j=0,…,n∣u(tj)∣.(41)\|u\|_{\infty} := \max_{j=0,\ldots,n} \left|u(t_j)\right|. \tag*{(41)}

We use an exponential sojourn time distribution with mean TI=2T_I = 2. We consider an initial point in time T^=−50\widehat{T} = -50 and start with an initial population of

S^(T^)=9 999 000,I^(T^)=1 000,R^(T^)=0.\widehat{S}(\widehat{T}) = 9\,999\,000,\qquad\widehat{I}(\widehat{T}) = 1\,000,\qquad\widehat{R}(\widehat{T}) = 0.

We consider the ODE-based IVP with t0,ODE=T^t_{0,\mathrm{ODE}} = \widehat{T} and solve until tmax⁡=100t_{\max} = 100. The IVP is solved with high precision as obtained through a Runge–Kutta solver of eighth order with constant step size Δt=10−6\Delta t = 10^{-6}. The corresponding outcome is uODE∗u_{\mathrm{ODE}}^{*}.

In order to avoid the issue around the initial time point as described in Section 3 and Algorithm 1, we consider a restarted simulation as depicted in Figure 2. We set T~=−40\widetilde{T} = -40 and thereby make implicit use of Theorems 2.1 and 2.2, i.e., that in case of exponential survival, the IDE model converges against the ODE model, independent of the choice of T~\widetilde{T}. In particular, we use the values for the compartments obtained via the ODE model, set them as high order approximations to the true values of the IDE model, and also use these to compute the derivative S′S' by applying a FD scheme until t0=0t_0 = 0. Then, we simulate the IDE model from t0,IDE=0t_{0,\mathrm{IDE}} = 0 to tmax⁡t_{\max} and compute the error only over the simulation horizon.

Further model parameters are set to ρ(t)=0.8\rho(t) = 0.8, ξ(t)=1\xi(t) = 1 and ϕ(t)=0.73\phi(t) = 0.73.

Varying Gregory rules for constant contact rate

First, we fix the FD approximations for S^′(t)\widehat{S}'(t) to 4th order and consider the convergence of the numerical schemes with different Gregory rules of order n0∈{1,2,3}n_0 \in\{1, 2, 3\} and Δt∈{100,10−1,10−2,10−3}\Delta t \in\{10^0, 10^{-1}, 10^{-2}, 10^{-3}\}.

From Figure 3, we observe orders of convergence of n0+1n_0 + 1 for Gregory rules n0∈{1,2}n_0 \in\{1, 2\} in all compartments. The same holds for n0=3n_0 = 3 and Δt∈{100,10−1,10−2}\Delta t \in\{10^0, 10^{-1}, 10^{-2}\}. For the smallest considered time step of Δt=10−3\Delta t = 10^{-3}, the error of Gregory rule 3 deviates from the optimal convergence behavior in all compartments.

Convergence plots for susceptible, infected, and recovered individuals

Figure 3. Convergence of the suggested numerical schemes with different Gregory rules and 4th order FD approximation. Convergence is computed and shown for the number of susceptibles (left), infected (center) and recovered (right) individuals using the maximum norm of the relative error as given through (40), (41).

However, we note that the extrapolated relative error is close to machine precision for all compartments (i.e., 10−1510^{-15} to 10−1410^{-14}) and hence we summarize that the baseline scheme is capable of attaining numerical convergence orders as intended.

Impact of varying FD approximations

In (25), we have deliberately chosen more than the required FD approximation order to obtain the intended convergence order for different Gregory rules. In the following, we show how the convergence order is affected by the FD scheme. To do so, we consider FD approximations of order one, two and three as given in (28) to approximate S~′\tilde{S}'. All other parameters follow the previous setting.

As expected, the choice of the FD scheme does not influence the convergence in the approximated number of susceptibles (cf. left panels in Figure 4); in contrast to the number of infected and recovered individuals (center and right panels), where the FD scheme is used. For FD orders 1 and 2, the convergence order is dominated by the limited minimum order of convergence of the Gregory quadrature scheme and the FD scheme. We observe linear convergence when using a FD order 1 and quadratic convergence for FD order 2 for all considered Gregory rules, see Figure 4. Accordingly, we would expect second-order convergence for Gregory rule 1 and third-order convergence for Gregory rules 2 and 3 when using 3rd order FD. However, as shown in Figure 4, we obtain almost identical convergence for Gregory rule 3 and FD order 3 as for FD order 4. We did not further investigate if this effect is obtained by an additional cancellation of highest order error.

Convergence plots for different Gregory rules and FD approximations

Figure 4. Convergence of the numerical schemes with different Gregory rules for different FD approximations. Different rows depict different FD orders. In each row, convergence is computed and shown for the number of susceptibles (left), infected (center) and recovered (right) individuals using the maximum norm of the relative error as given through (40), (41).

Overall, the numerical results indicate that the convergence order of the approximations of I(t)I(t) and R(t)R(t) depends on both the Gregory rule n0n_0 and the order m0m_0 of the FD scheme. Across the considered test cases, and unless floating-point errors dominate, we observe

p≥min⁡{n0+1,m0}andp≤min⁡{n0+1,m0+1}.p \ge\min\{n_0 + 1,m_0\} \quad\text{and} \quad p \le\min\{n_0 + 1,m_0 + 1\}.

In particular, some configurations exhibit an empirical convergence order of m0+1m_0 + 1, exceeding the nominal order m0m_0 of the FD approximation. We do not provide a theoretical explanation for this apparent superconvergence here. The numerical results are furthermore consistent with the analytical results in Theorems 2.1 and 2.2.

Convergence orders for a time-dependent contact rate

In the previous examinations, we restricted ourselves to a constant contact rate ϕ(t)=ϕ\phi(t) = \phi and evaluated the individual impacts of Gregory rules and FD approximation to the convergence rate. We now consider time-dependent contact rates as allowed by our generalized model formulation (15). We also compare different interpolation functions to obtain a continuous transition for jumps in the contact rates as introduced in § 3. In particular, we consider two smoothing interpolations, the C1C^1 cosine interpolation of (22) as used by default in MEmilio and the C4C^4 polynomial smoothstep function of (23).

In both scenarios, we start as in the previous scenarios with a constant contact rate of ϕ=0.73\phi= 0.73 before applying a 10% reduction, corresponding to r=0.1r = 0.1 and damping factor 1−r=0.91-r = 0.9, at time tD=3.372907t_D = 3.372907 with a transition interval of length two, i.e., we set r=0.1r = 0.1 and δ=2\delta= 2, cf. the notation in (21). To avoid potential effects of the damping applied on the discretized grid, we chose tDt_D such that for all considered step sizes we have tD≠tjt_D \ne t_j, j∈Zj \in\mathbb{Z}. Here, we use the analytical derivative of the contact rate ϕ′\phi' but proceed with the FD approximation for computing S^′\hat{S}' to investigate the influence of the interpolation functions on the previously considered numerical scheme. We reduce the simulation interval to tmax⁡=5t_{\max} = 5 while all other parameters follow the previous setting.

Cosine interpolation function. The cosine interpolation function has been made available within the MEmilio framework [32] our IDE-based model is implemented with.

For all compartments and Gregory rules, we observe quadratic convergence, cf. Figure 5 (top). Due to reduced regularity of the integrands in (3) induced by the cosine interpolation function, we do not observe higher orders of convergence, even for Gregory rules 2 and 3. When considering the difference between the results of the ground truth and the simulation results of the IDE model for the susceptible individuals as depicted in the bottom row of Figure 5, we observe jumps around the beginning and end of the transition interval (at tj∈{1.38,1.39,3.38,3.39}t_j \in\{1.38, 1.39, 3.38, 3.39\}), i.e., the first two discrete points after the start and end of the transition interval, respectively. When applying Gregory rule 3, we apply end point corrections to the first and last three summands which are computed via higher order finite difference operators; cf. [33 p.74]. In the case of tj∈{1.38,1.39,3.38,3.39}t_j \in\{1.38, 1.39, 3.38, 3.39\}, these end point corrections are applied across start and end point of the transition interval where we have the reduced regularity of the cosine interpolation function. This leads to reduced orders of convergence as we assume higher regularity when deriving the correction terms. For the infected and recovered individuals, the difference between the ground truth and simulation results show even more jumps around the start and end of the transition interval. The jumps in the susceptibles are transferred via the FD approximation of the derivative S′S' to the infected and recovered compartments.

Convergence and difference per time step of the suggested numerical schemes

Figure 5. Convergence and difference per time step of the suggested numerical schemes with different Gregory rules, 4th order FD approximation, and cosine interpolation function for the time dependent contact rate. Convergence is computed and shown for the number of susceptibles (top left), infected (top center) and recovered (top right) individuals using the maximum norm of the relative error as given through (40), (41). Difference per time point between ground truth obtained with ODE model and simulation results of numerical scheme with 3rd Gregory rule, 4th order FD approximation and time step Δt=10−2\Delta t = 10^{-2} for the number of susceptibles (bottom left), infected (bottom center) and recovered (bottom right).

Polynomial smoothstep function. As the limited convergence order for the cosine interpolation function might come without surprise, we consider the polynomial smoothstep function which yields ϕ∈C4(R)\phi\in C^4(\mathbb{R}).

For all compartments, we observe convergence of n0+1n_0+1-th order for Gregory rule n0∈{1,2,3}n_0 \in\{1, 2, 3\}; cf. Figure 6 (top). When using the C4C^4 smoothstep function for smoothing the jumps on some interval, we observe that the error per time step is the largest around the transition interval, fading out towards the interval ends; cf. Figure 6 (bottom). Since the contact rate ϕ\phi is sufficiently smooth, we do not observe deteriorated errors around the end points of the transition interval for the susceptible individuals and, overall, obtain higher order convergence. For the infected and recovered individuals, we observe small jumps at around the start and end of the transition interval which are due to the kink in the difference of the susceptible individuals which is transferred to the subsequent compartments via its derivative S′S'. However, these errors do not limit the convergence.

Convergence and difference per time step of the suggested numerical schemes with different Gregory rules, 4th order FD approximation, and $C^4$ smoothstep function for the time dependent contact rate

Figure 6. Convergence and difference per time step of the suggested numerical schemes with different Gregory rules, 4th order FD approximation, and C4C^4 smoothstep function for the time dependent contact rate. Convergence is computed and shown for the number of susceptibles (top left), infected (top center) and recovered (top right) individuals using the maximum norm of the relative error as given through (40), (41). Difference per time point between ground truth obtained with ODE model and simulation results of numerical scheme with Gregory rule 3, 4th order FD approximation and time step Δt=10−2\Delta t = 10^{-2} for the number of susceptibles (bottom left), infected (bottom center) and recovered (bottom right).

Smoothstep summary. The formulation with smooth interpolation functions enables a practical setting or calibration of contact rates through the computation of a continuous solution on the entire simulation interval. In cases where higher order numerical schemes n0>2n_0 > 2 are required by the setting or the user, a

CkC^k polynomial smoothstep function, with k>2k > 2, should be preferred. For cases where, however, quadratic convergence order is sufficient, the cosine interpolation function is, first, sufficient and, second, also more efficient than polynomial smoothstep functions; cf. Figure 7.

Runtime comparison of cosine interpolation and different orders of polynomial smoothstep functions

Figure 7. Runtime comparison of the evaluation of cosine interpolation and different orders of polynomial smoothstep functions. All functions smooth a damping from 1 to 0 on the transition interval [0, 100], see Appendix § 11 for the definition of the polynomial smoothstep functions in CkC^k, k∈{1,2,3}k \in\{1, 2, 3\}. The results were obtained by evaluating the corresponding functions on 1 000 001 equidistant points on the considered interval. The figure shows the mean run time of 100 runs. Measurements were conducted on an Intel Xeon “Skylake” Gold 6132, 2.60 GHz with 14 cores per socket.

Impact of the included history on the convergence order

After having considered different numerical factors such as Gregory rule, FD approximation and interpolation of contact change points, we will now consider the convergence at the start of the simulation T~\widetilde{T}. For this, we will restrict ourselves again to a constant contact rate. As described in § 4.5, we require n0n_0 starting values to obtain convergence of order n0+1n_0 + 1 when applying Gregory rule n0n_0. In the previous sections, we have assumed that we already conducted a simulation with high accuracy for time points tj∈{ta,…,t0}t_j \in\{t_a,\ldots,t_0\}. This provided sufficiently accurate historic values to obtain the expected convergence order from the restart on. Now, we will investigate the case where we are not provided with suitable, previous simulation results and use a smaller step size at the start of the simulation to reduce the initial error below the higher numerical error at later time steps; cf. the discussion around (35).

We first show that the use of a constant step size Δt\Delta t from the start and over the whole horizon from T~\widetilde{T} until tmax⁡t_{\max} does indeed yield a reduced convergence order. In the second scenario, we use a finer step size Δt0\Delta t_0 on from T~\widetilde{T} to tswitch=ta+pΔtt_{switch} = t_a + p\Delta t with p=max⁡{n0−1,2m0−1}p = \max\{n_0 - 1, 2m_0 - 1\} before switching to the target step size

Δt\Delta t for the remaining simulation until tmax⁡t_{\max}, cf. Algorithm 1. The finer step size is set according to (35) to Δt0=Δt/k\Delta t_0 = \Delta t/k with k=⌈Δt−(n0−1)/2⌉k = \lceil\Delta t^{-(n_0-1)/2} \rceil. The results are depicted in Figure 8.

Convergence of the numerical schemes with different Gregory rules without and with time-step adaptation

Figure 8. Convergence of the numerical schemes with different Gregory rules without and with time-step adaptation. The first row depicts the scenario without choosing a smaller initial step size such that k=1k = 1 while the bottom row shows the convergence when adapting the initial step size according to Δt0=Δt/k\Delta t_0 = \Delta t/k with k=⌈Δt−(n0−1)/2⌉k = \lceil\Delta t^{-(n_0-1)/2} \rceil, cf. (35), until tswitcht_{\mathrm{switch}} before switching to the target step size Δt\Delta t. In each row, convergence is computed and shown for the number of susceptibles (left), infected (center) and recovered (right) individuals using the maximum norm of the relative error as given through (40), (41).

In Figure 8 (top), we observe the second and third order convergence for Gregory orders 1 and 2 but also only third order convergence for Gregory rule 3. In the case of insufficient starting values, we have to increase the Gregory stepwise, thus we can apply Gregory rule 2 only from t2t_2 on, and Gregory rule 3 from t3t_3 on. This explains the lower convergence order for Gregory rule 3. For Gregory rule 2 we would expect only second order convergence, i.e., our observations are better than expected. We did not further investigate this.

In Figure 8(bottom), we observe convergence order n0+1n_0 + 1 for Gregory rule n0n_0 until the error approaches machine precision. For Δt=10−3\Delta t = 10^{-3}, the error in the infected compartment is minimally larger than in the baseline scenario, cf. Figure 3 where the initial setting was not considered. This slight difference probably stems from the constants that were not considered when deriving the factor kk in (35). By using the finer step size until tswitcht_{\mathrm{switch}}, we can use Gregory rule from time point tswitcht_{\mathrm{switch}} on. Hence, at the first time point with respect to the target step size, we already obtain a sufficiently accurate approximation which is why we obtain the desired convergence with respect to the target step size.

Impact of the included history on epidemic outcomes

The advantage of IDE-based formulations over ODE-based ones clearly is the inclusion of past developments as these shape future dynamics. On one hand, including the history from the very first cases, i.e., T~≈T~\widetilde{T} \approx\widetilde{T} also means a substantially increased computational work load as t−T~t-\widetilde{T} grows. On the other hand, setting T~\widetilde{T} with increasing distance to T~\widetilde{T} will increase the model error as provided by (7); if we are not in the special case of exponential survival. In order to study the resulting model errors, we again generate ground truth trajectories. We consider two particular transition distributions, exponential and Erlang.

The general set up follows the baseline scenario as described in § 5.1.1. We use a constant time step Δt=10−2\Delta t = 10^{-2} to approximate the continuous IDE solution. We set T~=−50\widetilde{T} = -50 and compare different values T~∈{−50,−15,0}\widetilde{T} \in\{-50,-15,0\} to see the impact of the model error through the assumption of initial infection age in the IDE simulations. In contrast to previous settings, we compute the different IDE solutions directly from t0,IDE=T~t_{0,\mathrm{IDE}} = \widetilde{T} on. We use the third Gregory quadrature rule to approximate the integrals and the fourth order FD scheme (25) to approximate the derivative S^′\widehat{S}'.

Exponentially distributed sojourn times

For all choices of T~\widetilde{T}, we see that the simulation results regarding the compartments coincide with the ground truth cf. Figure 9. Regarding the infection age distribution, we have a high number of infected individuals with infection age zero at t=0t = 0 for T~=0\widetilde{T} = 0 and a more diverse infection age distribution for the other two scenarios, cf. Figure 10 (left). This is due to assumption (6). At time t=10t = 10, we observe in Figure 10 (right) that the infection age distributions are much more aligned with only a small difference for an infection age of 10 as the remainder of the finite history assumption. In Theorems 2.1 and 2.2, we have shown that the IDE model is equivalent to a corresponding ODE model for any choice of T~\widetilde{T} where the dynamics only depend on the current state of the system and not on the history. Our numerical simulations confirm these theoretical results.

Comparison of compartmental values for the ground truth and the three IDE simulations with different start values $\widetilde{T}$ using an exponentially distributed transition from infected to recovered state.

Figure 9. Comparison of compartmental values for the ground truth and the three IDE simulations with different start values T~\widetilde{T} using an exponentially distributed transition from infected to recovered state. Numbers of individuals in susceptible, infected, and recovered state over the whole simulation period.

Comparison of the infection age distribution for the three different start values $\widetilde{T}$ using an exponentially distributed transition from infected to recovered state.

Figure 10. Comparison of the infection age distribution for the three different start values T~\widetilde{T} using an exponentially distributed transition from infected to recovered state. Left: t=0t = 0, right: t=10t = 10.

Erlang-distributed sojourn times

In contrast to the memoryless exponential distribution, the Erlang distribution is more realistically modeling compartmental transition [2]. To define a corresponding ground truth, we can use an ODE-based model employing the Linear Chain Trick (LCT model); cf., e.g., [7] and the references therein.

In both, the LCT and the IDE, models, we consider Erlang distributed sojourn times with mean TI=4T_I = 4. In the LCT model, we divide the infected compartment into six subcompartments. To be precise, the Erlang distribution is defined via the shape parameter k=6k = 6 and the rate parameter λ=kTI\lambda= \frac{k}{T_I}. At the earliest time point T~\widetilde{T}, all infected individuals I^(T~)\widehat{I}(\widetilde{T}) are assigned to the first subcompartment to match the assumption on infection age zero at T~\widetilde{T}. Furthermore, we set ϕ=0.4\phi= 0.4 and tmax⁡=80t_{\max} = 80. All other parameters follow § 5.1.1.

In contrast to the memoryless exponential distribution, we see that the inclusion of historic data over differently sized initialization horizons can make a fundamental impact regarding peak size and timing; see Figure 11. Using T~=T~b=−50\widetilde{T} = \widetilde{T}_b = -50, the corresponding IDE simulation matches the ground truth very well, with only a difference of 1.79⋅10−71.79 \cdot10^{-7} in the infected compartment at t=10t = 10. In contrast, when setting T~=−15\widetilde{T} = -15, we obtain 52 203.91 more infected individuals (+12.00 % compared to the ground truth), and when setting T~=0\widetilde{T} = 0, we obtain 197 020.08 more infected individuals (+45.30 % compared to the ground truth) at t=10t = 10, respectively. Interestingly, we also observe that not only different peak sizes but also different final sizes are obtained for different values of T~\widetilde{T} when using an Erlang distribution.

Comparison of compartmental values for the ground truth and the three IDE simulations with different start values

Figure 11. Comparison of compartmental values for the ground truth and the three IDE simulations with different start values Tˉ\bar{T} using an Erlang distributed transition from infected to recovered state. Top row: Numbers of individuals in susceptible, infected, and recovered state over the whole initialization and simulation period. Bottom row: Zoomed view of the top row from t=−20t = -20 until t=10t = 10.

When using T~>T~b\widetilde{T} > \widetilde{T}_b, we observe more infected individuals in the rise of the epidemic than in the ground truth, cf. Figure 11 (bottom). By making the zero infection age assumption at T~>T~b\widetilde{T} > \widetilde{T}_b, we are overestimating the number of individuals that have a small infection age for which we have larger values of γIR\gamma_I^R; cf. Figure 12.

Comparison of the infection age distribution for the three different start values

Figure 12. Comparison of the infection age distribution for the three different start values T~\widetilde{T} using an IDE model with Erlang distributed transition from infected to recovered state. Left: t=0t = 0, right: t=10t = 10.

Hence, we are overestimating the contribution to the force of infection these individuals make, thus leading to more infected individuals than in the ground truth.

Moreover, we see that the number of recovered individuals stays nearly constant for the first days after Tˉ\bar{T} when setting Tˉ>Tˉ\bar{T} > \bar{T}, cf. Figure 11 (bottom). All infected individuals are assigned an infection age of zero at Tˉ\bar{T}, cf. (6). Since γIR(0)=1\gamma_{I}^{R}(0) = 1, only a small fraction of these individuals is recovering in the first days. In the ground truth, the infection age distribution is more diverse at the respective time points t∈{−15,0}t \in\{-15, 0\} so that more individuals have a larger infection age thus leading to more individuals that are recovering in the first days after t∈{−15,0}t \in\{-15, 0\}. For this reason, we observe a delay in the rise of the recovered compartment in the scenarios with Tˉ>Tˉ\bar{T} > \bar{T} compared to the ground truth.

Conclusion

In this paper, we considered different aspects of the numerical solution of IDE-based models for infectious disease dynamics. For similar IDE-based formulations selected theoretical properties of the model [16, 18] or the novel numerical schemes [14, 28] were considered. However, when it came to the application of IDE-based models for ongoing epidemic dynamics, several questions remained unanswered. We generalized the model formulation in the number of susceptible individuals by allowing contact change points in the simulation. Importantly, we also considered the developments and convergence rates in further disease compartments such as infected and recovered.

The numerical extension for additional compartments requires additional components, e.g., particular finite differences to approximate the derivative in the number of susceptible individuals. Computing additional compartments is of particular importance for practical applications, e.g., to also obtain the total number of ongoing infections or the number of new hospitalizations in more advanced models [20]. While the convergence in the number of susceptibles only depends on the Gregory rule, we showed that similar, higher order FD schemes are needed to obtain the intended convergence order in the number of infected or recovered individuals.

The characterization of the time-dependent contact rate as a step-wise constant function with CkC^k smoothing between the jumps allows for setting and calibrating contacts on a finite number of discretization points. We compared a previously implemented cosine smoother function of the MEmilio framework [32] against polynomial smoothstep functions that yield up to fourth order convergence for settings with intervention-induced contact change points. An extension to even higher order methods is straightforward as it only requires replacing the individual components of our scheme (Gregory rule, FD, and smoothstep function) by functions with higher order error terms.

When comparing to a ground truth obtained with an ODE model, we showed for the exponential setting that the convergence order of the higher order numerical scheme deteriorates if we do not have sufficiently accurate approximations of past dynamics. We showed that the requirement of suitable initial values can be resolved by using a finer step size on a small initial interval before switching to a larger time step.

We considered IDE models that were started not only at the start of the epidemic but also at later times in the outbreak. This required making the assumption of zero infection age at the simulation start. As expected, we showed that starting the simulation at different time points does not change the course of the epidemic if an exponential transition distribution is used. This is in contrast to more realistic transition distributions such as Erlang for which we have shown substantial differences in epidemic outcomes when starting the IDE simulation at different times in the epidemic. The IDE-based SIR model was implemented in C++ in the high performance Modular EpideMIcs simuLatIOn software MEmilio. While we demonstrated how the solver’s individual components yield schemes with up to fourth order convergence, we also demonstrated that less costly components such as, e.g., lower order FD are sufficient if lower order Gregory rules are used. As the MEmilio framework shall enable users to flexibly choose between models and numerical solution schemes, the next software engineering tasks will contain the adaptive and compile-time combination of the individual solver components to obtain a run-time to convergence order optimized numerical solution scheme. In here, comparisons will have to be made to the already existing lower order nonstandard scheme for which a cost-efficient update rule was established [20]. We furthermore expect our scheme to be generalizable to, e.g., SECIR-type models with presymptomatic or hospitalized individuals.

Author Contributions

Conceptualization: Anna Wendler, Martin J. Kühn Data Curation: Anna Wendler Formal Analysis: Anna Wendler, Jan Hasenauer, Martin J. Kühn Funding Acquisition: Jan Hasenauer, Martin J. Kühn Investigation: Anna Wendler, Martin J. Kühn Methodology: Anna Wendler, Martin J. Kühn Project Administration: Martin J. Kühn Resources: Martin J. Kühn Software: Anna Wendler Supervision: Jan Hasenauer, Martin J. Kühn Validation: Anna Wendler, Jan Hasenauer, Martin J. Kühn Visualization: Anna Wendler, Martin J. Kühn Writing – Original Draft: Anna Wendler, Martin J. Kühn Writing – Review & Editing: Anna Wendler, Jan Hasenauer, Martin J. Kühn

Acknowledgements

This work was supported by the Initiative and Networking Fund of the Helmholtz Association (grant agreement number KA1-Co-08, Project LOKI-Pandemics). It was furthermore supported by the German Federal Ministry of Education and Research and the German Federal Ministry of Research, Technology and Space under grant agreement 031L0324E (Project EPISERVE). EPISERVE is part of the Modeling Network for Severe Infectious Diseases (MONID). Additionally, this work was supported by the European Union via the ERC grant INTEGRATE, grant agreement number 101126146, and under Germany’s Excellence Strategy by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) (EXC 2047—390685813, EXC 2151—390873048, and 524747443), the University of Bonn via the Schlegel Professorship of J.H.

Competing interests

The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.

Data availability

All simulations were implemented and performed using the MEmilio framework [32]. The specific simulation scenarios and plotting scripts are accessible at https://github.com/SciCompMod/memilio-simulations/tree/main/2026_Wendler_et_al_Higher_order_IDE.

Gregory quadrature weights

We consider an integral approximation of the form

∫Ttnf(x) dx≈Δt∑j=anωn−a,j−an0f(tj),n≥a+n0,\int_{T}^{t_n} f(x)\,\mathrm{d}x \approx\Delta t \sum_{j=a}^{n} \omega_{n-a,j-a}^{n_0} f(t_j), \qquad n \ge a+n_0,

where tk=kΔtt_k = k\Delta t for k∈Zk \in\mathbb{Z} provides a uniform discretization of R\mathbb{R}, and we assume ta=T~,a∈Z≤0t_a = \widetilde{T}, a \in\mathbb{Z}_{\le0}.

The quadrature weights for Gregory rule n0n_0 can be described via the matrices Ωn0=(ωi,jn0)i,j\Omega^{n_0} = \left(\omega_{i,j}^{n_0}\right)_{i,j} with i∈Z≥n0, j∈{0,…,i}i \in\mathbb{Z}_{\ge n_0},\ j \in\{0,\ldots,i\}. For each Ωn0\Omega^{n_0}, row ii contains i+1i+1 weights that are correspondingly used for an approximation based on i+1i+1 discrete points, i.e., an approximation through a sum with i+1i+1 summands. The column index jj refers to the weight of the corresponding summand within this sum. Note that for Gregory rule n0n_0, the weights for the first and last n0n_0 discrete points are corrected whereas the remaining inner points have a weight of one and that the correction is symmetric. For the derivation of the specific weights ωi,jn0\omega_{i,j}^{n_0}, we refer to [33]. Examples for n0∈{1,2,3}n_0 \in\{1,2,3\}, which are used within this paper, are given below.

  • Gregory rule 1:

Ω1=12(11121⋮⋮⋱⋱12⋯21)(42)\Omega^1 = \frac{1}{2} \begin{pmatrix} 1 & 1 \\ 1 & 2 & 1 \\ \vdots& \vdots& \ddots& \ddots\\ 1 & 2 & \cdots& 2 & 1 \end{pmatrix} \tag*{(42)}
  • Gregory rule 2:

Ω2=112(514551313551312135⋮⋮⋮⋱⋱⋱51312⋯12135)(43)\Omega^2 = \frac{1}{12} \begin{pmatrix} 5 & 14 & 5 \\ 5 & 13 & 13 & 5 \\ 5 & 13 & 12 & 13 & 5 \\ \vdots& \vdots& \vdots& \ddots& \ddots& \ddots\\ 5 & 13 & 12 & \cdots& 12 & 13 & 5 \end{pmatrix} \tag*{(43)}
  • Gregory rule 3

Ω3=124(927279928222899282323289928232423289⋮⋮⋮⋮⋱⋱⋱⋱9282324⋯2423289)(44)\Omega^3 = \frac{1}{24} \begin{pmatrix} 9 & 27 & 27 & 9 \\ 9 & 28 & 22 & 28 & 9 \\ 9 & 28 & 23 & 23 & 28 & 9 \\ 9 & 28 & 23 & 24 & 23 & 28 & 9 \\ \vdots& \vdots& \vdots& \vdots& \ddots& \ddots& \ddots& \ddots\\ 9 & 28 & 23 & 24 & \cdots& 24 & 23 & 28 & 9 \end{pmatrix} \tag*{(44)}

Polynomial smoothstep functions

In Figure 7, we consider not only the cosine smoother cosine and C4C^4 polynomial smoothstep functions, but also CkC^k, k∈{1,2,3}k \in\{1, 2, 3\} smoothstep functions. These functions are defined below where ϕ0\phi_0, tDt_D and δ\delta are as in § 3.

ϕ~P1(t)=ϕ0+((1−r)ϕ0−ϕ0)(3(t−tD+δδ)2−2(t−tD+δδ)3)(45)\widetilde{\phi}^{P1}(t) = \phi_0 + \left((1-r)\phi_0-\phi_0\right)\left(3\left(\frac{t-t_D+\delta}{\delta}\right)^2 - 2\left(\frac{t-t_D+\delta}{\delta}\right)^3\right) \tag*{(45)}
ϕ~P2(t)=ϕ0+((1−r)ϕ0−ϕ0)(10(t−tD+δδ)3−15(t−tD+δδ)4+6(t−tD+δδ)5)(46)\widetilde{\phi}^{P2}(t) = \phi_0 + \left((1-r)\phi_0-\phi_0\right)\left(10\left(\frac{t-t_D+\delta}{\delta}\right)^3 - 15\left(\frac{t-t_D+\delta}{\delta}\right)^4 + 6\left(\frac{t-t_D+\delta}{\delta}\right)^5\right) \tag*{(46)}
ϕ~P3(t)=ϕ0+((1−r)ϕ0−ϕ0)(35(t−tD+δδ)4−84(t−tD+δδ)5+70(t−tD+δδ)6−20(t−tD+δδ)7)(47)\widetilde{\phi}^{P3}(t) = \phi_0 + \left((1-r)\phi_0-\phi_0\right)\left(35\left(\frac{t-t_D+\delta}{\delta}\right)^4 - 84\left(\frac{t-t_D+\delta}{\delta}\right)^5 + 70\left(\frac{t-t_D+\delta}{\delta}\right)^6 - 20\left(\frac{t-t_D+\delta}{\delta}\right)^7\right) \tag*{(47)}

References

  1. [1]M. T. Hoang, M. Ehrhardt, Differential equation models for infectious diseases: Mathematical modeling, qualitative analysis, numerical methods and applications, SeMA Journal (2025) 1–36doi:10.1007/s40324-025-00404-9.DOI
  2. [2]Z. Feng, D. Xu, H. Zhao, Epidemiological models with non-exponentially distributed disease stages and applications to disease control, Bulletin of Mathematical Biology 69 (5) (Jul. 2007). doi:10.1007/s11538-006-9174-9.DOI
  3. [3]N. MacDonald, Time Lags in Biological Models, Lecture Notes in Biomathematics, Springer Berlin, Heidelberg, 1978. doi:10.1007/978-3-642-93107-9.DOI
  4. [4]P. J. Hurtado, A. S. Kirosingh, Generalizations of the ‘Linear Chain Trick’: incorporating more flexible dwell time distributions into mean field ODE models, Journal of Mathematical Biology 79 (5) (Oct. 2019). doi:10.1007/s00285-019-01412-w.DOI
  5. [5]P. J. Hurtado, C. Richards, Building mean field ODE models using the generalized linear chain trick & Markov chain theory, Journal of Biological Dynamics 15 (sup1) (May 2021). doi:10.1080/17513758.2021.1912418. URL https://doi.org/10.1080/17513758.2021.1912418
  6. [6]P. J. Hurtado, C. Richards, Finding Reproduction Numbers for Epidemic Models and Predator-Prey Models of Arbitrary Finite Dimension Using the Generalized Linear Chain Trick, Bulletin of Mathematical Biology 87 (7) (2025) 89. doi:10.1007/s11538-025-01467-5. URL https://doi.org/10.1007/s11538-025-01467-5
  7. [7]L. Plötzke, A. Wendler, R. Schmieding, M. J. Kühn, Revisiting the linear chain trick in epidemiological models: Implications of underlying assumptions for numerical solutions, Mathematics and Computers in Simulation 239 (2026) 823–844. doi:10.1016/j.matcom.2025.07.045.DOI
  8. [8]W. O. Kermack, A. G. McKendrick, G. T. Walker, A contribution to the mathematical theory of epidemics, Proceedings of the Royal Society of London. Series A, Containing Papers of a Mathematical and Physical Character 115 (772) (1927) 700–721. doi:10.1098/rspa.1927.0118.DOI
  9. [9]H. W. Hethcote, D. W. Tudor, Integral equation models for endemic infectious diseases, Journal of mathematical biology 9 (1) (1980) 37–47.DOI
  10. [10]F. Brauer, J. Watmough, Age of infection epidemic models with heterogeneous mixing, Journal of Biological Dynamics 3 (2-3) (2009) 324–330. doi:10.1080/17513750802415822.DOI
  11. [11]F. Brauer, C. Castillo-Chavez, Z. Feng, Mathematical Models in Epidemiology, Vol. 69 of Texts in Applied Mathematics, Springer New York, New York, NY, 2019. doi:10.1007/978-1-4939-9828-9.DOI
  12. [12]C. Barril, A. Calsina, S. Cuadrado, J. Ripoll, Reproduction number for an age of infection structured model, Mathematical Modelling of Natural Phenomena 16 (2021) 42. doi:10.1051/mmnp/2021033.DOI
  13. [13]J. Demongeot, Q. Griette, Y. Maday, P. Magal, A Kermack–McKendrick model with age of infection starting from a single or multiple cohorts of infected patients, Proceedings of the Royal Society A: Mathematical, Physical and Engineering Sciences 479 (2272) (2023) 20220381. doi:10.1098/rspa.2022.0381.DOI
  14. [14]M. Pezzella, Infectious Disease Outbreak Simulation: Accurate and Dynamically Consistent Numerical Methods for Integro-Differential Epidemic Models, Ph.D. thesis, Universita degli Studi di Napoli Federico II (2024). doi:10.13140/RG.2.2.19393.36967.DOI
  15. [15]F. Brauer, The Kermack–McKendrick epidemic model revisited, Mathematical Biosciences 198 (2) (2005) 119–131. doi:10.1016/j.mbs.2005.07.006.DOI
  16. [16]F. Brauer, Age-of-infection and the final size relation, Mathematical Biosciences and Engineering 5 (1551-0018_2008_4_681) (2008) 681–690. doi:10.3934/mbe.2008.5.681.DOI
  17. [17]D. Breda, O. Diekmann, W. F. De Graaf, A. Pugliese, R. Vermiglio, On the formulation of epidemic models (an appraisal of Kermack and McKendrick), Journal of Biological Dynamics 6 (sup2) (Sep. 2012). doi:10.1080/17513758.2012.716454.DOI
  18. [18]F. Brauer, Z. Shuai, P. van den Driessche, Dynamics of an age-of-infection cholera model, Mathematical Biosciences and Engineering 10 (5/6) (2013) 1335–1349. doi:10.3934/mbe.2013.10.1335.DOI
  19. [19]F. Bai, An age-of-infection model with both symptomatic and asymptomatic infections, Journal of Mathematical Biology 86 (5) (2023) 82. doi:10.1007/s00285-023-01920-w.DOI
  20. [20]A. Wendler, L. Plötzke, H. Trit zschak, M. J. Kühn, A nonstandard numerical scheme for a novel SECIR integro-differential equation-based model allowing nonexponentially distributed stay times, Applied Mathematics and Computation 509 (2026) 129636. doi:10.1016/j.amc.2025.129636.DOI
  21. [21]F. Scarabel, H. Coldwell, T. Cassidy, Genuine and spurious bistability in a simple epidemic model with waning immunity, Mathematical Biosciences 396 (2026) 109671. doi:10.1016/j.mbs.2026.109671.DOI
  22. [22]O. Diekmann, H. Inaba, H. R. Thieme, Mathematical epidemiology of infectious diseases: an ongoing challenge, Japan Journal of Industrial and Applied Mathematics 42 (4) (2025) 1563–1590. doi:10.1007/s13160-025-00742-1.DOI
  23. [23]J. M.-S. Lubuma, Y. A. Terefe, A nonstandard Volterra difference equation for the SIS epidemiological model, Revista de la Real Academia de Ciencias Exactas, Físicas y Naturales. Serie A. Matemáticas 109 (2) (2015) 597–602. doi:10.1007/s13398-014-0203-5.DOI
  24. [24]E. Messina, M. Pezzella, A. Vecchio, A non-standard numerical scheme for an age-of-infection epidemic model, Journal of Computational Dynamics 9 (2) (2022) 239. doi:10.3934/jcd.2021029.DOI
  25. [25]E. Messina, M. Pezzella, A. Vecchio, A long-time behavior preserving numerical scheme for age-of-infection epidemic models with heterogeneous mixing, Applied Numerical Mathematics 200 (2024) 344–357, new Trends in Approximation Methods and Numerical Analysis (FAATNA20>22). doi: 10.1016/j.apnum.2023.04.009.DOI
  26. [26]B. Buonomo, E. Messina, C. Panico, A. Vecchio, A stable numerical method for integral epidemic models with behavioral changes in contact patterns, Electron Trans Numer Anal 61, 137-156, 2024 (2024). doi:10.1553/etna_vol61s137.DOI
  27. [27]B. Buonomo, E. Messina, C. Panico, M. Pezzella, G. Zanghirati, Epitime: A computational framework for integral epidemic models with structure-preserving discretizations, CMES-Computer Modeling in Engineering & SciencesSpecial Issue: Advances in Mathematical Modeling: Numerical Approaches and Simulation for Computational Biology (2026). doi:10.32604/cmes.2026.084828.DOI
  28. [28]E. Messina, M. Pezzella, A. Vecchio, Positive numerical approximation of integro-differential epidemic model, Axioms 11 (2) (2022) 69. doi:10.3390/axioms11020069.DOI
  29. [29]H. Braß, Quadraturverfahren, Vol. 3 of Studia mathematica: Skript, Vandenhoeck & Ruprecht, Göttingen, 1977.
  30. [30]K. Prem, Y. Liu, T. W. Russell, A. J. Kucharski, R. M. Eggo, N. Davies, S. Flasche, S. Clifford, C. A. B. Pearson, J. D. Munday, S. Abbott, H. Gibbs, A. Rosello, B. J. Quilty, T. Jombart, F. Sun, C. Diamond, A. Gimma, K. v. Zandvoort, S. Funk, C. I. Jarvis, W. J. Edmunds, N. I. Bosse, J. Hellewell, M. Jit, P. Klepac, The effect of control strategies to reduce social mixing on outcomes of the COVID-19 epidemic in Wuhan, China: a modelling study, The Lancet Public Health 5 (5) (2020) e261–e270. doi:10.1016/S2468-2667(20)30073-6.DOI
  31. [31]A. Schmidt, H. Zunker, A. Heinlein, M. J. Kühn, Graph neural network surrogates to leverage mechanistic expert knowledge towards reliable and immediate pandemic response, Scientific Reports (2026). doi:10.1038/s41598-026-39431-5.DOI
  32. [32]J. Bicker, C. Gerstein, D. Kerkmann, S. Korf, R. Schmieding, A. Wendler, H. Zunker, D. Abele, M. Betz, K. Nguyen, L. Plötzke, K. Volmer, A. Schmidt, N. Waßmuth, P. Lenz, D. Richter, H. Tritzschak, R. Hannemann-Tamas, J. Litz, P. Johannssen, M. Borges, A. Jungklaus, M. Heger, A. Lange, E. Kluth, K. Rack, V. Wieland, J. Arruda, S. C. Binder, M. Klitz, M. Siggel, M. Dahmen, A. Basermann, M. Meyer-Hermann, J. Hasenauer, M. J. Kühn, MEmilio: a high performance Modular EpidemIcs simulation software for multi-scale and comparative simulations of infectious disease dynamics, Scientific Reports 16 (1) (2026) 26950. doi:10.1038/s41598-026-66481-6.DOI
  33. [33]H. Brunner, The Numerical Solution of Volterra Equations, no. 3 in CWI Monographs, North-Holland, 1986.
  34. [34]R. J. LeVeque, Finite Difference Methods for Ordinary and Partial Differential Equations, Society for Industrial and Applied Mathematics, 2007. doi:10.1137/1.9780898717839.DOI

Paper details

vlnc:W_s8du4utn
Version
v1 · latest
Published
Fresh — added to the Hub within the last 30 days
Added
License
CC BY 4.0
Usage

views · 13

downloads · 0

A view counts once per browser per day, a download each time the PDF is requested.

  • Mathematics

Not recorded for this paper

View statement
Looking for related papers…
Contents