Main

Infectious diseases remain a major problem for human health and agriculture1,2,3,4 and are increasingly recognized as important in ecosystems and conservation5. This has led to the development of extensive theoretical literature on the epidemiology, ecology and evolution of host–pathogen interactions6,7,8,9. Understanding the drivers of the evolution of virulence, typically defined in the evolutionary literature as the increased death rate of individuals due to infection, is a key motivator of this theoretical work7,9,10,11,12,13. Generally, models assume that a higher transmission rate trades off against the intrinsic cost of reducing the infectious period due to higher death rates (virulence), and classically predict the evolution of virulence that maximizes the parasite epidemiological R07,9,10,11,12,13. In fact, this result only holds in models where ecological feedbacks take a constrained form, such that even relatively simple processes such as density-dependent mortality, multiple infections and spatial structure may lead to diversification or different optima9,11,12,14. Moreover, this classic evolutionary theory examines the long-term equilibrium evolutionary outcome in the context of stable endemic diseases; however, in nature, infectious diseases often exhibit complex dynamics, with potentially important impacts on pathogen fitness15,16,17,18.

Antibody-mediated immunity is a critical factor driving the dynamics of important infectious diseases such as seasonal influenza, leading to selection for novel variants that can escape immunity to the current predominant variant19,20,21. Such antigenic escape typically causes the optimal variant of the parasite to change through time as it moves through antigenic space. Moreover, partial cross immunity between the different parasite variants may lead to recurrent epidemics, fluctuations in parasite variants and potentially, variant coexistence22,23,24,25. Previous theory has shown that the evolution of immune escape can lead to dramatic disease outbreaks23,24,25, but the implications of these epidemiological dynamics for the evolution of disease virulence are unknown. This question is challenging, in part because much of the theoretical framework used to study virulence evolution typically considers diseases that are at an endemic equilibrium7,9,10,11,12,13. As such, we currently lack a broad theoretical understanding of the evolution of virulence in the presence of antigenic escape, despite its importance as an epidemic process and the probable implications of its inherently dynamical epidemic nature.

Here we examine the impact of antigenic escape on the evolution of infectious disease in the context of the well-studied transmission–virulence trade-off9,26. We first analytically examine the case without cross immunity and then apply a recently introduced ‘oligomorphic’ analysis that combines quantitative genetic and game theoretical approaches27 to examine the impact of antigenic jumps and epidemic outbreaks due to cross immunity. Specifically, oligomorphic analysis explicitly models not only changes in the mean trait but also changes in the variance of the trait. This variance is critical to the evolutionary outcome under non-equilibrium dynamics and the approach allows us to model the evolutionary dynamics of populations with multiple peaks in the character distribution. This analysis can be applied across a range of ecological and evolutionary timescales and allows us to examine evolutionary outcomes under non-equilibrium conditions. Our key result is that antigenic escape selects for higher transmission and virulence due to the repeated epidemics caused by immune escape, leading to the long-term persistence of acute pathogens. Indeed, antigenic escape has the potential to select for infectious diseases with substantially higher virulence than that predicted by the maximization of R0 in classic disease models.

Results

To tractably model antigenic escape with multiple variants and cross immunity, we follow the simplifying approaches of Gog and Grenfell25. Effectively, the role of cross immunity is to generate protection against becoming infectious with variants not yet encountered. In particular, we assume that cross immunity reduces the transmissibility of, rather than the susceptibility to, future variants. Furthermore, we assume that there is polarizing immunity, such that cross immunity results in a proportion of individuals being completely immune. These assumptions allow tractability and have been shown not to impact the predictions of the model25. Specifically, we consider a population of pathogens structured by a one-dimensional antigenic trait x, so that I(t,x) is the density of hosts infected with antigenicity variant x at time t. Following Gog and Grenfell25, we assume that an individual is either perfectly susceptible or perfectly immune to a variant. A variant of pathogen can infect any host, but will be infectious only when the host is susceptible to that variant. When a variant y of pathogen infects a host that is susceptible to a variant x, the host may become (perfectly) immune to the variant x with probability σ(xy). This is the partial cross immunity function between variants x and y, which takes a value between 0 and 1 and is a decreasing function of antigenic distance |xy| between variants x and y. The density of hosts susceptible to antigenicity variant x at time t is noted as S(t,x).

Assuming that all pathogen variants have the same transmission rate β and virulence α, we can describe the dynamics with the following structured ‘susceptible-infected-recovered’ model:

$$\frac{{\partial S\left( {t,x} \right)}}{{\partial t}} = - \beta S\left( {t,x} \right)\mathop {\smallint }\limits_{ - \infty }^\infty \sigma \left( {x - y} \right)I\left( {t,y} \right)dy,$$
(1a)
$$\frac{{\partial I\left( {t,x} \right)}}{{\partial t}} = \left[ {\beta S\left( {t,x} \right) - \left( {\gamma + \alpha } \right)} \right]I\left( {t,x} \right) + D\frac{{\partial ^2I\left( {t,x} \right)}}{{\partial x^2}},$$
(1b)

where γ is the recovery rate and \(D = \mu \sigma _\mathrm{m}^2/2\) is the diffusion constant due to random mutation in the continuous antigenic space, which is defined by one half of the mutation variance \(\mu \sigma _\mathrm{m}^2\), where μ is the mutation rate and \(\sigma _\mathrm{m}^2\) is the variance in the difference between parental and mutant traits28,29. The dynamics for the density of recovered hosts is omitted from equation (1) as it does not affect the dynamics of the densities of susceptible and infected hosts.

Invasion of a single pathogen

In our first scenario, we start with a population where all hosts are susceptible to any variant (S(0,x) = 1) and a small number of hosts infected by pathogen variant with antigenicity trait x = 0 is initially introduced. The system then exhibits travelling wave dynamics in antigenicity space30. At the front of the travelling wave, I(t,x) is sufficiently small and S(t,x) is sufficiently close to 1. Equation (1a) can then be linearized as

$$\begin{array}{*{20}{c}} {\frac{{\partial I\left( {t,x} \right)}}{{\partial t}} = rI\left( {t,x} \right) + D\frac{{\partial ^2I\left( {t,x} \right)}}{{\partial x^2}}} \end{array},$$
(2)

where \(r = \beta - (\gamma + \alpha )\) is the rate of increase of an antigenicity variant before it spreads in the population and causes the build-up of herd immunity. The system (equation 1) asymptotically approaches travelling waves of both pathogen antigenicity distributions I(t,x), which have an isolated peak around the current antigenicity and host susceptibility profile S(t,x), which smoothly steps down towards a low level after the pathogen antigenicity distribution passes through, with a common constant wave speed31 (Fig. 1a)

$$\begin{array}{*{20}{c}} {v = 2\sqrt {rD} = 2\sqrt {\left( {\beta - \left( {\gamma + \alpha } \right)} \right)D}. } \end{array}$$
(3)
Fig. 1: Continuous antigenic drift (a) and periodic antigenic shifts (b) of the model.
figure 1

The grey coloured surface denotes the infected density \(I(t,x)\) varying in time t and antigenicty x, and the yellow coloured surface denotes the density of hosts \(S(t,x)\) that are susceptible to antigenicity variant x of pathogen at time t. The cross immunity \(\sigma \left( x \right) = \exp ( - x^2/2\omega ^2)\) has a width of \(\omega = 0.2\) in a and \(\omega = 0.6\) in b. Other parameters are β = 2,\(\alpha = 0.1,\gamma = 0.5,\mathrm{and}\,D = 0.001\).

As the width of the partial cross-immunity function \(\sigma (x - y)\) increases, the travelling wave with static shapes described above is destabilized (Extended Data Fig. 1), and the system shows intermittent outbreaks that occur periodically both in time and in antigenicity space25,31 (Fig. 1b). However, the wave speed is unchanged from equation (3), as the linearized system (equation 2) towards the frontal end remains the same irrespective of the stability of the wave profile that lags behind (Extended Data Fig. 1).

Evolution of antigenic escape with cross immunity

To predict how cross immunity affects the evolution of antigenic escape, we use an oligomorphic dynamics analysis27. In this analysis, we consider a population composed of different antigenicity ‘morphs’ that can be seen as quasi-species. Specifically, we use the term ‘morph’ to describe the phenotypic trait mean and the continuous variance around this mean. The analysis in the methods allows us to track the dynamics of morph frequencies, pi, and mean trait values, \(\bar x_i\), as:

$$\frac{{dp_i}}{{dt}} = \beta( {\bar s_i - \bar s}) p_i,$$
(4a)
$$\frac{{d\bar x_i}}{{dt}} = V_i\beta s\prime \left( {\bar x_i} \right),$$
(4b)

where s(x) is the susceptibility profile of the population, which depends on the cross-immunity function σ, \(\bar s_i\) is the mean susceptibility perceived by viral morph i, and \(\bar s\) the mean susceptibility averaged over the different viral morphs. Note that, in general, s(x), \(\bar s_i\) and \(\bar s\) will be functions of time, as the susceptibility profile is moulded by the epidemiological dynamics of S(t,x) and I(t,x).

Equation (4a) reveals that, as intuitively expected, morph i will increase in frequency if the susceptibility of the host population to this variant is higher on average. Equation (4b) shows that the increase in the mean antigenicity trait of morph i depends on: (1) the variance of the morph distribution, Vi; (2) the transmission rate; and (3) the slope of the susceptibility profile close to the morph mean \(\bar x_i\). Together with an equation for the dynamics of variance under mutation and selection (see Methods), equations (4a) and (4b) allow us to quantitatively predict the change in antigenicity after a primary outbreak, as shown in Fig. 2.

Fig. 2: Oligomorphic dynamics prediction of the emergence of antigenicity shift.
figure 2

a, Oligomorphic prediction for the change in the mean antigenicity after the primary outbreak at x = 0 and the change after the second outbreak starting around x = 5.5 (red curves), compared with that obtained by numerical simulations (blue curves). b, Heat map representation of the time change of the antigenic drift model (equation 1). Parameters: β = 2, γ + α = 0.6, \(\sigma \left( x \right) = \exp ( - x^2/2\omega ^2)\) with \(\omega = 2\), D = 0.001. Initially, all hosts are equally susceptible, with S(0,x) = 1. The primary pathogen variant is introduced at x = 0, with infected density 0.001.

For instance, after a primary outbreak caused by a variant with antigenicity \(\bar x_0 = 0\) at t = 0, the susceptibility profile is approximately constant and given by \(s\left( x \right) = \left( {1 - \psi _0} \right)^{\sigma \left( x \right)}\), where ψ0 is the final size of the epidemic of the primary outbreak at antigenicity x = 0 (see Methods). Thus, for a decreasing cross-immunity function, σ(x), the slope of the susceptibility profile is positive, which selects for increased values of the mean antigenicity trait \(\bar x_1\) of a second emerging morph (see Methods). As the process repeats itself, this leads to successive jumps in antigenic space. In addition, a more peaked cross-immunity function, σ, yields larger slopes to the susceptibility profile and thus selects for higher values of the antigenicity trait.

