{'fraction_non_alphanumeric': 0.03883617963314358, 'fraction_numerical': 0.012713472485768502, 'mean_word_length': 4.785217709476766, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Recovering the time-dependent transmission rate from infection data via solution of an inverse ODE problem

The transmission rate of many acute infectious diseases varies significantly in time, but the underlying mechanisms are usually uncertain. They may include seasonal changes in the environment, contact rate, immune system response, etc. The transmission rate has been thought difficult to measure directly. We present a new algorithm to compute the time-dependent transmission rate directly from prevalence data, which makes no assumptions about the number of susceptibles or vital rates. The algorithm follows our complete and explicit solution of a mathematical inverse problem for SIR-type transmission models. We prove that almost any infection profile can be perfectly fitted by an SIR model with variable transmission rate. This clearly shows a serious danger of over-fitting such transmission models. We illustrate the algorithm with historic UK measles data and our observations support the common belief that measles transmission was predominantly driven by school contacts.


I. INTRODUCTION
The SIR epidemic model was proposed by Kermack and McKendrik [15] and was extensively developed by Anderson and May [1]. One of the key parameters in these transmission models is the transmission rate, which is the product of the average number of contacts a susceptible individual has with infected individuals per unit time and the average probability of transmission during each effective contact. In Section 3.4.9 of Anderson and May [1], the authors state that "... the direct measurement of the transmission rate is essentially impossible for most infections. But if we wish to predict the changes wrought by public health programmes, we need to know the transmission rate ... ." The transmission rate of many accute infectious diseases varies significantly in time and frequently exhibits significant seasonal dependence [3,8,22]: influenza, pneumococcus, and rotavirus cases peak in winter; RSV and measles cases peak in spring; and polio cases peak in summer.
Measles outbreaks in several UK cities (pre-vaccine) followed a two-year cycle, and many investigators have attempted to explain this two-year cycle with mathematical models. Since measles cases, as well as cases of several other childhood viral diseases such as pertussis, seem to strongly correlate with school terms and breaks, previous modelers have assumed that the transmission rate can be represented by a simple trigonometric [11] or Haar [14] function which has one-year period.
Our work calls this assumption into question.
Virtually all previous investigators have estimated the transmission rate using the formula β(k) = I(k + 1) where, for instance, S(k), I(k) are the proportions of susceptible and infected individuals during week k [2,10]. This formula requires knowledge of S(k), which is usually very difficult to estimate.
Our new algorithm obviates this difficulty.
We first consider the simplest SIR transmission model and allow the transmission rate to be a time-dependent function, i.e., there is a positive function β(t) such that such that S(t), I(t), and R(t) are the proportions of susceptible, infected, and removed individuals of time t. We begin by asking the mathematical question: Given smooth infection data on time interval [0, T ] and recovery rate ν > 0, can one always choose a transmission rate function β(t) such that the SIR epidemic model always perfectly fits the smooth data with the given ν?
Mathematicians call this an inverse problem. We prove that this is always possible subject to a mild restriction on the infection data and ν, and we provide an explicit formula for the solution.
The construction also illustrates the danger of overfitting a transmission model where one can choose the time-dependent transmission rate.
However, in practice, infection data are always discrete, not continuous. We show that one can robustly estimate β(t) by first smoothly interpolating the data with a spline or trigonometric function and then applying the formula to smooth data.
The usual transmission rate recovery method based on (1) can be viewed as a discretization of (3). Our new method not only avoids this crude discretization but also uses the additional information contained in (1).
We extend our recovery algorithm to more general classes of transmission models including the SEIR epidemic model with vital rates, and we illustrate the extended algorithm using UK measles data during 1948-1966. Our recovered transmission rate β(t) has two dominant spectral peaks: at frequencies 1/2 and 3 per year, respectively, with the former having the largest power. There is no significant peak corresponding to an annual cycle, as hypothesized by all previous authors. As a strong consistency check, our recovered β(t) exhibits minima in July-August during the summer school vacation: the months with the fewest number of notifications, and maxima during the winter-spring period January-June: when there were the largest number of notifications.

II. RESULTS
We rigorously derive a mathematical algorithm for recovering the time-dependent transmission rate from infection data. This algorithm is applied to two simulated data sets representing two characteristic "types" of infectious diseases. We then illustrate the algorithm using UK measles data from 1948-1966.

A. Recovery algorithm
Our recovery algorithm is based on a mathematical solution of an inverse problem, which is expanded in Section IV A. To recover the transmission rate β(t) from an infection data set, the recovery algorithm has four steps and requires two conditions.
Smoothly interpolate the infection data with spline or trigonometric functions to generate a smooth f (t). Check condition 1: where ν is the removal rate.
Step 2. Compute the function . Condition 1 prevents a zero denominator in p(t).
Step 3. Choose β(0) and compute the integral P (t) =  Condition 1 is equivalent to d(ln f (t))/dt > −ν, i.e., the time series of infection data cannot decay too fast at any time. This is a mild condition that most data sets satisfy. If a data set does not satisfy this condition, we propose a scaling trick in Section III to be able to apply the algorithm.
In Section IV B, we present extensions of the basic recovery algorithm to several popular extensions of the SIR model, including the SEIR model with variable vital rates. Our algorithm can be extended to virtually any such compartment model.

B. Recovering the transmission rate from simulated data
We first illustrate the recovery algorithm using two simulated data sets. The functions f (t) and g(t) are the fractions of the infected population for two characteristic "types" of infectious diseases.
The first data set simulates an infectious disease with periodic outbreaks, as observed in measles (before mass vaccination) and cholera [4,18]. The periodic function f (t) = 10 −5 [1.4 + cos(1.5t)] represents the continuous infection data, and Figure 1(a) contains plots of both f (t) (solid) and its associated transmission rate function β(t) (dashed).
The second data set simulates an infectious disease with periodic outbreaks that decays in time, as observed in influenza [20]. We extract discrete data from functions f (t) and g(t) by sampling them at equi-spaced intervals (see the small black squares in Figure 1(a) and Figure 2(a)). To each discrete time series, we apply two well-known interpolation algorithms (trigonometric approximation and spline approximation) [16,21]. Figure 1(b) and Figure 2 Many simulations show that the recovery algorithm is robust with respect to white noise up to 10% of the data mean, as well as the number of sample points.
The peaks of β(t) in Figure 1 are increasing over time. This is a manifestation of the choice of β(0) and ν. Different values of β(0) and ν may lead to the peaks increasing, decreasing, or non-monotone over time. We will see in Section II C that for historic UK measles, the important global characteristics of β(t) are robust with respect to β(0).

C. Recovering the transmission rate from UK measles data
Previous studies [9,13] employed the SEIR model with vital rates to explore the epidemic and endemic behaviors of measles infections, using the notification data in [19].  Figure 3(c)) with a strong 1/year frequency component (see Figure 3(d)). Some years these variations approach 20%. We follow custom and include actual births in our model. Since neither database contains the detailed birth rates (quarterly or monthly) from 1957−1966, this requires us to restrict to the period 1948−1956.
We aggregate the weekly incidence data to obtain monthly data (see Figure 3(a)). The aggregation filters the data and reduces noise. There is a well-documented and well-studied underreporting bias in the UK measles data [5,6], thus we incorporate the standard correction factor of 40% in our simulations. We assume a constant correction factor as previous studies [5,6], although the recovered β(t) may be influenced by subtleties of the underreporting. In addition, we smoothly interpolate the quarterly birth data to obtain monthly birth data. We then smoothly interpolate the monthly data (infection and birth) and compute β(t) using the extended recovery algorithm.
The authors [9,13] used a school term-based step function for the transmission rate, which attains the values 846/year during January 1-6 and 1408/year during January 7-31. We choose the mean value of their transmission rate function in January, β(0) = 1299 as the value of β(0) in our simulations.
In Figure 3(e) we plot the annual transmission rate β(t) recovered from our algorithm. As a strong consistency check, note that annual minima occur in July-August during the summer school vacation period and annual maxima occur between January and June. This corresponds precisely with infection data and the assumptions of other modelers.
In Figure 3(f) we plot the modulus of the Fourier transform of β(t) and observe that the dominant spectral peaks have 2 and 1/3-year periods, with the former having higher power. It is interesting to compare these periods to the dominant spectral peak of 1-year period for the birth rate ( Figure 3(d)) and 2 and 1-year periods for the number of infections (Figure 3(b)). All previous measles transmission models assumed β(t) to be a sine or step function with one-year period, to account for mixing of children in school. The three times per year cycle seems quite curious, and we are not yet able to explain the biological significance of this. Our numerical simulations show that the dominant frequencies of β(t) are quite robust with respect to the choice of β(0).
In Figure 4, we compare our recovered β(t) with the school term-based step transmission rate function introduced by Earn et al. [9], Keeling and Rohani [13]. Although it is evident that the graphs look quite different, there are a number of qualitative similarities, such as when their annual maxima and minima occur.

