Introduction

Many aspects of infections and immunity differ between women and men. For example, infections tend to be more frequent in men, immune responses are typically stronger in women (with women usually clearing infections faster), and pathogens are often more virulent in men (with men experiencing more severe outcomes)1,2,3,4,5,6. Many of the sex differences in the frequency, duration and severity of infectious diseases are attributable to differences in both the innate and the adaptive immune systems1,3,6. The innate immune system is always active, providing a fast and general response to infections1,3,6. The adaptive immune system is activated by the innate system and pathogen’s exposure, providing specific responses to infection1,3,6. Although there are complexities across the lifespan and among cell types3, both innate and adaptive immune responses are typically heightened in women, with higher numbers of macrophages and B-cells and greater activation of T and B-cells1,2,3,4,5. The higher number and activation of immune cells tend to result in faster clearance of infections and increased efficacy of vaccines in women, but also in their increased exposure to autoimmune disease1,2,3,4,5. Henceforth we use the term stronger immune system to refer to the faster clearance of infections resulting in a greater rate of recovery in women3,6. To date, the reasons why women should have a stronger immune system are not well understood4,5,7. Notice that we will focus on sex differences rather than gender differences (see ref. 8 for a discussion on sex and gender in immunity).

From a medical perspective, understanding the difference between the sexes in their immune function and response is critical to implementing treatments that are effective in both women and men. Furthermore, a strong immune system may result in immune cells attacking other cells of the same organism and causing autoimmune diseases9,10,11. By contrast, a weak immune system results in longer infections where pathogens may have a greater opportunity to disrupt the epigenome of host cells, causing cancer12,13. Understanding the differences in immune response between women and men is thus fundamental to address the disproportionate amount of autoimmune diseases affecting women and the disproportionate frequency of cancers affecting men9,10,11,12.

Historically, it has been argued that the drivers of a stronger immune system in women are proximate physiological mechanisms1,2,3,4,5,6,14. In particular, previous work contends that sex hormones and sex chromosomes are the two main sources of sex-related asymmetry in immunocompetence. Sex hormones (progesterone, oestrogen and testosterone) play a role in the regulation of the immune system, with oestrogen enhancing immunocompetence and testosterone inhibiting it1,2,3,4,5,6,14. Because women exhibit higher levels of oestrogen and men exhibit higher levels of testosterone, differences in sex hormones could explain the mechanism underpinning a stronger immune system in women1,2,3,4,5,6,14. In addition, sex chromosomes provide women with two potentially different copies of X-linked genes and men with one copy of X-linked genes and Y-linked genes. Random X-chromosome inactivation in women results in cell mosaicism and incomplete inactivation may result in higher expression of specific genes in women. Y-linked genes provide a set of genes expressed only in men. Together, X-chromosome inactivation and/or escape from inactivation in women and Y-linked genes in men may explain the stronger immune system in women1,2,3,4,5,6,14 (Fig. 1).

Fig. 1: Hypotheses explaining stronger immunocompetence in women.
figure 1

Summary of the phenotypes evolving (in green), the drivers of their evolution (in purple), and the key predictions of each hypothesis. Panel A corresponds to previous work, while panel B corresponds to the work presented here.

Although proximate mechanisms for sex differences in immunocompetence have been proposed, there is relatively little research exploring the reasons why differences between the sexes in the strength of their immune systems (whether implemented by any means) may be advantageous for women and men. The scarcity of ultimate explanations is striking, as the immune system has direct effects on the fitness of individuals and is under strong selection1,15. We are aware of only three hypotheses aimed at explaining why women may have evolved a stronger immune system.

The first theory, henceforth the ‘sexual selection theory,’ considers the role of male competition for mating partners. This theory claims that testosterone, on the one hand, inhibits the immune system of males but, on the other hand, enhances their ability to compete for mating partners16,17,18,19. This theory predicts that when males are under strong competition for partners, natural selection favours greater investment in mating success, even when this comes at the cost of a weaker immune system16,17,18,19. Sexual selection thus favours the evolution of a weaker immune system in males as a result of the fitness costs associated with immune function in this sex (Fig. 1).

The second theory, henceforth the ‘transmissibility theory,’ considers the role of the pathogen’s ability to be transmitted to unrelated hosts (horizontal transmission). The difference between the sexes is introduced either by sex-related differences in susceptibility or sex-related differences in the pathogen’s ability to produce more copies of itself once established in its host (virulence). This theory predicts that when pathogens are more likely to infect males, natural selection favours a stronger immune system in females to clear infections faster20. It also predicts that when pathogens are more virulent in females, natural selection favours a stronger immune system in females20 (Fig. 1). The latter prediction of this model, however, is not consistent with the empirical observation that pathogens are more virulent in males.

A recent theory, henceforth the ‘immunity transfer theory,’ considers the role of maternal transference of immunity to her offspring. This theory predicts that when females can confer immunity to their offspring against horizontally transmitted pathogens, natural selection favours a stronger immune system in females, manifested as heightened detection of pathogens leading to faster clearance21 (Fig. 1).