Long-term joint evolution of antigenicity, transmission and virulence

We now extend our analysis to account for mutations affecting pathogen life-history traits such as transmission and virulence. To simplify, we use the classical assumption of a transmission–virulence trade-off7,9,10,11,12,13 and consider that a pathogen morph, i, has frequency, pi, mean antigenicity trait, \({{{\bar{\boldsymbol x}}}}_{{{\boldsymbol{i}}}}\), and mean virulence \(\bar \alpha _i\). In the methods, we show that the morph’s mean traits change as

$$\frac{d}{{dt}}\left( {\begin{array}{*{20}{c}} {\bar x_i} \\ {\bar \alpha _i} \end{array}} \right) = G_i\left( {\begin{array}{*{20}{c}} {\beta (\bar \alpha _i)s\prime \left( {\bar x_i} \right)} \\ {\beta \prime (\bar \alpha _i)s\left( {\bar x_i} \right) - 1} \end{array}} \right)$$

where Gi is the genetic (co)variance matrix, and the vector on the right-hand side is the selection gradient. Note that, while the selection gradient on antigenicity depends on the slope of the antigenicity profile at the morph mean, the selection gradient on virulence depends on the slope of the transmission–virulence trade-off at the morph mean, weighted by the susceptibility profile at the morph mean.

Assuming we can neglect the build-up of correlations between antigenicity and virulence due to mutation and selection, the genetic (co)variance matrix is diagonal with elements \(V_i^x\) and \(V_i^\alpha\). Then, as shown previously, antigenicity increases if the slope of the susceptibility profile is locally positive, while mean virulence increases as long as \(\beta \prime (\bar \alpha _i) > 1/s\left( {\bar x_i} \right)\). For a fixed antigenicity trait, x = x*, the susceptibility profile converges towards \(s\left( {x^ \ast } \right) = (\gamma + \alpha )/\beta\) and the evolutionary endpoint satisfies

$$\beta \prime (\alpha ) = \frac{{\beta \left( \alpha \right)}}{{\gamma + \alpha }},$$

which corresponds to the classical result of R0 maximization for the unstructured susceptible infected (SI) model14,26. However, when antigenicity can evolve, selection will also lead to the build-up of a positive covariance C between antigenicity and virulence, resulting in a synergistic effect (Methods). As the antigenicity trait increases, the evolutionary trajectory of virulence converges to the solution of

$$\beta \prime \left( \alpha \right) = 1,$$

which corresponds to maximizing the rate of increase of pathogen \(r\left( \alpha \right) = \beta \left( \alpha \right) - \left( {\gamma + \alpha } \right)\) in a fully susceptible population. This is equivalent to maximizing the wave speed \(v\left( \alpha \right) = 2\sqrt {r\left( \alpha \right)D}\), as shown in Methods. Figure 3a shows that, in the absence of cross immunity, the evolutionarily stable (ES) virulence is well predicted by r maximization. With cross immunity (Fig. 3b), virulence evolution is characterized by jumps that reflect the sudden shifts in antigenicity due to cross immunity.

Fig. 3: Marginal distribution of antigenicity (left) and virulence (right) in the absence or presence of cross immunity.
figure 3

a, No cross immunity is assumed so that each antigenicity genotype causes specific herd immunity: \(\sigma (x - y) = \delta (x - y)\), where \(\delta \left( \cdot \right)\) is Dirac’s delta function. There are 1,600 antigenic variations having equally divided antigenicity between 0 and 80. b, We assume a Gaussian cross-immunity kernel, \(\sigma \left( {x - y} \right) = \exp ( - \left( {x - y} \right)^2/2\omega ^2)\), with width \(\omega = 5\). There are 300 antigenic variations having equally divided antigenicity between 0 and 300. In both a and b, there are 100 viral virulence traits, each having virulence equally divided between 0 and 20, and diffusion constants due to mutations are Dx = 0.01 (for antigenicity) and Dα = 0.01(for virulence). The blue dashed lines show the ES virulence predicted from maximizing R0, as expected in the absence of antigenic escape, while the red dashed lines show the predicted ES virulence that maximizes \(r\left( \alpha \right) = \beta \left( \alpha \right) - \left( {\gamma + \alpha } \right)\), as predicted from our analysis. Other parameters: γ = 0.5, and \(\beta \left( \alpha \right) = 5\sqrt \alpha\).

As such antigenic escape selects for higher transmission and virulence and more acute infectious diseases. This has parallels with the results that show that there is a transient increase in virulence at the start of an epidemic with r rather than R0 being maximized15,16,18,32, but here we predict the long-term persistence of highly transmissible and virulent disease variants due to antigenic escape.

Although we have so far assumed a never-ending antigenic escape process, it is easy to extend our analysis to consider that antigenic escape is constrained by pleiotropic effects. Then, once the antigenicity trait has stabilized, the ES virulence would satisfy

$$\beta \prime \left( \alpha \right) = \frac{{1 - \rho \beta \left( \alpha \right)s\prime (x)}}{{s\left( x \right)}},$$

where \(\rho = C/V_\alpha\) measures the correlation between antigenicity and virulence. Thus, the slope to the transmission–virulence trade-off at the evolutionarily stable strategy (ESS) now takes an intermediate value between \(\beta /(\gamma + \alpha )\) and 1, as shown in Fig. 4.

Fig. 4: Graphical representation of the predicted ES virulence with or without antigenic escape under the assumption of a transmission–virulence trade-off.
figure 4

In the absence of antigenic escape, the ES virulence, \(\alpha _R^ \ast\), can be predicted from the maximization of the pathogen’s epidemiological basic reproduction ratio, \(R_0 = \beta /(\gamma + \alpha )\), or equivalently by the minimization of the total density of susceptible hosts since, at equilibrium, \(s^ \ast = 1/R_0\). The slope of the transmission–virulence trade-off at the ESS is then \(1/s^ \ast = R_0\). With antigenic escape, the ES virulence, \(\alpha _r^ \ast\), can be predicted from the maximization of the pathogen’s growth rate in a fully susceptible population, \(r_0 = \beta \left( \alpha \right) - (\gamma + \alpha )\). The slope of the transmission–-virulence trade-off at the ESS is then 1. This holds true in the limit of a large antigenicity trait, but intermediate values of ES virulence, corresponding to intermediate slopes, can also be selected for if other processes constrain the evolution of the antigenicity trait, as explained in the main text.

Short-term joint evolution of antigenicity and virulence

Although our analysis allows us to understand the long-term evolution of pathogen traits, it can also be used to accurately predict the short-term dynamics of antigenicity and virulence. We now consider that a primary outbreak has moulded a susceptibility profile s(x) that we assume constant. Although this assumption will cause deviations from the true susceptibility profile, it allows us to decouple our evolutionary oligomorphic dynamics from the epidemiological dynamics. Figure 5 shows that the approximation accurately predicts the jump in antigenic space and joint increase in virulence during the secondary outbreak. The accuracy of the prediction depends on the time at which we seed the oligomorphic dynamical system, as detailed in the methods, but remains high for a broad range of values of this initial time. Hence, our analysis can be used to successfully predict the trait dynamics after the emergence of a new antigenic variant. Simulations show that this result is not dependent on the assumption of a one-dimensional antigenic space (Supplementary Information).

Fig. 5: Oligomorphic dynamics predictions compared to the simulation results of the emergence of the next variant during antigenicity–virulence coevolution.
figure 5

a,b, Simulation results showing snapshots of contour plots for the joint trait distribution observed near the starting (a) and finishing (b) time of emergence. The overlaid curves are the trajectory of mean traits \((\bar x,\bar \alpha )\) up to t = 104.8 and t = 109 observed in the simulation. ch, Dynamics of the total density of infected hosts, mean antigenicity, mean virulence, variance in antigenicity, variance in virulence, and covariance between antigenicity and virulence, respectively predicted by the oligomorphic analysis compared to the simulation results. Parameters: γ = 0.5, \(\beta \left( \alpha \right) = 5\sqrt \alpha\), Dx = 0.005, Dα = 0.0002. As in Fig. 2, we assume a Gaussian cross-immunity kernel, \(\sigma \left( {x - y} \right) = \exp ( - \left( {x - y} \right)^2/2\omega ^2)\), with width ω = 5. The oligomorphic dynamics describing the changes in the frequency \({{{p}}}_0\left( {{{t}}} \right) = 1 - {{{p}}}_1({{{t}}})\) of the currently prevailing morph at time ts = 104.8, the frequency p1(t) of the upcoming morph, the mean antigenicity \({{{\bar{x}}}}_{{{i}}}({{{t}}})\) and mean virulence \(\bar \alpha _{{{i}}}({{{t}}})\) of the two morphs (i = 0,1), the within-morph variances \({{{V}}}_{{{i}}}^{{{x}}}\) and \({{{V}}}_{{{i}}}^\alpha\) in antigenicity and virulence, and the within-morph covariance Ci(t) between antigenicity and virulence in each morph (i = 0,1) are defined as equations (48)–(53) in the methods.

Discussion

We have shown how antigenic escape selects for more acute infectious diseases with higher transmission rates that cause increased mortality (virulence) in infected hosts. This result is important given the number of major infectious diseases, such as seasonal influenza, that have epidemiology driven by antigenic escape. Until recently, the evolution of virulence literature has mostly focused on equilibrium solutions that, in simple models, lead to the classic idea that pathogens evolve to maximize their basic reproductive number R07,9,10,11,12,13. Our results show that the process of antigenic escape leading to the continual replacement of variants22,23,24,25, creates a dynamical invasion process that in itself selects for more acute, fast transmitting, highly virulent variants that do not maximize R0. This has parallels with the finding that more acute variants are selected transiently at the start of epidemics23,24,25, but critically, in our case the result is not a short-term transient outcome. Rather, the eco-evolutionary process leads to the long-term persistence of more acute variants. As such, antigenic escape may be an important driver of high virulence in infectious disease.