III. DISCUSSION
In this paper, we provide a new algorithm to recover the time-dependent transmission rate from infection data. The algorithm only requires the number of infected individuals at each time interval, and does not require the number of susceptible individuals, as did the previously used method.
The algorithm should apply to the vast majority of infection data sets, and a consequence is that one can nearly always construct a time-dependent transmission rate β(t) such that SIR model will fit the data perfectly. This illustrates a potential danger of overfitting an epidemic model with time-dependent rate functions.
We illustrate the recovery algorithm for the SEIR model with variable vital rates, and we apply this algorithm to UK measles data from 1957 − 1966. The Fourier transform of our recovered transmission rate shows the two dominant spectral peaks have frequencies 1/2 and 3 per year, respectively. All previous measles transmission models assumed a one-year periodic transmission rate function to account for mixing of children in school.
Using the available yearly birth data from 1957 − 1966 [23], we recovered β(t) over this period.
The birth rate is almost a constant since the yearly birth data cannot show annual oscillations.
We have verified that the conditions of the recovery algorithm are satisfied under the assumption of a constant birth rate (equal to the death rate, as assumed by many measles modelers) during the entire period pre-vaccination 1948 − 1966.
Our algorithm has some limitations to its applicability. First, the proportion of infected individuals, f (t), can not decrease too fast over the full time interval of interest. In general, one can add a sufficiently large constant to f (t) to ensure this, but this will change the range of applicable β(0), and applicability needs to be checked. Second, one must assume that the proportion (or

A. Mathematical derivation
The recovery algorithm follows from the following complete solution of the inverse problem.
Theorem IV.1 Given a smooth positive function f (t), ν > 0, and T > 0, there exists K > 0 such The growth condition imposes no restrictions on how f (t) increases, but requires that f (t) cannot decrease too quickly, in the sense that its logarithmic derivative is always bounded below by −ν. It is easy to see that f ′ (t)/f (t) > −ν is a necessary condition, since Equation (3) implies The proof of the theorem consists of showing that this condition is also sufficient. We rewrite Equation (3) as then compute S ′ (t), and then equate with Equation (2) to obtain d dt Calculating the derivative and simplifying the resulting expression yields the following Bernoulli differential equation for β(t) The change of coordinates x(t) = 1/β(t) transforms this nonlinear ODE into the linear ODE The method of integrating factors provides the explicit solution A problem that could arise with this procedure is for the denominator of p(t) to be zero. A singular solution is prevented by requiring that the denominator be always positive, i.e., f ′ (t) + νf (t) > 0. Having done this, to ensure that β(t) is positive, β(0) must satisfy we only present the full algorithm for the SEIR model with vital rates, since we apply this algorithm to UK measles data.

SIR model with waning immunity
where 1/m is the memory period of immunity. The necessary and sufficient condition for recovering 3. SIR model with time-dependent indirect transmission rate (Joh et al. [12]) where ω(t) is the time-dependent indirect transmission rate. The necessary and sufficient condition for recovering β(t) given ν is where 1/α is the latent period for the disease. By simple calculations, we can show that the necessary and sufficient condition for recovering β(t) from infection data is f ′ (t)/f (t) > −ν.

SEIR model with vital rates
The necessary and sufficient conditions for recovering β(t) from infection data are In this case, β(t) satisfies the Bernoulli equation where and The modified recovery algorithm has five steps together with three conditions.
Smoothly interpolate the infection data to generate a smooth function f (t) that has at least a continuous second derivative. Check condition 1: f ′ (t) + (ν + δ)f (t) > 0; and check Step 2. Compute the function .
If we consider the variable birth rate η(t) and the constant death rate δ, then the SEIR model becomes In this case, the formula in Step 4 should be All other steps in the algorithm remain the same.    . Compares β(t) estimated using our recovery algorithm incorporating historical birth rates with the term-based step function proposed by Keeling and Rohani [13]. The initial transmission rate in our estimation is β(0) = 1299/year, which is the averaged transmission rate in January computed from the term-based step function.