Previous work does not consider the role of transmission of infections from mother to child on the evolution of women’s immune system. To refer to this transmission, in this research, we will use the terms ‘vertical transmission’ and ‘mother-to-child transmission’ interchangeably. Maternity, the period of time between conception and weaning, is a key life-history feature of females as far as natural selection is concerned. Success in conception and pregnancy is conditioned by a woman’s immune system1. Oestrogen and progesterone—the predominant female sexual hormones—by enhancing the immune system, not only prevent infections but also reduce fertility. This reduction in fertility can be caused by oestrogen-enhancing immune attacks on sperm, thus reducing the likelihood of conception and/or enhancing immune attacks on foetus resulting in miscarriage1,22,23,24,25. Furthermore, pregnancy and lactation open up a route for the transmission of pathogens that is unique to women26. During pregnancy and delivery, offspring can be born infected because some pathogens can cross the placenta and others enter the offspring at delivery26. Similarly, during lactation, offspring can be infected through breast milk26. Mother-to-child transmission is common in many infectious diseases (see examples in Fig. 2).

Fig. 2: Examples of vertically transmitted diseases.
figure 2

Here we provide a non-exhaustive list of pathogens that are vertically transmitted.

In addition, all previous work on the evolution of women’s immunocompetence provides a partial view of the evolutionary interaction between hosts and pathogens; a view that focuses on the evolution of hosts, ignoring the evolutionary feedback of pathogens18,20. It is well-known, however, that the evolution of hosts cannot be separated from the evolution of pathogens18,27,28. Therefore, it is critical to consider that the immunocompetence of hosts and the virulence of pathogens can simultaneously evolve in response to changes in one another (co-evolution).

Here, we explore whether the stronger immune system observed in women can be an adaptation of women to vertical transmission. For this purpose, we model the co-evolution between host immunocompetence and the pathogenic virulence exhibited by a pathogen. Because our approach is theoretical in nature, all findings we report require experimental support before being used to guide decisions regarding healthcare.

In our model, host immunocompetence is reflected in the rate of recovery from infection, γi with i = f for females and i = m for males. For its part, pathogen virulence is represented as the increased mortality rate experienced by those infected, αi with i = f for female hosts and i = m for male hosts. We incorporate vertical transmission by assuming that infected mothers transmit the pathogen, at birth, to their offspring with probability v (i.e. the ‘vertical transmission rate’). Finally, to ensure that our findings can be compared to previous theory, we treat immunocompetence as a costly trait, with ci representing the reproductive fitness cost paid by hosts of sex i = f, m.

Our work explains why women have evolved to recover more quickly from infections while pathogens have evolved a greater virulence in males. To make our case, we rely on a fundamental biological difference between the sexes, namely mother-to-child transmission. Our work challenges the pre-existing idea that vertical transmission reduces pathogen virulence in all cases29,30. We advance existing theory by providing a framework to study the co-evolution between immunocompetence and virulence in women and men when there is both horizontal and vertical transmission. More broadly, we consider the implications of our work for public health policies. In particular, we consider the efforts directed at reducing mother-to-child transmission on the immune systems of women and men and the disproportionate incidence of autoimmune disease in women and cancer in men.

Results

Equal cost for sexes and no mother-to-child transmission

We first assume mothers do not transmit pathogens to their children (v = 0) to establish a baseline set of model predictions. In this case, if the fitness cost of recovery from infection for females is the same as the fitness cost of recovery for males (cf = cm) then selection favours defended hosts and virulent parasites, in agreement with the previous work27. Furthermore, selection leads to co-evolved levels of immunocompetence and virulence (i.e., \({\gamma }_{i}\to {\gamma }_{i}^{*}\) and \({\alpha }_{i}\to {\alpha }_{i}^{*}\) over time) that are independent of the sex of the host (in the van Baalen axis of symmetry; Fig. 3A).

Fig. 3: Co-evolved levels of virulence and immunocompetence in each sex.
figure 3

Panel A presents the case when there are no differences between the sexes. In the absence of differences between the sexes, trajectories converge to the main diagonal (the van Baalen axis), recovering previous non-sex-specific co-evolutionary results27. Panel B presents the case when the only difference between the sexes is the mother-to-child transmission rate, that is v > 0 and cf = cm. Panels C, D present the case when the only difference between the sexes is the fitness cost of immunocompetence, that is cf ≠ cm and v = 0. Results are based on c0 = 0.01 (panels B–D), bmax = 2, βmax = 1.1, d = 4, μ = 0.1, and v ranges between 0 and 0.9. See Methods for an explanation of model parameters. Source data are provided as a Source Data file.

Unequal costs in the sexes and no mother-to-child transmission

When mothers do not transmit pathogens to their children (v = 0) and the cost of recovery is not equal in the sexes (cf ≠ cm), it is the sex-specific costs that determine the qualitative outcome of the co-evolutionary process described by our model. The sex that pays the lower cost of recovery can better afford a higher level of immune function. This sets the stage for higher virulence of pathogens infecting hosts of that sex, as pathogens compensate for reduced residency time within a host by increasing their rate of horizontal transmission between hosts, and increased virulence is, by the assumptions of our model, an inevitable consequence of this compensation (Fig. 3C, D). In this case, sex-specific costs of recovery lead to the co-evolution of levels of immunocompetence and virulence that are themselves sex-specific (away from the diagonal in Fig. 3C, D). The predicted pattern is one in which both immunocompetence and virulence are stronger in the same sex, that is, both stronger in females or both stronger in males (Fig. 3C, D).

More specifically, when the cost disparity between the sexes is increased, while keeping the midpoint cost (cf + cm)/2 = c0 fixed, we find (i) the resulting co-evolved immunocompetence is enhanced in the sex with the cheaper immune system and lowered in the sex with the more expensive system and (ii) the co-evolved virulence is enhanced in the sex with the cheaper immune system and lowered in the sex with the more expensive immune system (Fig. 3C, D).