In the simpler case where there is no cross immunity, there is a travelling wave of new variants invading due to antigenic escape. In this case, we can use established methods to gain analytical results that not only predict the speed of change of the variants, but also the evolutionarily stable virulence. With our model’s assumptions, without antigenic escape, we would get the classic result of the maximization of the reproductive number R07,9,10,11,12,13, but once there is antigenic escape, we show analytically that the intrinsic growth rate of the infectious disease r is maximized. Maximizing the intrinsic growth rate leads to selection for higher transmission and, in turn, higher virulence. Effectively, this is the equivalent ‘live fast, die young’ strategy of an infectious disease. The outcome is due to the dynamical replacement of variants, with new variants invading the population continually, leading to a continual selection for the variants that invade better23,24,25. As such, we predict that any degree of antigenic escape will, in general, select for more acute faster-transmitting variants with higher virulence in the presence of a transmission–virulence trade-off. Although such a trade-off is a classical assumption in evolutionary epidemiology, it would be interesting to examine the impact of antigenic escape under different assumptions.

Partial cross immunity leads to a series of jumps in antigenic space that are characteristic of the epidemiology of a number of diseases and, in particular, of the well-known dynamics of influenza A in humans22,23,24,25. Here a cloud of variants remains in antigenic space until there is a jump that, on average, overcomes the cross immunity and leads to the invasion of a new set of variants that are distant enough to escape the immunity of the resident variants22,23,24,25. To examine the evolutionary outcome in this scenario, we applied a novel oligomorphic analysis27 and again we find that antigenic escape selects for higher virulence towards the maximization of the intrinsic growth rate r. Both our analysis and simulations show that in the long term, virulence increases until it reaches a new optimum, potentially of an order of magnitude higher than would be expected by the classic prediction of maximizing R0. Therefore, antigenic escape, whether it is through a continuous wave of antigenic drift or through large jumps, selects for higher virulence. We therefore expect this result to apply across the wide range of ‘jumpiness’ that we see across different viruses between these two extremes of continuous drift and punctuated jumps. We show that virulence increases after each antigenic jump, falling slightly at the next jump before increasing again until it reaches this new equilibrium. It is also important to note that the diversity within the morph increases in both antigenicity and virulence as we move towards the next epidemic, reaching a maximum just at the point when the jump occurs. This increase in diversity could, in principle, be used as a predictor of the next jump in antigenic space.

Clearly, the virulence of any particular infectious disease depends on multiple factors, including both host and parasite traits, and critically, the relationship between transmission and virulence. This makes comparisons of virulence across different infectious diseases problematic since the specific trade-off relationship between transmission and virulence is often unknown. However, our model shows that antigenic escape will, all things being equal, be a driver of higher virulence favouring more acute variants. It is also important to note that since antigenic escape is a very general mechanism that selects for higher virulence, it follows that we may see high virulence in parasites even when the costs in terms of reduced infectious period are substantial. Among the influenzas, although there is paucity of data, influenza C does not show obvious antigenic escape and is typically much less virulent than the other influenzas33. Furthermore, influenza A/H3 tends to show much more antigenic escape than influenza B and influenza A/H1, and again in line with our predictions, influenza A/H3N2 is typically the more virulent type34,35. It is important to note that these differences can be ascribed to multiple factors, including circumvention of vaccination, and that cross immunity may itself directly impact disease severity. Furthermore, the higher virulence of influenza A is often posited to be due to a more recent zoonotic emergence36. Moreover, direct comparisons of the rates of antigenic escape between influenza A/H1 and influenza B are difficult, and clearly, there are also highly virulent pathogens that do not show antigenic escape, such as measles. Therefore, a formal comparative analysis is confounded by multiple factors. Nevertheless, our model suggests that differences in the rates of antigenic escape of the different influenzas may impact their virulence and the evidence from influenza is at least consistent with the predictions of the model.

An important implication of our work is that antigenic escape selects for variants with a higher virulence than the value that maximizes R0 and therefore leads to the evolution of infectious diseases with lower R0. From this point of view, it may be naively concluded that diseases with antigenic escape may be easier to eliminate and control with vaccination. Of course, in practice the opposite is often true since producing an effective vaccine is much more problematic when there is antigenic escape37,38. On the other hand, with lower R0, epidemics will tend to be less explosive than they otherwise would be, having a lower peak but lasting longer, with evolution here effectively ‘flattening the curve’. Infectious diseases that show punctuated antigenic escape are characterized by repeated epidemics, but our work suggests that due to the selection for a lower R0, the eco-evolutionary feedback would have substantially impacted the pattern of these epidemics. More generally our results highlight how ecological/epidemiological dynamics can impact evolutionary outcomes that, in turn, feedback into the epidemiology characteristics of the disease.

We have used oligomorphic dynamics27 to make predictions on the waiting times and outcomes of the antigenic jumps in our model with cross immunity. This approach tracks changes in both mean trait values and trait variances in models with explicit ecological dynamics. As such, it combines aspects of eco-evolutionary theory39,40 and quantitative genetics approaches41,42 to provide a more complete understanding of the evolution of quantitative traits. Our approach can take into account a wide range of different ecological and evolutionary timescales and therefore allows us to address fundamental questions on eco-evolutionary feedbacks and on the separation between ecological and evolutionary timescales. This is important since it allows us to test the implications of the different assumptions of classical evolutionary theory and to better understand the role of eco-evolutionary feedbacks on evolutionary outcomes. Furthermore, the approach can be applied widely to model transient dynamics, and to predict the waiting times and extent of diversification that occurs in a range of contexts27,43. Moreover, antigenic evolution is known to also lead to diversification and variant coexistence44,45,46,47, and it would be interesting to extend our analysis to these other evolutionary outcomes.

Our results emphasize that epidemiological dynamics may have important implications for the evolution of infectious disease. To facilitate its broader application, the oligomorphic methodology should be extended to structured populations and combined with stochastic evolutionary theory to fully address the evolutionary dynamics of emerging disease. Human coronaviruses can evolve antigenically to escape antibody immunity48, and it would be useful to apply our approaches to a more specific model of the Severe acute respiratory syndrome coronavirus 2 (SARS-Cov-2) epidemic. In particular, our ability to predict the waiting time until the emergence of the next antigenic cluster has the potential to be important in such applied contexts.

In principle, epidemics of new variants that adapt to a novel host would display equivalent dynamics to those described here for antigenic escape. It also follows that interventions that impact epidemiological dynamics may also have impacts on the evolution of pathogen traits, such as virulence or transmission. Our results suggest that immune escape driven by transmission blocking imperfect vaccination might also select for higher virulence in the longer term49,50, although these effects are probably overwhelmed by selection on transmission in an emerging pandemic such as SARS-CoV-251,52. Furthermore, dynamical feedbacks are important in a range of contexts beyond infectious disease, and our approach may help us examine the importance of interactions between frequency-dependent ‘stabilizing’ and equalizing evolutionary drivers53. The oligomorphic analytical approaches we use here are therefore likely to be useful in understanding a wide range of dynamical evolutionary outcomes.

Methods

Oligomorphic dynamics (OMD) of antigenic escape

We considered a model of the antigenic escape of a pathogen from host herd immunity on a one-dimensional antigenicity space (x). We tracked the changes in the density \(S(t,x)\) of hosts that are susceptible to antigenicity variant x of pathogen at time t, and the density \(I(t,x)\) of hosts that are currently infected and infectious with antigenicity variant x of pathogen at time t:

$$\frac{{\partial S\left( {t,x} \right)}}{{\partial t}} = - S\left( {t,x} \right)\mathop {\smallint }\limits_{ - \infty }^\infty \beta \sigma \left( {x - y} \right)I\left( {t,y} \right)dy,$$
(5)
$$\frac{{\partial I\left( {t,x} \right)}}{{\partial t}} = \beta S\left( {t,x} \right)I\left( {t,x} \right) - \left( {\gamma + \alpha } \right)I\left( {t,x} \right) + D\frac{{\partial ^2I\left( {t,x} \right)}}{{\partial x^2}},$$
(6)

where β, α and γ are the transmission rate, virulence (additional mortality due to infection) and recovery rate of pathogens, which are independent of antigenicity. The function σ(xy) denotes the degree of cross immunity: a host infected by pathogen variant y acquires perfect cross immunity with probability σ(xy), but fails to acquire any cross immunity with probability 1−σ(xy) (this is called polarized cross immunity by Gog and Grenfell25). The degree σ(xy) of cross immunity is assumed to be a decreasing function of the distance |xy| between variants x and y. When a new variant with antigenicity x = 0 is introduced at time t = 0, the initial host population is assumed to be susceptible to any antigenicity variant of pathogen: S(0,x) = 1. In equation (6), \(D = \mu \sigma _\mathrm{m}^2/2\) is one half of the mutation variance for the change in antigenicity, representing random mutation in the continuous antigenic space.

Susceptibility profile moulded by the primary outbreak

We first analysed the dynamics of the primary outbreak of a pathogen and derived the resulting susceptibility profile, which can be viewed as the fitness landscape subsequently experienced by the pathogen. For simplicity, we assumed that mutation can be ignored during the first epidemic initiated with antigenicity strain x = 0. The density \({{{S}}}_0\left( {{{t}}} \right) = {{{S}}}({{{t}}},0)\) of hosts that are susceptible to the currently prevailing antigenicity variant x = 0, as well as the density \({{{I}}}_0\left( {{{t}}} \right) = {{{I}}}({{{t}}},0)\) of hosts that are currently infected by the focal variant change with time as

$$\frac{{dS_0}}{{dt}} = - S_0\beta I_0,$$
(7)
$$\frac{{dI_0}}{{dt}} = S_0\beta I_0 - \left( {\gamma + \alpha } \right)I_0,$$
(8)
$$\frac{{dR_0}}{{dt}} = \gamma I_0,$$
(9)

with \(S_0\left( 0 \right) = 1\), \(I_0\left( 0 \right) \approx 0\) and \(R_0\left( 0 \right) = 0\). The final size of the primary outbreak,

$$\psi _0 = R_0\left( \infty \right) = 1 - S_0\left( \infty \right) = \exp \left[ { - \beta \mathop {\int}\limits_0^\infty {I_0} \left( t \right)dt} \right],$$

is determined as the unique positive root of

$$\begin{array}{*{20}{c}} {\psi _0 = 1 - e^{ - \rho _0\psi _0},} \end{array}$$
(10)

where \(\rho _0 = \beta /\left( {\gamma + \alpha } \right) > 1\) is the basic reproductive number6. Associated with this epidemiological change, the susceptibility profile \(S_x\left( t \right) = S(t,x)\) against antigenicity x (\(x \ne 0\)) other than the currently circulating variant (x = 0) changes by cross immunity as

$$\begin{array}{*{20}{c}} {\frac{{dS_x}}{{dt}} = - S_x\beta \sigma \left( x \right)I_0,\quad \left( {x \ne 0} \right).} \end{array}$$
(11)

Integrating both sides of equation (11) from t = 0 to \(t = \infty\), we see that the susceptibility profile \(s\left( x \right) = S_x(\infty )\) after the primary outbreak at x = 0 is