Our results show that when protection against disease is more expensive for females, their immunocompetence will be weaker and pathogens will exhibit higher virulence when infecting males, i.e., \({\gamma }_{m}^{*} \, > \, {\gamma }_{f}^{*}\) and \({\alpha }_{m}^{*} \, > \, {\alpha }_{f}^{*}\) (Fig. 3C). Similarly, when protection against disease is more expensive for males, their immunocompetence will be weaker relative to females and pathogens will exhibit higher virulence when infecting females, i.e., \({\gamma }_{m}^{*} \, < \, {\gamma }_{f}^{*}\) and \({\alpha }_{m}^{*} \, < \, {\alpha }_{f}^{*}\) (Fig. 3D).

Equal cost for sexes and mother-to-child transmission

When mothers transmit pathogens to their children (v > 0) and the cost of recovery is equal in both sexes (cf = cm), the likelihood of mother-to-child transmission determines the qualitative outcome of the co-evolutionary process described by our model. Specifically, low mother-to-child transmission leads to stronger immunocompetence in females (Fig. 3B) in all cases. High mother-to-child transmission, however, can sometimes lead to stronger immunocompetence in females (Fig. 3B), but can, at other times, lead to stronger immunocompetence in males, depending on the life-history trade-off faced by the pathogen (Fig. 5, see Methods and Supplemental Material). In all cases, there is higher virulence of pathogens infecting males (Fig. 3B). Mother-to-child transmission also leads to the evolution of levels of immunocompetence and virulence that are sex-specific (away from the van Baalen axis of symmetry; Fig. 3B). Mother-to-child transmission allows for a pattern in which females exhibit stronger immunocompetence compared to males while pathogens are more virulent when infecting males as opposed to females (Fig. 3B).

More specifically, we find that the co-evolved level of immunocompetence of both sexes grows along with the likelihood of mother-to-child transmission (Fig. 4A). In most cases (and always when the likelihood of mother-to-child transmission is low), the immunocompetence in females increases at a faster rate than it does in males (Fig. 4A). This leads to stronger immunocompetence of females (Fig. 3B). We find that the co-evolved virulence of pathogens infecting females is reduced as the likelihood of mother-to-child transmission grows, while that of pathogens infecting males increases (Fig. 4A). This leads to stronger virulence of pathogens infecting males (Fig. 3B). The latter result challenges the consensus in the field that vertical transmission universally reduces the virulence of pathogens29,31. Previous work assumes that pathogen’s virulence evolves independently from host’s immunocompetence31. We show that when virulence and immunocompetence co-evolve, vertical transmission can result in the evolution of higher virulence. Remarkably, it is vertical transmission, a trait in females, that leads to the evolution of higher virulence in males in this framework.

Fig. 4: Co-evolved levels of virulence and immunocompetence in each sex as vertical transmission and difference in the cost of immune function changes.
figure 4

In panel A black and white sub-panels present the virulence and immunocompetence levels in each of the sexes, while coloured centre sub-panels present the virulence and immunocompetence of the sexes relative to each other. In these sub-panels red areas correspond to greater values in females and blue areas correspond to greater values in males. Black curves in centre sub-panels correspond to zero differences between the sexes and separate red regions from blue ones. Panel B.i combines the black curves in panel (A) centre sub-panels to define three regions corresponding to the three qualitatively different co-evolutionary patterns. Panels B.ii, iii show how these regions change as parameter values affecting the trade-off in host c0 and pathogen d change. Results are based on c0 = 0.1, bmax = 2, βmax = 1.1, d = 4 and μ = 0.1. See Methods for an explanation of model parameters. Source data are provided as a Source Data file.

Unequal costs for sexes and mother-to-child transmission

Considering both contributions of maternity—sex-specific costs of recovery and mother-to-child transmission—we identify the same three qualitatively distinct co-evolutionary outcomes revealed by the special cases above (Fig. 4). Each outcome can be mapped to a distinct region of parameter space (Fig. 4B).

First, we predict females recover more quickly and suffer higher virulence when the cost of recovery is higher in males and mother-to-child transmission is sufficiently low (Fig. 4B.i). Second, we predict males recover more quickly and suffer higher virulence when the cost of recovery is higher in females (Fig. 4B.i). Third, we predict females recover more quickly yet suffer lower virulence when the cost of recovery is higher in males and mother-to-child transmission is sufficiently high (Fig. 4B.i). How low or high vertical transmission has to be will change along with life-history details of hosts and pathogens (Fig. 4B.ii–iii).

In our model, we find a wide range of parameter values that support stronger female immunocompetence, represented by the rate of recovery among infected individuals of this sex. Furthermore, the range of parameter values where stronger female immunocompetence and high virulence in males are predicted is also significant. This pattern requires mother-to-child transmission but can be observed both when mother-to-child transmission is low (as long as the difference in reproductive cost is slightly greater in males) and high (for both, when reproductive costs are greater in males and when reproductive costs are greater in females) and for a wide range of parametrisations.

Discussion