$$\begin{array}{*{20}{c}} {s\left( x \right) = \exp \left[ { - \beta \sigma \left( x \right)\mathop {\int}\limits_0^\infty {I_0} \left( t \right)dt} \right] = \left( {1 - \psi _0} \right)^{\sigma \left( x \right)} = e^{ - \rho _0\sigma \left( x \right)\psi _0},} \end{array}$$
(12)

where the last equality follows from equation (10). The susceptibility can be effectively reduced by cross immunity when the primary variant has a large impact (that is, when the fraction of hosts remaining uninfected, 1−ψ0, is small) and when the degree of cross immunity is strong (that is, when σ(x) is close to 1). With a variant antigenically very close to the primary variant (x ≈ 0), the cross immunity is very strong (\(\sigma \left( x \right) \approx 1\)) so that the susceptibility against variant x is nearly maximally reduced: \(s(x) \approx 1 - \psi _0\). With a variant antigenically distant from the primary variant, σ(x) becomes substantially smaller than 1, making the host more susceptible to the variant. For example, if the cross immunity is halved (\(\sigma \left( x \right) = 0.5\)) from its maximum value 1, then the susceptibility to that variant is as large as \(\left( {1 - \psi _0} \right)^{0.5}\). If a variant is antigenically very distant from the primary variant, then \(\sigma \left( x \right) \approx 0\), and the host is nearly fully susceptible to the variant (\(s\left( x \right) \approx 1\)).

Threshold antigenic distance for escaping immunity raised by primary outbreak

Of particular interest is the threshold antigenicity distance xc that allows for antigenic escape, that is, any antigenicity variant more distant than this threshold from the primary variant (x > xc) can increase when introduced after the primary outbreak. Such a threshold is determined from

$$\frac{{\beta s\left( {x_c} \right)}}{{\gamma + \alpha }} = \rho _0s\left( {x_c} \right) = 1$$

or

$$\begin{array}{*{20}{c}} {s\left( {x_c} \right) = \left( {1 - \psi _0} \right)^{\sigma \left( {x_c} \right)} = e^{ - \rho _0\sigma \left( {x_c} \right)\psi _0} = \frac{1}{{\rho _0}},} \end{array}$$
(13)

where we used equation (12). With a specific choice of cross-immunity profile,

$$\begin{array}{*{20}{c}} {\sigma \left( x \right) = \exp \left[ { - \frac{{x^2}}{{2\omega ^2}}} \right],} \end{array}$$
(14)

the threshold antigenicity beyond which the virus can increase in the susceptibility profile s(x) after the primary outbreak is obtained, by substituting equation (14) into equation (13)

$$\exp \left[ { - \rho _0\psi _0\exp \left[ { - \frac{{x_c^2}}{{2\omega ^2}}} \right]} \right] = \frac{1}{{\rho _0}},$$

and taking the logarithm of both sides twice:

$$\begin{array}{*{20}{c}} {x_c = \omega \sqrt {2\log \frac{{\rho _0\psi _0}}{{\log \rho _0}}} .} \end{array}$$
(15)

OMD

Integrating both sides of equation (6) over the whole space, we obtained the dynamics for the total density of infected hosts, \({{{\bar{ I}}}}\left( {{{t}}} \right) = {\int}_{ - \infty }^\infty {{{{I}}}\left( {{{{t}}},{{{x}}}} \right){{{dx}}}}\):

$$\begin{array}{*{20}{c}} {\frac{{d\bar I}}{{dt}} = \left[ {\beta \mathop {\smallint }\limits_{ - \infty }^\infty S\left( {t,x} \right)\phi \left( {t,x} \right)dx - \left( {\gamma + \alpha } \right)} \right]\bar I\left( t \right) = \left[ {\beta \bar S\left( t \right) - \left( {\gamma + \alpha } \right)} \right]\bar I\left( t \right)} \end{array},$$
(16)

where

$$\phi \left( {t,x} \right) = I\left( {t,x} \right)/\bar I\left( t \right)$$

is the relative frequency of antigenicity variant x in the pathogen population circulating at time t, and

$$\begin{array}{*{20}{c}} {\bar S\left( t \right) = \mathop {\int}\limits_{ - \infty }^\infty S \left( {t,x} \right)\phi \left( {t,x} \right)dx} \end{array}$$
(17)

is the mean susceptibility experienced by currently circulating pathogens. The dynamics for the relative frequency \(\phi \left( {t,x} \right)\) of pathogen antigenicity is

$$\begin{array}{*{20}{c}} {\frac{{\partial \phi }}{{\partial t}} = \beta \left\{ {S\left( {t,x} \right) - \bar S(t)} \right\}\phi \left( {t,x} \right) + D\frac{{\partial ^2\phi }}{{\partial x^2}}.} \end{array}$$
(18)

As in Sasaki and Dieckmann27, we decomposed the frequency distribution to the sum of several morph distributions (oligomorphic decomposition) as

$$\begin{array}{*{20}{c}} {\phi \left( {t,x} \right) = \mathop {\sum }\limits_i p_i\phi _i\left( {t,x} \right)} \end{array},$$
(19)

where pi(t) is the frequency of morph i and \(\phi _i(t,x)\) is the within-morph distribution of antigenicity. By definition, and \({\int}_{ - \infty }^\infty {\phi _i} (t,x)dx = 1\). Let

$$\begin{array}{*{20}{c}} {\bar x_i = \mathop {\int}\limits_{ - \infty }^\infty {x\phi _i\left( {t,x} \right)dx} } \end{array}$$
(20)

be the mean antigenicity of a morph and

$$\begin{array}{*{20}{c}} {V_i = \mathop {\smallint }\limits_{ - \infty }^\infty \left( {x - \bar x_i} \right)^2\phi _i\left( {t,x} \right)dx = O\left( {{\it{\epsilon }}^2} \right)} \end{array}$$
(21)

where O is order be the within-morph variance of each morph, which is assumed to be small, of the order of \({\it{\epsilon }}^2\). We denoted the mean susceptibility of host population for viral morph \(i\) by \(\bar S_i = {\int}_{ - \infty }^\infty {S\left( {t,x} \right)\phi _i(t,x)dx}\). As shown in Sasaki and Dieckmann27, the dynamics for viral morph frequency is expressed as

$$\begin{array}{*{20}{c}} {\frac{{dp_i}}{{dt}} = \beta \left( {\bar S_i - \bar S} \right)p_i + O\left( {\it{\epsilon }} \right),} \end{array}$$
(22)

while the dynamics for the within-morph distribution of antigenicity is

$$\begin{array}{*{20}{c}} {\frac{{\partial \phi _i}}{{\partial t}} = \beta \left\{ {S\left( {t,x} \right) - \bar S_i} \right\}\phi _i\left( {t,x} \right) + D\frac{{\partial ^2\phi _i}}{{\partial x^2}}.} \end{array}$$
(23)

From this, the dynamics for the mean antigenicity of a morph,

$$\begin{array}{*{20}{c}} {\frac{{d\bar x_i}}{{dt}} = V_i\beta \left. {\frac{{\partial S}}{{\partial x}}} \right|_{x = \bar x_i} + O\left( {{\it{\epsilon }}^3} \right)} \end{array}$$
(24)

and the dynamics for the within-morph variance of a morph

$$\begin{array}{*{20}{c}} {\frac{{dV_i}}{{dt}} = \frac{1}{2}\beta \left. {\frac{{\partial ^2S}}{{\partial x^2}}} \right|_{x = \bar x_i}\left\{ {E\left[ {\xi _i^4} \right] - V_i^2} \right\} + 2D + O\left( {{\it{\epsilon }}^5} \right)} \end{array}$$
(25)

are derived, where \(\xi _i = x - \bar x_i\) and \(E\left[ {\xi _i^4} \right] = {\int}_{ - \infty }^\infty {\left( {x - \bar x_i} \right)^4\phi _i\left( {t,x} \right)dx}\) are the fourth central moments of antigenicity around the morph mean. Assuming that the within-morph distribution is normal (Gaussian closure), \(E\left[ {\xi _i^4} \right] = 3V_i^2\), and hence equation (25) becomes

$$\begin{array}{*{20}{c}} {\frac{{dV_i}}{{dt}} = \beta \left. {\frac{{\partial ^2S}}{{\partial x^2}}} \right|_{x = \bar x_i}V_i^2 + 2D + O\left( {{\it{\epsilon }}^5} \right).} \end{array}$$
(26)

Second outbreak predicted by OMD

Equations (22), (24) and (26) are general, but they rely on a full knowledge of the dynamics of the susceptibility profile S(t,x). To make further progress, we used an additional approximation by substituting equation (13), the susceptibility profile, over viral antigenicity space after the primary outbreak at x = 0 and before the onset of the second outbreak at a distant position. We kept track of two morphs at positions x0(t) and x1(t), where the first morph is that caused by the primary outbreak at x = 0, and the second morph is that emerged in the range x > xc beyond the threshold antigenicity xc defined in equation (13) (and equation (15) for a specific form of σ(x)) as the source of the next outbreak.

As \(s\left( x \right) = \left( {1 - \psi _0} \right)^{\sigma (x)} = \exp [\sigma \left( x \right)\log (1 - \psi _0)]\), we have

$$\frac{{{{{\mathrm{d}}}}s}}{{{{{\mathrm{d}}}}x}}\left( {\bar x_i} \right) = \left[ {\frac{{{{{\mathrm{d}}}}\sigma }}{{{{{\mathrm{d}}}}x}}\left( {\bar x_i} \right)\log \left( {1 - \psi _0} \right)} \right]s\left( {\bar x_i} \right),$$

and

$$\frac{{{{{\mathrm{d}}}}^2s}}{{{{{\mathrm{d}}}}x^2}}\left( {\bar x_i} \right) = \left[ {\frac{{{{{\mathrm{d}}}}^2\sigma }}{{{{{\mathrm{d}}}}x^2}}\left( {\bar x_i} \right)\log \left( {1 - \psi _0} \right) + \left\{ {\frac{{{{{\mathrm{d}}}}\sigma }}{{{{{\mathrm{d}}}}x}}\left( {\bar x_i} \right)\log \left( {1 - \psi _0} \right)} \right\}^2} \right]s\left( {\bar x_i} \right).$$

Therefore, the frequency, mean antigenicity and variance of antigenicity of an emerging morph (i = 1) change respectively as