Our work finds that the stronger immune response observed in women1,2,3,4,5,6,14 can be understood as an evolutionary consequence of pathogen transmission from mothers to their children. We predict that, in the absence of any other differences between the sexes, even the smallest amount of vertical transmission results in faster recovery in women (Figs. 3B, 4). Furthermore, greater fitness costs of immunocompetence in men enhance this bias in immunocompetence toward women (Figs. 3D, 4). In this sense, we find that mother-to-child transmission and sexual selection work together, favouring greater immunocompetence in women. The transmission of pathogens from mothers to their children is a fundamental biological difference between the sexes. It is common during pregnancy when smaller pathogens can cross the placenta, and during natural delivery, when offspring swallow or inhale all types of pathogens26. In addition, during the lactation period, newborns can be infected through breast milk and close contact26. Vertical transmission has been reported in many infectious diseases, including malaria, tuberculosis, hepatitis and, most recently, COVID-19 (see Fig. 2 for a non-exhaustive list of diseases that are vertically transmitted).

We also find that mother-to-child transmission drives the co-evolution of higher virulence in men and a stronger immune response in women. Importantly, this combined pattern of virulence and immunocompetence is the one observed by medical researchers and cannot be explained by any of the existing hypotheses1,2,3,4,5,6,14,17,21. In the absence of any other difference between the sexes, we find that any small amount of mother-to-child transmission results in higher virulence in men and faster recovery in women (Fig. 4). Higher costs of immunocompetence in men alone cannot explain the combined pattern of higher virulence in men and stronger immunocompetence in women (Fig. 4). The sexual-selection, transmissibility, and immunity transfer hypotheses in their current formulations consider the evolution of host immunocompetence ignoring the feedback from co-evolving pathogens18,20. However, co-evolution between hosts and pathogens is crucial for a complete picture of the natural history of infectious diseases27,28. Our work not only considers previously unrecognised drivers for the evolution of stronger immunocompetence—vertical transmission and costs of immunocompetence in females—but does it in a broader co-evolutionary framework.

Our work only provides partial support for the sexual selection hypothesis, whereby the greater cost of immunocompetence in men leads to the evolution of greater immunocompetence in women. However, we find that in extending the tenets of the sexual selection hypothesis to a co-evolutionary framework, the emerging pattern is one of higher virulence and stronger immunocompetence in women, which is contrary to medical observations1,2,3,4,5,6,14,17.

Our model predicts that mother-to-child transmission of pathogens drives the co-evolution of a pattern where women put up a stouter defence against relatively harmless pathogens and men put up a weaker defence against fierce pathogens. Why fight harder when being exploited to a lesser degree? While this pattern may seem counterintuitive at first, a complete argument recognises that mother-to-child transmission introduces an extra cost of infection—a reduction in the quality of offspring produced—in addition to the ever-present threat of mortality. Females, and females alone, can modulate the extra cost of infection associated with mother-to-child transmission directly by adjusting their immunocompetence. Thus, females have an extra incentive to clear infections more readily than males, even when these infections are more virulent in males. Pathogens infecting females do not respond to the increased immunocompetence with substantial changes to their virulence because trans-generational transmission also acts as an evolutionary brake. An increase in virulence when infecting females would, of course, limit a pathogen’s ability to exploit mother-to-child transmission pathways. In summary, our model shows that mother-to-child transmission decouples the pattern of mutual escalation/de-escalation predicted by asymmetries in fitness costs of immunocompetence between the sexes (horizontal axis in Fig. 4B).

Because host immunocompetence impacts its reproductive success, the immunocompetence-virulence patterns discussed here apply to women and men of reproductive age. In post-reproductive stages, evolutionary forces may change. In principle, post-reproductive individuals could invest resources in immunocompetence without experiencing the cost of reduced fertility as they do not produce offspring anymore. The expected outcome would be the enhancement of cost-free immunocompetence by the host followed by the enhancement of virulence by the pathogen to compensate. In principle, an erosion of the differences in immunocompetence between the sexes in post-reproductive age would be expected, but due to the difference between the sexes in the time in which they cease to reproduce (earlier in women than men), one would expect that immunocompetence in women would be heightened following menopause well before men catch up. This would not be the case, however, if post-reproductive individuals contribute to the reproductive success of their offspring, as the ‘Grandmother Hypothesis’ argues in the context of the evolution of menopause (see refs. 32, 33 for the hypothesis and refs. 34, 35 for empirical support). If a grandmother provides assistance in raising her grand-offspring, she would still be trading immunocompetence for fertility although, this time, mediated by her grandchildren. Furthermore, due to close contact with her own grandchildren, she would be a source of generalised vertical transmission (generalised, in the sense that infection would potentially occur in a manner that was not sensitive to the prevalence of the disease in the broader population). In this scenario, our findings fully apply to post-reproductive men and women. A proper analysis of the change in evolutionary forces with the reproductive state would require a much complex model with age structure in the population. While this is beyond the scope of our paper, it is a promising avenue for future research.

Our results challenge the widely accepted notion that mother-to-child transmission should reduce virulence. Previous work explored the effect of vertical transmission on the evolution of virulence—ignoring host feedback—finding that vertical transmission reduces virulence in general29,30. When allowing for plasticity in the evolution of pathogen’s virulence, vertical transmission results in more tamed pathogens in women and has no effect in men31. Here we show that in a co-evolutionary context, vertical transmission leads to more tamed pathogens in women but more aggressive pathogens in men (Fig. 3B). The reason why is that vertical transmission enhances the immunocompetence in males—although to a lesser degree than it does in females—which leads to pathogens becoming more virulent to compensate. In the absence of sex-specific plasticity, this may result in parameter regions where virulence may increase with vertical transmission.