$$\begin{array}{*{20}{l}} {\frac{{dp_1}}{{dt}} = \beta \left[ {s\left( {\bar x_1} \right) - s\left( {\bar x_0} \right)} \right]p_1\left( {1 - p_1} \right),} \hfill \\ {\frac{{d\bar x_1}}{{dt}} = V_1\beta \frac{{{{{\mathrm{d}}}}s}}{{{{{\mathrm{d}}}}x}}\left( {\bar x_1} \right),} \hfill \\ {\frac{{dV_1}}{{dt}} = \beta \frac{{{{{\mathrm{d}}}}^2s}}{{{{{\mathrm{d}}}}x^2}}\left( {\bar x_1} \right)V_1^2 + 2D}. \hfill \end{array}$$
(27)

The predicted change in the mean antigenicity was plotted by integrating equation (27). As initial condition, we chose the time when a seed of second peak in the range x > xc first appeared, and then computed the mean trait as

$$\begin{array}{*{20}{c}} {\bar x\left( t \right) = x_0\left( {1 - p_1\left( t \right)} \right) + \bar x_1p_1\left( t \right).} \end{array}$$
(28)

In the case of Fig. 2, where β = 2, γ + α = 0.6, D = 0.001 and ω = 2, the final size of epidemic for the primary outbreak, defined as equation (7), was ψ = 0.959, and the critical antigenic distance for the increase of pathogen variant obtained from equation (26) was xc = 2.795. The initial conditions for the oligomorphic dynamics (equation 27) for the second morph were then \(p_1\left( {t_0} \right) = 1.6 \times 10^{ - 8}\), \(\bar x_1\left( {t_0} \right) = 3.239\), \(V_1\left( {t_0} \right) = 0.2675\) at t0 = 41. In Fig. 2, the predicted trajectory for the mean antigenicity (equation 28) is plotted as a red curve, together with the mean antigenicity change observed in simulation (blue curve).

Accuracy of predicting the antigenicity with OMD and the timing of the second outbreak

Here we describe how we defined the initial conditions for oligomorphic dynamics, that is, the frequency, the mean antigenicity and the variance in antigenicity of the morph that caused the primary outbreak and the morph that may cause the second outbreak. We then show how the accuracy in prediction of the second outbreak depends on the timing of the prediction.

We divided the antigenicity space into two at x = xc, above which the pathogen can increase under the given susceptibility profile after the primary outbreak, but below which the pathogen cannot increase. We then took the relative frequencies of pathogens above xc and below xc, and the conditional mean and variance in these separated regions to set the initial frequencies, means and variances of the morphs at time t0 when we started integrating the oligomorphic dynamics to predict the second outbreak:

$$\begin{array}{*{20}{c}} {\begin{array}{*{20}{l}} {p_0\left( {t_0} \right) = \frac{{\mathop {\smallint }\nolimits_0^{x_c} I\left( {t_0,x} \right)dx}}{{\mathop {\smallint }\nolimits_0^\infty I\left( {t_0,x} \right)dx}},} \hfill & {p_1\left( {t_0} \right) = \frac{{\mathop {\smallint }\nolimits_{x_c}^\infty I\left( {t_0,x} \right)dx}}{{\mathop {\smallint }\nolimits_0^\infty I\left( {t_0,x} \right)dx}},} \hfill \\ {\bar x_0\left( {t_0} \right) = \frac{{\mathop {\smallint }\nolimits_0^{x_c} xI\left( {t_0,x} \right)dx}}{{\mathop {\smallint }\nolimits_0^{x_c} I\left( {t_0,x} \right)dx}},} \hfill & {\bar x_1\left( {t_0} \right) = \frac{{\mathop {\smallint }\nolimits_{x_c}^\infty xI\left( {t_0,x} \right)dx}}{{\mathop {\smallint }\nolimits_{x_c}^\infty I\left( {t_0,x} \right)dx}},} \hfill \\ {V_0\left( {t_0} \right) = \frac{{\mathop {\smallint }\nolimits_0^{x_c} \left( {x - \bar x_0\left( {t_0} \right)} \right)^2I\left( {t_0,x} \right)dx}}{{\mathop {\smallint }\nolimits_0^{x_c} I\left( {t_0,x} \right)dx}},} \hfill & {V_1\left( {t_0} \right) = \frac{{\mathop {\smallint }\nolimits_{x_c}^\infty \left( {x - \bar x_1\left( {t_0} \right)} \right)^2I\left( {t_0,x} \right)dx}}{{\mathop {\smallint }\nolimits_{x_c}^\infty I\left( {t_0,x} \right)dx}}.} \hfill \end{array}} \end{array}$$
(29)

We then compared the trajectory for mean antigenicity change observed in simulation (blue curve in Fig. 2) and the predicted trajectory (red curve in Fig. 2) for mean antigenicity (equation 28) by integrating oligomorphic dynamics (equation 27) with the initial condition (equation 29) at time t = t0. Extended Data Fig. 2 shows how the accuracy of prediction, measured by the Kullback–Leibler divergence between these two trajectories, depends on the timing t0 chosen for the prediction. The second outbreak occurs around t = 54.6, where mean antigenicity jumps from around 0 to around 5. The prediction with OMD is accurate if it is made for t0 > 40. Figure 2 is drawn for t0 = 41 where the second peak is about to emerge (see Extended Data Fig. 2). Even for the latest prediction for t0 = 51 in Extended Data Fig. 2, the morph frequency of the emerging second morph was only 0.3% off, so the prediction is still worthwhile to make.

Extended Data Fig. 2 shows that the prediction power is roughly constant (albeit with a wiggle) for \(5 < t_0 < 30\) (the predicted timings are 10–15% longer than actual timing for \(5 < t_0 < 30\)), and steadily improved for t0 > 30. When the prediction was made very early (t0 < 5), the deviations were larger.

OMD for the joint evolution of antigenicity and virulence

Let s(x) be the susceptibility of the host population against antigenicity x. A specific susceptibility profile is given by equation (12), with cross-immunity function σ(x) and the final size ψ0 of epidemic of the primary outbreak. Note that, as above, the susceptibility profile is, in general, a function of time. The density \(I(x,\alpha )\) of hosts infected by a pathogen of antigenicity x and virulence α changes with time, when rare, as

$$\begin{array}{*{20}{c}} {\frac{{\partial I\left( {x,\alpha } \right)}}{{\partial t}} = \beta s\left( x \right)I\left( {x,\alpha } \right) - \left( {\gamma + \alpha } \right)I\left( {x,\alpha } \right) + D_x\frac{{\partial ^2I}}{{\partial x^2}} + D_\alpha \frac{{\partial ^2I}}{{\partial \alpha ^2}}.} \end{array}$$
(30)

The change in the frequency \(\phi \left( {x,\alpha } \right) = I\left( {x,\alpha } \right)/{\int\!\!\!\!\!\int} I \left( {x,\alpha } \right)dxd\alpha\) of a pathogen with antigenicity x and virulence α follows

$$\begin{array}{*{20}{c}} {\frac{{\partial \phi }}{{\partial t}} = \left\{ {w\left( {x,\alpha } \right) - \bar w} \right\}\phi + D_x\frac{{\partial ^2\phi }}{{\partial x^2}} + D_\alpha \frac{{\partial ^2\phi }}{{\partial \alpha ^2}},} \end{array}$$
(31)

where

$$\begin{array}{*{20}{c}} {w\left( {x,\alpha } \right) = \beta \left( \alpha \right)s\left( x \right) - \alpha } \end{array}$$
(32)

is the fitness of a pathogen with antigenicity x and virulence α and \(\bar w = {\int\!\!\!\!\!\int} w \left( {x,\alpha } \right)dxd\alpha\) is the mean fitness.

We decomposed the joint frequency distribution ϕ(x, α) of the viral quasi-species as (oligomorphic decomposition):

$$\begin{array}{*{20}{c}} {\phi \left( {x,\alpha } \right) = \mathop {\sum }\limits_i \phi _i\left( {x,\alpha } \right)p_i,} \end{array}$$
(33)

where ϕi(x, α) is the joint frequency distribution of antigenicity x and virulence α in morph i (\({\int\!\!\!\!\!\int} {\phi _idxd\alpha = 1}\)) and pi is the relative frequency of morph i (\(\mathop {\sum}\nolimits_i {p_i = 1}\)). The frequency of morph i then changes as

$$\begin{array}{l}\frac{{dp_i}}{{dt}} = \left( {\bar w_i - \mathop {\sum }\limits_j \bar w_jp_j} \right)p_i,\\ \frac{{\partial \phi _i}}{{\partial t}} = \left( {w\left( {x,\alpha } \right) - \bar w_i} \right)\phi _i\left( {x,\alpha } \right) + D_x\frac{{\partial ^2\phi _i}}{{\partial x^2}} + D_\alpha \frac{{\partial ^2\phi _i}}{{\partial \alpha ^2}},\end{array}$$
(34)

where \(\bar w_i = {\int\!\!\!\!\!\int} w \left( {x,\alpha } \right)\phi _i\left( {x,\alpha } \right)dxd\alpha\) is the mean fitness of morph i.

Assuming that the traits are distributed narrowly around the morph means \(\bar x_i = {\int\!\!\!\!\!\int} x \phi _i\left( {x,\alpha } \right)dxd\alpha\) and \(\bar \alpha _i = {\int\!\!\!\!\!\int} \alpha \phi _i(x,\alpha )dxd\alpha\), so that \(\xi _i = x - \bar x_i = O({\it{\epsilon }})\) and \(\zeta _i = \alpha - \bar \alpha _i = O({\it{\epsilon }})\) where \({\it{\epsilon }}\) is a small constant, we expanded the fitness w(x, α) around the means \(\bar x_i\) and \(\bar \alpha _i\) of morph i,

$$\begin{array}{*{20}{l}} {w\left( {x,\alpha } \right)} \hfill & = \hfill & {w\left( {\bar x_i,\bar \alpha _i} \right) + \left( {\frac{{\partial w}}{{\partial x}}} \right)_i\xi _i + \left( {\frac{{\partial w}}{{\partial \alpha }}} \right)_i\zeta _i} \hfill \\ {} \hfill & {} \hfill & { + \frac{1}{2}\left( {\frac{{\partial ^2w}}{{\partial x^2}}} \right)_i\xi _i^2 + \left( {\frac{{\partial ^2w}}{{\partial x\partial \alpha }}} \right)_i\xi _i\zeta _i + \frac{1}{2}\left( {\frac{{\partial ^2w}}{{\partial \alpha ^2}}} \right)_i\zeta _i^2 + O\left( {{\it{\epsilon }}^3} \right).} \hfill \end{array}$$

Substituting this and

$$\bar w_i = w\left( {\bar x_i,\bar \alpha _i} \right) + \frac{1}{2}\left( {\frac{{\partial ^2w}}{{\partial x^2}}} \right)_iV_i^{xx} + \left( {\frac{{\partial ^2w}}{{\partial x\partial \alpha }}} \right)_iV_i^{x\alpha } + \frac{1}{2}\left( {\frac{{\partial ^2w}}{{\partial \alpha ^2}}} \right)_iV_i^{\alpha \alpha } + O\left( {{\it{\epsilon }}^3} \right)$$

into equation (34), we obtained

$$\frac{{dp_i}}{{dt}} = \left[ {w_i - \mathop {\sum }\limits_j w_jp_j} \right]p_i + O\left( {\it{\epsilon }} \right),$$
(35)
$$\begin{array}{*{20}{l}} {\frac{{\partial \phi _i}}{{\partial t}}} \hfill & = \hfill & {\left[ {\left( {\frac{{\partial w}}{{\partial x}}} \right)_i\xi _i + \left( {\frac{{\partial w}}{{\partial \alpha }}} \right)_i\zeta _i + \frac{1}{2}\left( {\frac{{\partial ^2w}}{{\partial x^2}}} \right)_i\left( {\xi _i^2 - V_i^x} \right) + \left( {\frac{{\partial ^2w}}{{\partial x\partial \alpha }}} \right)_i\left( {\xi _i\zeta _i - C_i} \right)} \right.} \hfill \\ {} \hfill & {} \hfill & {\left. { + \frac{1}{2}\left( {\frac{{\partial ^2w}}{{\partial \alpha ^2}}} \right)_i\left( {\zeta _i^2 - V_i^\alpha } \right)} \right]\phi _i + D_x\frac{{\partial ^2\phi _i}}{{\partial x^2}} + D_\alpha \frac{{\partial ^2\phi _i}}{{\partial \alpha ^2}} + O\left( {{\it{\epsilon }}^3} \right),} \hfill \end{array}$$
(36)

where \(w_i = w\left( {\bar x_i,\bar \alpha _i} \right)\), \(\left( {\frac{{\partial w}}{{\partial x}}} \right)_i = \frac{{\partial w}}{{\partial x}}\left( {\bar x_i,\bar \alpha _i} \right)\), \(\left( {\frac{{\partial w}}{{\partial \alpha }}} \right)_i = \frac{{\partial w}}{{\partial \alpha }}\left( {\bar x_i,\bar \alpha _i} \right)\), \(\left( {\frac{{\partial ^2w}}{{\partial x^2}}} \right)_i = \frac{{\partial ^2w}}{{\partial x^2}}\left( {\bar x_i,\bar \alpha _i} \right)\), \(\left( {\frac{{\partial ^2w}}{{\partial x\partial \alpha }}} \right)_i = \frac{{\partial ^2w}}{{\partial x\partial \alpha }}\left( {\bar x_i,\bar \alpha _i} \right)\) and \(\left( {\frac{{\partial ^2w}}{{\partial \alpha ^2}}} \right)_i = \frac{{\partial ^2w}}{{\partial \alpha ^2}}\left( {\bar x_i,\bar \alpha _i} \right)\) are fitness and its first and second derivatives evaluated at the mean traits of morph i, and

$$\begin{array}{l}V_i^x = E_i\left[ {\left( {x - \bar x_i} \right)^2} \right],\\ C_i = E_i\left[ {\left( {x - \bar x_i} \right)\left( {\alpha - \bar \alpha _i} \right)} \right], \\ V_i^\alpha = E_i\left[ {\left( {\alpha - \bar \alpha _i} \right)^2} \right]\end{array}$$
(37)

are within-morph variances and covariance of the traits of morph i. Here \(E_i\left[ {f\left( {x,\alpha } \right)} \right] = {\int\!\!\!\!\!\int} f \left( {x,\alpha } \right)\phi _i\left( {x,\alpha } \right)dxd\alpha\) denotes taking expectation of a function f with respect to the joint trait distribution \(\phi _i(x,\alpha )\) of morph i.

Substituting equation (36) into the change in the mean antigenicity of morph i

$$\frac{{d\bar x_i}}{{dt}} = \frac{d}{{dt}}{\int\!\!\!\!\!\int} x \phi _i(x,\alpha )dxd\alpha = {\int\!\!\!\!\!\int} x \frac{{\partial \phi _i}}{{\partial t}}dxd\alpha = {\int\!\!\!\!\!\int} {(\bar x_i + \xi _i)} \frac{{\partial \phi _i}}{{\partial t}}d\xi _id\zeta _i,$$

we obtained

$$\begin{array}{*{20}{c}} {\frac{{d\bar x_i}}{{dt}} = \left( {\frac{{\partial w}}{{\partial x}}} \right)_iV_i^x + \left( {\frac{{\partial w}}{{\partial \alpha }}} \right)_iC_i + O\left( {{\it{\epsilon }}^3} \right).} \end{array}$$
(38)

Similarly, the change in the mean virulence of morph i was expressed as

$$\begin{array}{*{20}{c}} {\frac{{d\bar \alpha _i}}{{dt}} = \left( {\frac{{\partial w}}{{\partial x}}} \right)_iC_i + \left( {\frac{{\partial w}}{{\partial \alpha }}} \right)_iV_i^\alpha + O\left( {{\it{\epsilon }}^3} \right).} \end{array}$$
(39)

Equations (38) and (39) from the mean trait change was summarized in a matrix form as

$$\begin{array}{*{20}{c}} {\frac{d}{{dt}}\left( {\begin{array}{*{20}{c}} {\bar x_i} \\ {\bar \alpha _i} \end{array}} \right) = {{{\boldsymbol{G}}}}_{{{\boldsymbol{i}}}}\left( {\begin{array}{*{20}{c}} {\left( {\frac{{\partial w}}{{\partial x}}} \right)_i} \\ {\left( {\frac{{\partial w}}{{\partial \alpha }}} \right)_i} \end{array}} \right) + O({\it{\epsilon }}^3),} \end{array}$$
(40)

where

$$\begin{array}{*{20}{c}} {{{{\boldsymbol{G}}}}_{{{\boldsymbol{i}}}} = \left( {\begin{array}{*{20}{c}} {V_i^x} & {C_i} \\ {C_i} & {V_i^\alpha } \end{array}} \right)} \end{array}$$
(41)

is the variance-covariance matrix of the morph i.

Substituting equation (36) into the right-hand side of the change in variance of antigenicity of morph i,

$$\frac{{dV_i^x}}{{dt}} = \frac{d}{{dt}}{\int\!\!\!\!\!\int} {\xi _i^2\phi _id\xi _id\zeta _i} = {\int\!\!\!\!\!\int} {\xi _i^2\frac{{\partial \phi _i}}{{\partial t}}d\xi _id\zeta _i}$$

and those in the change in the other variance and covariance, we obtained

$$\begin{array}{*{20}{l}} {\frac{{dV_i^x}}{{dt}}} \hfill & = \hfill & {\frac{1}{2}\left( {\frac{{\partial ^2w}}{{\partial x^2}}} \right)_i\left[ {E_i\left( {\xi _i^4} \right) - \left( {V_i^x} \right)^2} \right] + \left( {\frac{{\partial ^2w}}{{\partial x\partial \alpha }}} \right)_i\left[ {E_i\left( {\xi _i^3\zeta _i} \right) - V_i^xC_i} \right]} \hfill \\ {} \hfill & {} \hfill & { + \frac{1}{2}\left( {\frac{{\partial ^2w}}{{\partial \alpha ^2}}} \right)_i\left[ {E_i\left( {\xi _i^2\zeta _i^2} \right) - V_i^xV_i^\alpha } \right] + 2D_x + O({\it{\epsilon }}^5),} \hfill \\ {\frac{{dC_i}}{{dt}}} \hfill & = \hfill & {\frac{1}{2}\left( {\frac{{\partial ^2w}}{{\partial x^2}}} \right)_i\left[ {E_i\left( {\xi _i^3\zeta _i} \right) - V_i^xC_i} \right] + \left( {\frac{{\partial ^2w}}{{\partial x\partial \alpha }}} \right)_i\left[ {E_i\left( {\xi _i^2\zeta _i^2} \right) - C_i^2} \right]} \hfill \\ {} \hfill & {} \hfill & { + \frac{1}{2}\left( {\frac{{\partial ^2w}}{{\partial \alpha ^2}}} \right)_i\left[ {E_i\left( {\xi _i\zeta _i^3} \right) - C_iV_i^\alpha } \right] + O({\it{\epsilon }}^5),} \hfill \\ {\frac{{dV_i^\alpha }}{{dt}}} \hfill & = \hfill & {\frac{1}{2}\left( {\frac{{\partial ^2w}}{{\partial x^2}}} \right)_i\left[ {E_i\left( {\xi _i^2\zeta _i^2} \right) - V_i^xV_i^\alpha } \right] + \left( {\frac{{\partial ^2w}}{{\partial x\partial \alpha }}} \right)_i\left[ {E_i\left( {\xi _i\zeta _i^3} \right) - C_iV_i^\alpha } \right]} \hfill \\ {} \hfill & {} \hfill & { + \frac{1}{2}\left( {\frac{{\partial ^2w}}{{\partial \alpha ^2}}} \right)_i\left[ {E_i\left( {\zeta _i^4} \right) - \left( {V_i^\alpha } \right)^2} \right] + 2D_\alpha + O({\it{\epsilon }}^5).} \hfill \end{array}$$
(42)

If we assume that antigenicity and virulence within a morph follow a 2D Gaussian distribution for given means, variances and covariance, we should have \(E_i(\xi _i^4) = 3\left( {V_i^x} \right)^2,E_i(\xi _i^3\zeta _i) = 3V_i^xC_i\), \(E_i(\xi _i^2\zeta _i^2) = V_i^xV_i^\alpha + 2C_i^2\), \(E_i(\xi _i\zeta _i^3) = 3V_i^\alpha C_i\) and \(E_i(\zeta _i^4) = 3\left( {V_i^\alpha } \right)^2\), and hence

$$\frac{{dV_i^x}}{{dt}} = \left( {\frac{{\partial ^2w}}{{\partial x^2}}} \right)_i\left( {V_i^x} \right)^2 + 2\left( {\frac{{\partial ^2w}}{{\partial x\partial \alpha }}} \right)_iV_i^xC_i + \left( {\frac{{\partial ^2w}}{{\partial \alpha ^2}}} \right)_iC_i^2 + 2D_x + O({\it{\epsilon }}^5),$$
(43)
$$\frac{{dC_i}}{{dt}} = \left( {\frac{{\partial ^2w}}{{\partial x^2}}} \right)_iV_i^xC_i + \left( {\frac{{\partial ^2w}}{{\partial x\partial \alpha }}} \right)_i\left\{ {V_i^xV_i^\alpha - C_i^2} \right\} + \left( {\frac{{\partial ^2w}}{{\partial \alpha ^2}}} \right)_iC_iV_i^\alpha + O({\it{\epsilon }}^5),$$
(44)
$$\frac{{dV_i^\alpha }}{{dt}} = \left( {\frac{{\partial ^2w}}{{\partial x^2}}} \right)_iC_i^2 + 2\left( {\frac{{\partial ^2w}}{{\partial x\partial \alpha }}} \right)_iV_i^\alpha C_i + \left( {\frac{{\partial ^2w}}{{\partial \alpha ^2}}} \right)_i\left( {V_i^\alpha } \right)^2 + 2D_\alpha + O({\it{\epsilon }}^5).$$
(45)