Higher virulence in men and stronger immunocompetence in women can be observed when we are modelling both innate or adaptive immunocompetence. Here, we assumed that the cost of an immune system was a cost experienced by the host both when it was infected and not infected. This corresponds to a cost of maintenance of the immune system, which relates best to the cost of innate immunocompetence. An alternative assumption (modelled in the Supplemental Material) is that the cost of an immune system is experienced only by infected hosts. This corresponds to the cost of activating the immune system in response to an infection which relates best to the cost of adaptive immunocompetence. We find that our results do not change qualitatively when modelling innate as opposed to adaptive immunocompetence (Fig. 5). The only qualitative difference is that the region of parameter space where the pattern we are interested in can be observed shrinks when the immunocompetence costs are constant (Fig. 5).

Fig. 5: Regions of qualitatively different co-evolutionary patterns when the fitness cost of immune investment is fixed and variable.
figure 5

Fixed immunity costs are those experienced in all cases (with or without infection) and best reflect innate immunity costs. Variable immunity costs are those experienced with infection only and best reflect adaptive immunity costs. Results are based on c0 = 0.5, bmax = 3.5, βmax = 3.1, d = 4 and μ = 0.1. See Methods for an explanation of model parameters. Source data are provided as a Source Data file.

There are different ways of measuring virulence and immunocompetence36. In this research, we used the conventional definition of virulence as the disease-related mortality rate (αi), and we used the recovery rate (γi) to reflect immunocompetence. However, medical researchers often measure the probability of an infected individual dying from an infection (‘case mortality,’ denoted here as χi for i = f, m) as virulence, and the probability of an infected individual recovering from infection (‘case recovery,’ denoted here as ηi for i = f, m) as a measure of immunocompetence36. If we change our thinking and measure virulence as the probability of mortality and immunocompetence as recovery in infected individuals, the range of scenarios in which women recover from infections more readily and men suffer virulent effects more strongly expands significantly. More to the point, when translating our results into these metrics, we observe that the region of interest where case mortality is high in males and case recovery is high in females occupies a larger portion of the parameter space (Fig. 6). Remarkably, this region extends to the horizontal axis where the cost of immunocompetence in men is greater than in women even if there is no mother-to-child transmission (Fig. 6).

Fig. 6: Regions of qualitatively different co-evolutionary patterns when measured as case mortality χi for i = f, m, and case recovery ηi for i = f, m as usually done in medical records.
figure 6

Results are based on c0 = 0.1, bmax = 2, βmax = 1.1, d = 4 and μ = 0.1. See Methods for an explanation of model parameters. Source data are provided as a Source Data file.

From a more applied perspective, our results can help explain the higher incidence of autoimmune diseases in women and of cancers in men. A strong immune system to fight weak pathogens may result in the long-term development of autoimmune diseases. Our work predicts a higher incidence of autoimmune diseases in women. Evidence does show that the incidence of autoimmune diseases is much higher in women9,10,11,37,38. A longer time to clearance of pathogens replicating at high rates gives pathogens more time to modify the epigenetic signature of host cells in order to speed up cell replication. Such modifications to the epigenetic signature may result in the development of cancers in individuals that recovered from infections. Our work predicts a higher incidence of cancers in men as they take longer to clear infections. Evidence does show that the incidence of cancers is much higher in men12. Notice that susceptibility to autoimmune diseases in women increases with age39. This is consistent with our model as the fertility cost of investing in immunocompetence reduces with age. We thus would naively predict that immunocompetence would be enhanced with age and more in women than men, thus resulting in a greater incidence of autoimmune disease in older women. Notice, however, that this would need to be verified by extending our model to include age structure.

Our work suggests that the population-wide use of drugs (or other methods) to prevent mother-to-child transmission of infectious diseases will ultimately reduce the incidence of autoimmune disease in women and the virulence of infectious diseases in men over evolutionary time. Reduction of mother-to-child transmission is predicted to reduce the virulence of pathogens infecting men and the immunocompetence of women (Fig. 3). Therefore, public health policies aimed at reducing mother-to-child transmission may help to alleviate the disproportionate incidence of autoimmune disease in women9,10,11,37,38. The flip side of such policies is that they will increment the disproportionate incidence of cancer in men12 as our work suggests that they would weaken their immunocompetence (Fig. 3).

In general, a better understanding of what causes the observed differences in immunocompetence between women and men should bring us closer to implementing sex-specific medical treatment, thus improving therapeutic choices. Differences between the sexes with respect to infectious diseases have been well documented since the 1960s and can be reflected in the immune response itself or the rate of response to drug-based treatments40,41,42. Instead of controlling for differences between the sexes, the reaction of scientists was to exclude women from clinical trials or ignore sex differences in their analyses43. It is hardly surprising, therefore, that women are now 50% more likely to develop an adverse reaction to a therapeutic drug than men are40,41,42. Scientists have begun to account for sex differences only in the last decade, often in response to pressure from funding bodies40,41,42. Our hope is that this work brings further attention to the need to account for sex in epidemiological research to better understand the effects of public-health measures for everyone.

Methods

Ecological model

We start with an ecological model of resident host-pathogen dynamics that assumes these populations are, respectively, genetically homogeneous. The ecological model underlies the evolutionary model we develop later. A complete description of the model, and the methods of analysis that follow, can be found in the Supplementary Information.