Equations (43) and (44) were rewritten in a matrix form as

$$\begin{array}{*{20}{c}} {\frac{{dG_i}}{{dt}} = G_iH_iG_i + \left( {\begin{array}{*{20}{c}} {2D_xV_i^x} & 0 \\ 0 & {2D_\alpha V_i^\alpha } \end{array}} \right) + O({\it{\epsilon }}^5),} \end{array}$$
(46)

where

$$\begin{array}{*{20}{c}} {H_i = \left( {\begin{array}{*{20}{c}} {\left( {\frac{{\partial ^2w}}{{\partial x^2}}} \right)_i} & {\left( {\frac{{\partial ^2w}}{{\partial x\partial \alpha }}} \right)_i} \\ {\left( {\frac{{\partial ^2w}}{{\partial x\partial \alpha }}} \right)_i} & {\left( {\frac{{\partial ^2w}}{{\partial \alpha ^2}}} \right)_i} \end{array}} \right),} \end{array}$$
(47)

is the Hessian of the fitness function of morph i.

In our equation (30) of the joint evolution of antigenicity and virulence of a pathogen after its primary outbreak, the fitness function is given by \(w(x,\alpha ) = \beta (\alpha )s(x) - \alpha ,\) and hence \(w_i = \beta \left( {\bar \alpha _i} \right)s\left( {\bar x_i} \right) - \bar \alpha _i\), \(\left( {\frac{{\partial w}}{{\partial x}}} \right)_i = \beta \left( {\bar \alpha _i} \right)s\prime \left( {\bar x_i} \right)\), \(\left( {\frac{{\partial w}}{{\partial \alpha }}} \right)_i = \beta \prime \left( {\bar \alpha _i} \right)s\left( {\bar x_i} \right) - 1\), \(\left( {\frac{{\partial ^2w}}{{\partial x^2}}} \right)_i = \beta \left( {\bar \alpha _i} \right)s\prime\prime \left( {\bar x_i} \right)\), \(\left( {\frac{{\partial ^2w}}{{\partial x\partial \alpha }}} \right)_i = \beta \prime \left( {\bar \alpha _i} \right)s\prime \left( {\bar x_i} \right)\), \(\left( {\frac{{\partial ^2w}}{{\partial x\partial \alpha }}} \right)_i = \beta \prime \left( {\bar \alpha _i} \right)s\prime \left( {\bar x_i} \right)\) and \(\left( {\frac{{\partial ^2w}}{{\partial \alpha ^2}}} \right)_i = \beta \prime\prime \left( {\bar \alpha _i} \right)s\left( {\bar x_i} \right)\), where a prime on β(α) and s(x) denotes differentiation by α and x, respectively. Substituting these into the dynamics for morph frequencies (equation 35), for morph means (equations 38 and 39), and for within-morph variance and covariance (equations 4345), we obtained

$$\frac{{dp_i}}{{dt}} = \left[ {\beta \left( {\bar \alpha _i} \right)s\left( {\bar x_i} \right) - \bar \alpha _i - \mathop {\sum }\limits_j \left( {\beta \left( {\bar \alpha _j} \right)s\left( {\bar x_j} \right) - \bar \alpha _j} \right)p_j} \right]p_i,$$
(48)
$$\frac{{d\bar x_i}}{{dt}} = \beta \left( {\bar \alpha _i} \right)s\prime \left( {\bar x_i} \right)V_i^x + \left\{ {\beta \prime \left( {\bar \alpha _i} \right)s\left( {\bar x_i} \right) - 1} \right\}C_i,$$
(49)
$$\frac{{d\bar \alpha _i}}{{dt}} = \beta \left( {\bar \alpha _i} \right)s\prime \left( {\bar x_i} \right)C_i + \left\{ {\beta \prime \left( {\bar \alpha _i} \right)s\left( {\bar x_i} \right) - 1} \right\}V_i^\alpha ,$$
(50)
$$\frac{{dV_i^x}}{{dt}} = \beta \left( {\bar \alpha _i} \right)s\prime\prime \left( {\bar x_i} \right)\left( {V_i^x} \right)^2 + 2\beta \prime \left( {\bar \alpha _i} \right)s\prime \left( {\bar x_i} \right)V_i^xC_i + \beta \prime\prime \left( {\bar \alpha _i} \right)s\left( {\bar x_i} \right)C_i^2 + 2D_x,$$
(51)
$$\frac{{dC_i}}{{dt}} = \beta \left( {\bar \alpha _i} \right)s\prime\prime \left( {\bar x_i} \right)V_i^xC_i + \beta \prime \left( {\bar \alpha _i} \right)s\prime \left( {\bar x_i} \right)\left\{ {V_i^xV_i^\alpha - C_i^2} \right\} + \beta \prime\prime \left( {\bar \alpha _i} \right)s\left( {\bar x_i} \right)C_iV_i^\alpha ,$$
(52)
$$\frac{{dV_i^\alpha }}{{dt}} = \beta \left( {\bar \alpha _i} \right)s\prime\prime \left( {\bar x_i} \right)C_i^2 + 2\beta \prime \left( {\bar \alpha _i} \right)s\prime \left( {\bar x_i} \right)V_i^\alpha C_i + \beta \prime\prime \left( {\bar \alpha _i} \right)s\left( {\bar x_i} \right)\left( {V_i^\alpha } \right)^2 + 2D_\alpha .$$
(53)

Equations (48)–(53) describe the oligomorphic dynamics of the joint evolution of antigenicity and virulence of a pathogen for a given host susceptibility profile s(x) over pathogen antigenicity.

Of particular interest is whether antigenicity or virulence evolve faster when they jointly evolve than when they evolve alone. After the primary outbreak at a given antigenicity, for example x = 0, the susceptibility s(x) of the host population increases due to cross immunity as the distance x > 0 from the antigenicity at the primary outbreak increases. Hence, \(s\prime \left( {\bar x_i} \right) > 0.\) Combining this with the positive trade-off between transmission rate and virulence, we see that \(\left( {\partial ^2w/\partial x\partial \alpha } \right)_i = \beta \prime (\bar \alpha _i)s\prime (\bar x_i) > 0\), and then from equation (52), we see that the within-morph covariance between antigenicity and virulence becomes positive starting from a zero initial value:

$$\begin{array}{*{20}{c}} {\left. {\frac{{dC_i}}{{dt}}} \right|_{C_i = 0} = \left( {\frac{{\partial ^2w}}{{\partial x\partial \alpha }}} \right)_iV_i^xV_i^\alpha > 0.} \end{array}$$
(54)

If all second moments are initially sufficiently small for an emerging morph, a quick look at the linearization of equations (51)–(53) around \((V_i^x,C_i,V_i^\alpha ) = (0,0,0)\) indicates that both \(V_i^x\) and \(V_i^\alpha\) become positive due to the random generation of variance by mutation, Dx > 0 and Dα > 0, while the covariance stays close to zero. Then, equation (54) guarantees that the first move of the covariance is from zero to positive, which then guarantees that Ci > 0 for all t. Therefore, the second term in equation (38) is positive until the mean virulence reaches its optimum (\(\beta \prime (\alpha )s(x) = 1\)). This means that joint evolution with virulence accelerates the evolution of antigenicity. The same is true for virulence evolution: the first term in equation (39) (which denotes the associated change in virulence due to the selection in antigenicity through genetic covariance between them) is positive, indicating that joint evolution with antigenicity accelerates virulence evolution.

Numerical example

Figure 5 shows the oligomorphic dynamics prediction of the emergence of the next variant in antigenicity–virulence coevolution. To make progress numerically, we assumed s(x) to be constant in the following analysis because we are interested in the process between the end of the primary outbreak and the emergence of the next antigenicity–virulence morph. The partial differential equations for the density of host S(t,x) susceptible to the antigenicity variant x at time t, and the density of hosts infected by the pathogen variant with antigenicity x and virulence α are

$$\begin{array}{l}\frac{{\partial S\left( {t,x} \right)}}{{\partial t}} = - S\left( {t,x} \right)\mathop {\smallint }\limits_{\alpha _{{{{\mathrm{min}}}}}}^{\alpha _{{{{\mathrm{max}}}}}} \mathop {\smallint }\limits_0^{x_{{{{\mathrm{max}}}}}} \beta \left( \alpha \right)\sigma \left( {x - y} \right)I\left( {t,y,\alpha } \right)dyd\alpha ,\\ \frac{{\partial I\left( {t,x,\alpha } \right)}}{{\partial t}} = \left[ {\beta \left( \alpha \right)S\left( {t,x} \right) - \left( {\gamma + \alpha } \right)} \right]I\left( {t,x,\alpha } \right) + \left( {D_x\frac{{\partial ^2}}{{\partial x^2}} + D_\alpha \frac{{\partial ^2}}{{\partial \alpha ^2}}} \right)I\left( {t,x,\alpha } \right),\end{array}$$
(55)

with the boundary conditions \(\left( {\partial S/\partial x} \right)\left( {t,0} \right) = \left( {\partial S/\partial x} \right)\left( {t,x_{{{{\mathrm{max}}}}}} \right) = 0\), \(\left( {\partial I/\partial x} \right)\left( {t,0,\alpha } \right) = \left( {\partial I/\partial x} \right)\left( {t,x_{{{{\mathrm{max}}}}},0} \right) = 0\), \(\left( {\partial I/\partial x} \right)\left( {t,x,\alpha _{{{{\mathrm{min}}}}}} \right) = \left( {\partial I/\partial x} \right)\left( {t,x,\alpha _{{{{\mathrm{max}}}}}} \right) = 0\), and the initial conditions \(S\left( {0,x} \right) = 1\) and \(I\left( {0,x,\alpha } \right) = {\it{\epsilon }}\delta \left( x \right)\delta \left( \alpha \right)\), where \(\delta ( \cdot )\) is the delta function and \({\it{\epsilon }} = 0.01\). The trait space is restricted in a rectangular region: \(0 < x < x_{{{{\mathrm{max}}}}} = 300\) and \(\alpha _{{{{\mathrm{min}}}}} = 0.025 < \alpha < 10 = \alpha _{{{{\mathrm{max}}}}}\). Oligomorphic dynamics prediction for the joint evolution of antigenicity and virulence was applied for the next outbreak after the outbreak with the mean antigenicity around x = 108 at time t = 102. The susceptibility of the host to antigenicity variant x at t0 = 104.8 after the previous outbreak peaked around time t = 102 came to an end is