We consider a population of hosts classified according to their sex and disease status. At time t, there are Si = Si(t) sex-i individuals not infected by the pathogen, but susceptible to future infection (i = f for females, i = m for males). At time t there are also Ii = Ii(t) sex-i individuals who are not only infected with the pathogen but also able to transmit their infection to others. Our specific goal in this section is to develop a mathematical description of how the numbers of hosts in the various classes change over time.

The number of hosts in the population changes as a result of birth events. Following previous work44,45, we model the host mating rate using the harmonic mean of the population sizes of females and males. Assuming a one-to-one birth sex ratio, then newly born hosts of either sex join the population at rate \(\frac{b({S}_{f}+{I}_{f})({S}_{m}+{I}_{m})}{N}\) where b > 0, and N = N(t) denotes the total population size at time t. We assume that newborns produced by susceptible mothers are, themselves, susceptible. By contrast, we suppose that newborns produced by infected mothers acquire their mother’s infection with probability v, where v is what we have called the ‘vertical transmission rate’31. Host number also changes because of death events. Hosts in every class experience natural mortality at per-capita rate μN, where μ is a positive constant. Hosts infected by the pathogen also experience disease-related mortality at per-capita rate αi (a measure of pathogen ‘virulence’) (Fig. 7).

Fig. 7: Compartmental diagram of the ecological model upon which our co-evolutionary model is based.
figure 7

This model incorporates two sexes (females in red and males in blue) and vertical transmission (dashed line). The flow between compartments is represented by arrows and expressions next to each arrow represent the flow rate. Evolving phenotypes and drivers of their evolution are indicated in green and purple, respectively. Source data are provided as a Source Data file.

Numbers of hosts in any particular class changes as their disease-status changes. For example, we allow infected individuals to recover at per-capita rate γi (a measure of host ‘immunocompetence’). We assume that, upon recovery, hosts move immediately into the appropriate susceptible group. In this way, we ignore the possibility that recovery implies immunity to subsequent infection. The disease status of hosts can also change because of horizontal disease-transmission events. We approach horizontal transmission in a standard way and assume that susceptible sex-i hosts acquire the pathogen horizontally from their infected sex-j counterparts at a total rate of SiβijIj. Here, βij is a constant that reflects the transmissibility of the pathogen. We assume that when a host acquires an infection horizontally, it immediately becomes infectious (Fig. 7).

The model described above is summarised mathematically using the following system of differential equations:

$$\frac{d{S}_{f}}{dt}=\frac{b({S}_{f}+(1-v){I}_{f})({S}_{m}+{I}_{m})}{N}+{\gamma }_{f}{I}_{f}-{S}_{f}{\beta }_{ff}{I}_{f}-{S}_{f}{\beta }_{fm}{I}_{m}-\mu N{S}_{f}$$
(1a)
$$\frac{d{S}_{m}}{dt}=\frac{b({S}_{f}+(1-v){I}_{f})({S}_{m}+{I}_{m})}{N}+{\gamma }_{m}{I}_{m}-{S}_{m}{\beta }_{mf}{I}_{f}-{S}_{m}{\beta }_{mm}{I}_{m}-\mu N{S}_{m}$$
(1b)
$$\frac{d{I}_{f}}{dt}=\frac{bv{I}_{f}({S}_{m}+{I}_{m})}{N}+{S}_{f}{\beta }_{ff}{I}_{f}+{S}_{f}{\beta }_{fm}{I}_{m}-({\gamma }_{f}+{\alpha }_{f}+\mu N){I}_{f}$$
(1c)
$$\frac{d{I}_{m}}{dt}=\frac{bv{I}_{f}({S}_{m}+{I}_{m})}{N}+{S}_{m}{\beta }_{mf}{I}_{f}+{S}_{m}{\beta }_{mm}{I}_{m}-({\gamma }_{m}+{\alpha }_{m}+\mu N){I}_{m}.$$
(1d)

Under a reasonable set of conditions, the previous system tends, over time, to an equilibrium state in which infections are endemic.

Co-evolutionary model

To study how pathogen’s disease-induced mortality and the host’s immune system respond to selection, we assume that each faces a life-history trade-off.

First, the pathogen’s ability to transmit horizontally trades off against the duration of any given infection it establishes. Following the previous authors30,46,47, we capture this trade-off by assuming

$${\beta }_{ij}=\beta ({\alpha }_{j})=\frac{{\beta }_{\max }{\alpha }_{j}}{{\alpha }_{j}+d}\quad \,{{\mbox{for}}}\,\,j=f,\;m,$$
(2)

where \({\beta }_{\max },\,d \, > \, 0\) are constants. Equation (2) implies that the nature of the trade-off faced by a pathogen is the same in both female and male hosts. Specifically, a pathogen can only increase its rate of horizontal transmission by increasing the disease-induced mortality rate experienced by its host (which, in turn, reduces the duration of infection). Equation (2) also says the horizontal transmission rate saturates at \({\beta }_{\max }\) (independent of host sex), and does so more quickly as the parameter d is reduced (again, independent of host sex). Note also that Equation (2) does not depend on i: the sex of the susceptible host to whom the pathogen is transmitted.

For their part, hosts face a trade-off between investing resources in their immune system and their reproductive success. Increased immune investment is reflected in an increased recovery rate. To capture the host’s trade-off, then, we treat birth rate b as a decreasing function of the recovery rate. Moreover, we assume that the decrease in b is experienced by the host regardless of its disease status. In other words, we assume that cost associated with the immune system is an ongoing one, incurred mainly because of maintenance27 (this assumption model innate immunocompetence best) rather than being due to the activation that follows an infection48 (this assumption would model adaptive immunocompetence best). As noted in the Discussion, we relax this assumption in the Supplemental Material and compare the results for maintenance and activation costs. As an example, here, we point to evidence that shows female sex hormones enhance the immune system but simultaneously reduce the likelihood of conception and increase the chances of spontaneous abortion49,50,51. In mathematical terms, we capture the host’s trade-off using

$$b=b({\gamma }_{f},{\gamma }_{m})={b}_{\max }\,{e}^{-{c}_{f}{\gamma }_{f}^{2}}\,{e}^{-{c}_{m}{\gamma }_{m}^{2}}$$
(3)

where ci reflects the rate at which fertility is reduced as sex-i immune function is increased (‘cost of recovery’ above). Equation (3) generalises the birth rate functions used previously27,48 to our sex-specific setting. The fact that b in this equation depends on both γf and γm reflects the fact that the reduced fertility of one mate affects the fertility of its partner16.

Our approach to modelling the co-evolution of host and pathogen is rooted in the adaptive-dynamics methodology52,53,54. For the pathogen population, we build a fitness expression that measures the success of a rare mutant strain in a population close to the endemic equilibrium established by the system (1) (indicated as \({\bar{S}}_{i}\), \({\bar{I}}_{i}\), and \(\bar{N}\)). Assuming that the mutant strain of pathogen is associated with a disease-induced mortality rate equal to \({\tilde{\alpha }}_{i}\) in sex-i hosts, the number of mutant infections, \({\tilde{I}}_{i}={\tilde{I}}_{i}(t)\) changes according to

$$\frac{d{\tilde{I}}_{f}}{dt}=\frac{bv{\tilde{I}}_{f}({\bar{S}}_{m}+{\bar{I}}_{m})}{\bar{N}}+{\bar{S}}_{f}\beta ({\tilde{\alpha }}_{f}){\tilde{I}}_{f}+{\bar{S}}_{f}\beta ({\tilde{\alpha }}_{m}){\tilde{I}}_{m}-({\gamma }_{f}+{\tilde{\alpha }}_{f}+\mu \bar{N}){\tilde{I}}_{f}$$
(4a)
$$\frac{d{\tilde{I}}_{m}}{dt}=\frac{bv{\tilde{I}}_{f}({\bar{S}}_{m}+{\bar{I}}_{m})}{\bar{N}}+{\bar{S}}_{m}\beta ({\tilde{\alpha }}_{f}){\tilde{I}}_{f}+{\bar{S}}_{m}\beta ({\tilde{\alpha }}_{m}){\tilde{I}}_{m}-({\gamma }_{m}+{\tilde{\alpha }}_{m}+\mu \bar{N}){\tilde{I}}_{m}.$$
(4b)

The system in (4) is linear and its long-term behaviour is determined by a dominant Lyapunov exponent of the mapping. We capture the information provided by the dominant Lyapunov exponent with the pathogen-fitness function, \({W}_{\alpha }({\tilde{\alpha }}_{f},{\tilde{\alpha }}_{m},{\alpha }_{f},{\alpha }_{m})\) using techniques laid out by the ref. 55 (see also Supplemental Information). When this function is greater than 1 the mutant invades and eventually displaces56 the resident strain associated with the αi phenotype. When the function \({W}_{\alpha }({\tilde{\alpha }}_{f},{\tilde{\alpha }}_{m},{\alpha }_{f},{\alpha }_{m})\) is less than 1 the mutant does not invade and is eliminated from the population. With these facts in mind, we say that selection acts to move αi in the direction given by the sign of \(\frac{\partial {W}_{\alpha }}{\partial {\tilde{\alpha }}_{i}}{\left|\right.}_{\tilde{\alpha }=\alpha }\) where \(\tilde{\alpha }=\alpha\) is shorthand for \({\tilde{\alpha }}_{i}={\alpha }_{i}\) for all i. Specifically, when this partial derivative is positive αi is increasing, and when it is negative αi is decreasing.

We follow a similar procedure for the host population by introducing, into the equilibrium population, a rare mutant-type host genotype that results in a recovery rate of \({\hat{\gamma }}_{i}\) when expressed by sex-i hosts. We denote the numbers of susceptible and infected sex-i mutant-type hosts as \({\hat{S}}_{i}\) and \({\hat{I}}_{i}\), respectively. We assume that hosts are diploid, and so, strictly speaking, the hosts who contribute to \({\hat{S}}_{i}\) and \({\hat{I}}_{i}\) categories are heterozygotes (the numbers of homozygote mutants are negligible). While it remains rare, the dynamics of the mutant-host lineage can be described using