$$s\left( x \right) = S\left( {t_0,x} \right).$$

This susceptibility profile remained unchanged until the next outbreak started, and hence the fitness of a pathogen variant with antigenicity x and virulence α is given by

$$w\left( {x,\alpha } \right) = \beta \left( \alpha \right)s\left( x \right) - (\gamma + \alpha ).$$

We bundled the pathogen variants into two morphs at time t0 at the threshold antigenicity xc, above which the net growth rate of the pathogen variant under the given susceptibility profile s(x) and the mean antigenicity become positive:

$$w\left( {x_c,\bar \alpha \left( {t_0} \right)} \right) = \beta \left( {\bar \alpha (t_0)} \right)s\left( {x_c} \right) - \left( {\gamma + \bar \alpha \left( {t_0} \right)} \right) = 0.$$

The initial frequency and the moments of the two morphs, the variant 0 with \(x < x_c\) and the variant 1 with \(x > x_c\) were then calculated respectively from the joint distribution \(I(t_0,x,\alpha )\) in the restricted region \(\left\{ {\left( {x,\alpha } \right);0 < x < x_c,\alpha _{{{{\mathrm{min}}}}} < \alpha < \alpha _{{{{\mathrm{max}}}}}} \right\}\) and that in the restricted region \(\left\{ {\left( {x,\alpha } \right);x_c < x < x_{{{{\mathrm{max}}}}},\alpha _{{{{\mathrm{min}}}}} < \alpha < \alpha _{{{{\mathrm{max}}}}}} \right\}\). The frequency p1 of morph 1 (the frequency of morph 0 is given by \(p_0 = 1 - p_1\)), the mean antigenicity \(\bar x_i\) and mean virulence \(\bar \alpha _i\) of morph i, and the variances and covariance, \(V_i^x\), and \(V_i^\alpha\) Ci of morph i (i = 0,1) follow equations (48)–(53), where the dynamics for the morph frequency (equation 48) is simplified in this two-morph situation as

$$\frac{{dp_1}}{{dt}} = \left[ {\beta \left( {\bar \alpha _1} \right)s\left( {\bar x_1} \right) - \beta \left( {\bar \alpha _0} \right)s\left( {\bar x_0} \right) - \left( {\bar \alpha _1 - \bar \alpha _0} \right)} \right]p_1\left( {1 - p_1} \right),$$

with \(p_0\left( t \right) = 1 - p_1(t)\). This is iterated from \(t = t_0 = 104.8\) to \(t_e = 107\). The frequency p1 of the new morph, the population mean antigenicity \(\bar x = p_0\bar x_0 + p_1\bar x_1\), virulence \(\bar \alpha = p_0\bar \alpha _0 + p_1\bar \alpha _1\), variance in antigenicity \(V_x = p_0V_0^x + p_1V_1^x\), covariance between antigenicity and virulence \(C = p_0C_0 + p_1C_1\), and variance in virulence \(V_\alpha = p_0V_0^\alpha + p_1V_1^\alpha\) are overlayed by red thick curves on the trajectories of moments observed in the full dynamics (equation 55).

In Fig. 5a, the dashed vertical line represents the threshold antigenicity xc, above which \(R_0 = \beta s(x)/(\gamma + \bar \alpha ) > 1\) at \(t = t_s = 104.8\), where oligomorphic dynamics prediction was attempted. Two morphs were then defined according to whether or not the antigenicity exceeded a threshold x = xc: the resident morph (morph 1) is represented as the dense cloud to the left of x = xc and the second morph (morph 2) consisting of all the genotypes to the right of x = xc with their R0 greater than one. The within-morph means and variances were then calculated in each region. The relative total densities of infected hosts in the left and right regions defined the initial frequency of two morphs in OMD. A 2D Gaussian distribution was assumed for within-morph trait distributions to have the closed moment equations as previously explained. Using these as the initial means, variances, covariances of the two morphs at t = ts, the oligomorphic dynamics for 11 variables (relative frequency of morph 1, mean antigenicity, mean virulence, variances in antigenicity and virulence and their covariance in morphs 0 and 1) was integrated up to t = te. The results are shown as red curves in Fig. 5c–h, which are compared with the simulation results (blue curves).

Fig. 5c–e respectively show the change in total infected density, mean antigenicity and mean virulence. Red curves show the predictions by oligomorphic dynamics from the initial moments of each morph at t = ts to the susceptibility distribution \(s(x) = S(t_s,x)\), which are compared with the simulation results (blue curves). The OMD-predicted mean antigenicity, for example, is defined as

$$\bar x\left( t \right) = \left( {1 - p_1\left( t \right)} \right)\bar x_0\left( t \right) + p_1\left( t \right)\bar x_1\left( t \right),$$

where p1(t) is the frequency of morph 1, \(\bar x_0\) and \(\bar x_1\) are the mean antigenicities of morphs 0 and 1.

The red curves in Fig. 5f–h show the OMD-predicted changes in the variance in antigenicity, variance in virulence and covariance between antigenicity and virulence, which are compared with the simulation results (blue curves). The OMD-predicted covariance, for example, is defined as

$$\begin{array}{rcl}C\left( t \right) & = & \left( {1 - p_1(t)} \right)C_0\left( t \right) + p_1\left( t \right)C_1\left( t \right) + p_1\left( t \right)\left( {1 - p_1\left( t \right)} \right)\\ && \left( {\bar x_0\left( t \right) - \bar x_1\left( t \right)} \right)\left( {\bar \alpha _0\left( t \right) - \bar \alpha _1\left( t \right)} \right),\end{array}$$

where \(C_0(t)\) and \(C_1(t)\) are the antigenicity–virulence covariances in morphs 0 and 1, and \(\bar \alpha _0(t)\) and \(\bar \alpha _1(t)\) are the mean virulence of morphs 0 and 1.

Selection for maximum growth rate

We next show that a pathogen that has the strategy of maximizing growth rate in a fully susceptible population is evolutionarily stable in the presence of antigenic escape.

At stationarity, the travelling wave profiles of \(\hat I(z)\) and \(\hat S(z)\) along the moving coordinate, \(z = x - vt\), that drifts constantly to the right with the speed v are defined as

$$\begin{array}{l}0 = D\frac{{d^2\hat I\left( z \right)}}{{dz^2}} + v\frac{{d\hat I\left( z \right)}}{{dz}} + \beta \hat S\left( z \right)\hat I\left( z \right) - \left( {\gamma + \alpha } \right)\hat I\left( z \right),\\ 0 = v\frac{{d\hat S\left( z \right)}}{{dz}} - \beta \hat S\left( z \right)\mathop {\smallint }\limits_{ - \infty }^\infty \sigma \left( {z - \xi } \right)\hat I\left( \xi \right)d\xi ,\end{array}$$
(56)

with \(\hat I\left( { - \infty } \right) = \hat I\left( \infty \right) = 0\), \(\hat S\left( \infty \right) = 1\).

Let j(t,x) be the density of a mutant pathogen variant, with virulence α′ and transmission rate β′, that is introduced in the host population where the resident variant is already established (equation 50). For the initial transient phase in which the density of mutants is sufficiently small, we have an equation for the change in \(J\left( {t,z} \right) = j(t,x)\):

$$\begin{array}{*{20}{c}} {\frac{\partial }{{\partial t}}J\left( {t,z} \right) = \left\{ {D\frac{{\partial ^2}}{{\partial z^2}} + v\frac{\partial }{{\partial z}} + \beta \prime \hat S\left( z \right) - \left( {\gamma + \alpha \prime } \right)} \right\}J\left( {t,z} \right),} \end{array}$$
(57)

with the initial condition \(J\left( {0,z} \right) = {\it{\epsilon }}\delta (z)\), where \({\it{\epsilon }}\) is a small constant and \(\delta ( \cdot )\) is Dirac’s function.

Consider a system

$$\begin{array}{*{20}{c}} {\frac{{\partial w}}{{\partial t}} = \left\{ {D\frac{{\partial ^2}}{{\partial z^2}} + v\frac{\partial }{{\partial z}} + \beta \prime - \left( {\gamma + \alpha \prime } \right)} \right\}w,} \end{array}$$
(58)

with \(w\left( {0,z} \right) = J\left( {0,z} \right) = {\it{\epsilon }}\delta (z)\). Noting that \(\hat S\left( z \right) < 1\), we have \(J\left( {t,z} \right) \le w(t,z)\) for any \(t > 0\) and \(z \in {\Bbb R}\) from the comparison theorem. The solution to equation (52) is

$$\begin{array}{*{20}{c}} {w\left( {t,z} \right) = \frac{{\it{\epsilon }}}{{\sqrt {4\pi Dt} }}\exp \left[ {r\prime t - \frac{{\left( {z + vt} \right)^2}}{{4Dt}}} \right]} \end{array},$$
(59)

where \(r\prime = \beta \prime - \left( {\gamma + \alpha \prime } \right)\). This follows by noting that \(w\left( {t,x} \right)e^{ - r\prime t}\) follows a simple diffusion equation \(\partial w/\partial t = D\partial ^2w/\partial x^2\). By rearranging the exponents of equation (53),

$$\begin{array}{*{20}{l}} {w\left( {t,z} \right)} \hfill & = \hfill & {\exp \left[ {at - kz} \right]\frac{{\it{\epsilon }}}{{\sqrt {4\pi Dt} }}e^{ - z^2/4Dt}} \hfill \\ {} \hfill & {} \hfill & { < \frac{{\it{\epsilon }}}{{\sqrt {4\pi Dt} }}\exp \left[ {at - kz} \right],} \hfill \end{array}$$
(60)

where

$$a = \frac{{v^{\prime 2} - v^2}}{{4D}},$$
(61)
$$k = \frac{v}{{2D}}.$$
(62)

Here \(v\prime = 2\sqrt {r\prime D}\) is the asymptotic wave speed if the mutant variant monopolizes the host population. Therefore, if \(v\prime < v\), then \(a < 0\), and hence \(w(t,z)\) for a fixed z converges to zero as t goes to infinity; this, in turn, implies that \(J(t,z)\) converges to zero because \(J\left( {t,z} \right) \le w\left( {t,z} \right)\) for all t and z. Therefore, we conclude that any mutant that has a slower wave speed than the resident can never invade the population, implying that a variant that has the maximum wave speed \(v = 2\sqrt {rD}\) is locally evolutionarily stable.

Reporting Summary

Further information on research design is available in the Nature Research Reporting Summary linked to this article.