$$\frac{d{\hat{S}}_{f}}{dt}= \frac{\frac{b({\hat{\gamma }}_{f},{\gamma }_{m})}{2}({\hat{S}}_{f}+(1-v){\hat{I}}_{f})({\bar{S}}_{m}+{\bar{I}}_{m})+\frac{b({\gamma }_{f},{\hat{\gamma }}_{m})}{2}({\bar{S}}_{f}+(1-v){\bar{I}}_{f})({\hat{S}}_{m}+{\hat{I}}_{m})}{\bar{N}}\\ +{\hat{\gamma }}_{f}{\hat{I}}_{f}-{\hat{S}}_{f}{\beta }_{ff}{\bar{I}}_{f}-{\hat{S}}_{f}{\beta }_{fm}{\bar{I}}_{m}-\mu \bar{N}{\hat{S}}_{f}$$
(5a)
$$\frac{d{\hat{I}}_{f}}{dt}= \frac{\frac{b({\hat{\gamma }}_{f},{\gamma }_{m})}{2}v{\hat{I}}_{f}({\bar{S}}_{m}+{\bar{I}}_{m})+\frac{b({\gamma }_{f},{\hat{\gamma }}_{m})}{2}v{\bar{I}}_{f}({\hat{S}}_{m}+{\hat{I}}_{m})}{\bar{N}}\\ +{\hat{S}}_{f}{\beta }_{ff}{\bar{I}}_{f}+{\hat{S}}_{f}{\beta }_{fm}{\bar{I}}_{m}-({\hat{\gamma }}_{f}+{\alpha }_{f}+\mu \bar{N}){\hat{I}}_{f}$$
(5b)
$$\frac{d{\hat{S}}_{m}}{dt}= \frac{\frac{b({\hat{\gamma }}_{f},{\gamma }_{m})}{2}({\hat{S}}_{f}+(1-v){\hat{I}}_{f})({\bar{S}}_{m}+{\bar{I}}_{m})+\frac{b({\gamma }_{f},{\hat{\gamma }}_{m})}{2}({\bar{S}}_{f}+(1-v){\bar{I}}_{f})({\hat{S}}_{m}+{\hat{I}}_{m})}{\bar{N}}\\ +{\hat{\gamma }}_{m}{\hat{I}}_{m}-{\hat{S}}_{m}{\beta }_{mf}{\bar{I}}_{f}-{\hat{S}}_{m}{\beta }_{mm}{\bar{I}}_{m}-\mu \bar{N}{\hat{S}}_{m}$$
(5c)
$$\frac{d{\hat{I}}_{m}}{dt}= \frac{\frac{b({\hat{\gamma }}_{f},{\gamma }_{m})}{2}v{\hat{I}}_{f}({\bar{S}}_{m}+{\bar{I}}_{m})+\frac{b({\gamma }_{f},{\hat{\gamma }}_{m})}{2}v{\bar{I}}_{f}({\hat{S}}_{m}+{\hat{I}}_{m})}{\bar{N}}\\ +{\hat{S}}_{m}{\beta }_{mf}{\bar{I}}_{f}+{\hat{S}}_{m}{\beta }_{mm}{\bar{I}}_{m}-({\hat{\gamma }}_{m}+{\alpha }_{m}+\mu \bar{N}){\hat{I}}_{m}.$$
(5d)

The birth terms in the preceding system of equations reflect (a) the fact that the mutant host, while it is rare, mates only homozygous resident hosts and (b) only half of the matings between heterozygous mutants and homozygous residents result in mutant offspring. Since the dynamics described by (5) are linear, we can again measure fitness (this time for the host) using the dominant Lyapunov exponent. We summarise the relevant information contained in this exponent with the host fitness function \({W}_{\gamma }({\hat{\gamma }}_{f},{\hat{\gamma }}_{m},{\gamma }_{f},{\gamma }_{m})\), again using techniques outlined by ref. 55. In keeping with the description of pathogen evolution, we assert that the host’s γi is increasing when \(\frac{\partial {W}_{\gamma }}{\partial {\gamma }_{i}}{\left|\right.}_{\hat{\gamma=\gamma }}\) is positive, and decreasing when this partial derivative is negative, where \(\hat{\gamma }=\gamma\) is shorthand for \({\hat{\gamma }}_{i}={\gamma }_{i}\) for all i.

We want to identify where the action of selection takes the resident pathogen and host traits (γi and αi, respectively) in the long term. As mentioned above, the model is too complicated to support exact mathematical predictions. Consequently, our methods rely on numerical simulation implemented in Matlab57. All Matlab code is publicly available (see Code Availability).

The numerical simulation takes as its input a set of parameters and an initial estimate of the long-term result of selection on co-evolution of pathogen and host \({\alpha }_{i}^{*}\), and \({\gamma }_{i}^{*}\) for i = f, m. The estimate is updated by (i) finding the corresponding equilibrium solution to Equation (1) in a manner that verifies its asymptotic stability, (ii) using that equilibrium solution to estimate partial derivatives \(\frac{\partial {W}_{\alpha }}{\partial {\tilde{\alpha }}_{i}}{\left|\right.}_{\tilde{\alpha=\alpha }}\) and \(\frac{\partial {W}_{\gamma }}{\partial {\hat{\gamma }}_{i}}{\left|\right.}_{\hat{\gamma=\gamma }}\) for i = f, m, and finally (iii) incrementing or decrementing elements of the estimate following the sign of the appropriate partial derivative. Steps (i)–(iii) are repeated until the absolute value of all partial derivatives is within a tolerance of zero. The result of the simulation is an estimate of the convergence stable58,59 co-evolutionary outcome, assuming αf and αm, and γf and γm can be adjusted independently. Importantly, this predicted co-evolutionary outcome also corresponds to a system in which the pathogen is established in a stable equilibrium population of hosts.

Finally, we verified numerically that the convergence-stable estimate corresponded to a two-dimensional evolutionarily stable result60 for pathogen and host, respectively. For this reason, we can also refer to predictions generated by our numerical simulation as a continuously stable state, in analogy to the definition established by ref. 61.

Reporting summary

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