Modeling contagion

Two years after the beginning of the COVID-19 pandemic, due to the SARS-CoV-2 virus, we have all become (pseudo)-experts in contagion models. But beyond diseases, these models based on networks of interactions between people are also commonly used to describe the spread of a computer virus, of social norms, of an idea or a rumor in a society, or of an economic crisis, as Kucharski (2020) reminds us.

(this is the English tranlation of a post published in April 2022)

The spread of an infectious disease, such as influenza, is modeled, at the individual level, by the fact that an individual carrying the disease can transmit it to a healthy individual during physical contact. At the level of a region or a country, the aggregation is modeled by taking into account the dynamics of these contacts, taking into account the fact that each individual is potentially in contact with hundreds or thousands of others. But this approach is a bit too simplistic, because an epidemic will not necessarily resemble another one that has been observed and studied in the past.

Infectious diseases

The word “influenza” comes from the Old Frankish (a variant of grip, or grif) and in French refers to the viral infection of the respiratory tract associated with the “influenza virus” (the name “influenza” is found in Italy and England). The Latin word “influentia” means “flowing in”, because in the Middle Ages, it was believed that the immaterial fluid emitted by the stars affected humans. The Italian flu referred to any epidemic of disease that was supposedly influenced by the stars. It was around 1750, following an epidemic that crossed Europe that the Italian word was adopted by the English. To continue the linguistic digression, holding certain communities responsible for epidemics is not a new phenomenon. In the sixteenth century, the English thought syphilis came from France and called it “French pox”, as did the Germans who spoke of “Französische Krankheit”, as did the Spanish, “el mal Francés”. The French, believing that it came from Naples, called it the “Neapolitan disease”, following an epidemic in 1495 in Naples, probably brought by Spanish sailors from the crew of Christopher Columbus. In the Netherlands, “Spaanse pokken” (otherwise known as “Spanish smallpox”) would be used, as Frith (2012) reminds us. The Czech expression “uherská nemoc” speaks of Hungarian disease, in Russia it was Polish disease, “польская болезнь”, in Poland it was Turkish, and in Turkey and Greece it was Christian, etc. More recently, let’s remember that we still refer to the influenza pandemic of 1918, which killed tens of millions of people around the world, as the “Spanish flu”. If Kucharski (2020) recalls that if in Spain it was called “gripe francesa” (the “French flu”), it is mainly because in Germany, England and France, the authorities suppressed information about the disease, for fear that it would undermine the morale of the troops, which for a long time led to the belief that Spain had many more cases than other European countries.

But more than influenza, it was malaria that allowed the development of the first contagion models. Etymologically, “malaria” comes from the medieval Italian “mala aria”, the bad air. It was not until the end of the 19th century that a parasite called Plasmodium was identified, discovered first by Alphonse Laveran and then by Ronald Ross (both of whom won a Nobel Prize for their work in the early 20th century), and linked to mosquitoes. The British geographer Richard Burton noted that in Somalia, mosquito bites were often said to cause deadly fevers. British doctors were centuries behind Chinese doctors, for as early as the fourth century (A.D.), Ge Hong had found plants that could reduce fevers (extracts from this plant are the basis of modern malaria treatments today). And if we go back even further in time, the Roman physician Quintus Serenus Sammonicus, had proposed another remedy: people who wanted to be cured had to write the word “abracadabra” on a piece of paper, bind the paper, wrap it in linen and wear it like a talisman around the neck for nine days (after which they should throw it over the shoulder into a river flowing eastwards, as the Liber Medicinalis requires).

Models of contagion

Mathematical models such as Ronald Ross’ two have often had the reputation of being complicated, but they had the advantage of being true “models” of reality. For public health is very different from simple biological modeling. Because if a health agency wants to understand how effective its disease control strategy has been, it cannot go back and repeat the same epidemic without a model. Only a model can provide a counterfactual. He wrote in 1911, “epidemiology is in fact a mathematical subject (…) and fewer absurd mistakes would be made regarding it (for example, those regarding malaria) if more attention were given to the mathematical study of it”. But it is above all the work of William Kermack and Anderson McKendrick, in the 1920s, that revolutionized epidemiology. Contrary to bio-statisticians, such as Karl Pearson who used statistics and a simply descriptive analysis, they proposed to use mechanistic methods, allowing to understand the transmission process. This is how they developed the SIR compartmental model, whose evolution is based on differential equations. This approach allowed to have a simple model, explaining the main trends in the evolution of an epidemic. For example, the concept of herd immunity will become popular several decades later, when it was realized that it can be an important tool for disease control. Indeed, during an epidemic, people naturally leave the group of susceptible S’s as they become infected, and move into group I. After becoming ill, they move into group II. After becoming ill, they move into the recovered group, noted R (for “recovered”). Vaccination (known since the beginning of the 19th century) thus makes it possible to move directly from S to R. The theory of herd immunity guarantees that the spread of a contagious disease can be stopped in a population if a sufficiently large proportion of individuals are in the R group (around 90% for measles, 95% for whooping cough and 85% for smallpox). As noted by Fine (1993), according to the SIR model, epidemics need three elements to take off: a sufficiently infectious pathogen, many interactions between different individuals and a sufficient proportion of the population that is susceptible. Near the critical threshold of herd immunity, a small change in any of these factors can make the difference between a handful of cases and a major epidemic.

In the 1950s, George MacDonald improved on Ross’s model, again in the context of understanding malaria, but it was Klaus Dietz who popularized the “reproduction number”, denoted R0. R0 represents the number of new infections that a typical infectious person is expected to generate on average. This quantity, specific to each pathogen, tells us whether we should expect a major epidemic or not. If R0 is less than one, each infectious person will generate on average less than one additional infection, so we can expect the number of cases to decrease over time. On the other hand, if R0 is greater than one, the level of infection will increase on average, creating the potential for a large epidemic. Some diseases have a relatively low R0. For pandemic influenza, R0 is typically around 1 to 2, which is consistent with the level of Ebola during the early stages of the 2013-16 epidemic in West Africa. On average, each Ebola case transmitted the virus to one or two other people. Other infections can spread more easily. The SARS virus, which caused outbreaks in Asia in 2003, had an R0 between 2 and 3. Smallpox, which remains the only eradicated human infection, had an R0 between 4 and 6, whereas a single case of measles can generate more than 20 new infections on average (and thus has an R0 of about 20, as noted by Guerra et al. (2003)). This parameter indicates the speed at which the epidemic will develop, as we showed in Charpentier & Barry (2020). Indeed, with an R0 of 2, we expect 2^5=32 new cases at the fifth generation of the epidemic. If R0 were 3 instead of 3, we would expect 3^5=243 new cases at the same date.

This parameter is also related to the threshold for herd immunity, which is 1-1/R0, i.e., if R0 is about 20 (as may be the case for measles), 19 out of 20 people, or more than 95% of the population, need to be vaccinated to stop outbreaks. Note that there are four factors that influence the value of R0: the length of time a person is infectious; the average number of opportunities he or she has to spread the infection on each day he or she is infectious; the probability that an opportunity will result in transmission; and the average susceptibility of the population. We then have a relationship of the form:

R = Duration × Opportunities × Probability of transmission × Susceptibility.

More recently, Pareto type models have emerged to describe the evolution of pandemics, following the renewed interest in the discipline with HIV in the 1980s and 1990s. Woolhouse et al (1997) spoke of the “20/80 rule”, whereby 20% of cases were responsible for about 80% of transmission. A few years later, the notion of “superspreading” was introduced, with certain cases generating a very large number of transmissions. Surprisingly, these ideas can be found (between the lines) in Ronald Ross, who went much further in modeling the spread of pathogens, introducing an “event theory” to describe how the number of people affected by a disease can evolve over time. Specifically, he suggested that there were two main types of events. The first type affects people independently: if an event happens to you, it generally does not increase or decrease the chances that it will happen to someone else later on. This is the case for non-infectious diseases, or for accidents as they can be modeled in actuarial science, when independence is assumed. Independent events are a natural starting point for modeling, but things get more interesting when the events are contagious. Ross calls these types of events “dependent events,” because what happens to one person depends on how many others are affected. The simplest type of event is one in which affected people transmit the disease to others, and once affected, people stay affected.

In the SIR dynamics, this translates into the fact that the change in the number of infected persons dI(t)/dt is proportional to the product of I(t), the number of infected persons, and S(t), the number of susceptible persons. Initially, the number of people affected grows exponentially, with the number of new cases increasing faster and faster over time, but after a while, the number of susceptible people becomes small, the growth slows down and stabilizes. This is the logistic model of Pierre François Verhulst, which we discussed in Charpentier (2022), with an “S-shaped curve”, as Rogers (1983) would call it to describe the diffusion of innovation, with a sociologist’s eye. For Everett Rogers, four different types of people are responsible for the growth of a product: initial adoption comes from “innovators”, followed by “early adopters”, then the majority of the population, and finally “laggards”. As we are beginning to see, contagion models will be able to explain all sorts of behavior.

The economy and the crises

In the mid-1990s, we began to speak of “financial contagion” to describe the spread of economic problems from one country to another, as during the Asian financial crisis, to use the analysis of Allen & Gale (1999). But it was two events in particular that marked the markets. The first was the failure of funds such as LTCM Long Term Capital Management – which persuaded central banks that they had to understand the entanglement of financial exchanges. In May 2006, for example, the Federal Bank of New York organized a conference to discuss “systemic risk” and contagion. It wanted to identify the factors that could affect the stability of the financial network, in particular the indirect shock waves that spread to other markets. For, having lent a lot to LTCM, many banks were also at risk. But above all, the rise of complex financial products such as CDOs, collateralized debt obligations, has raised awareness of the contagion mechanisms in the credit markets. As Laurent & Gregory (2004) remind us, correlation is far from constant, and increases in the tails of distributions (the famous “correlation smile”).

Tavakoli (2007) stated that “in the credit markets, we want to blame correlation or correlation smiles as correlation laughs at our efforts to model it (…) correlation trading has spread through the psyche of the financial markets like a highly infectious thought virus. In the summer of 2008, despite numerous warnings, the fall in housing prices, on which the mortgages were based, caused an unprecedented crisis.

As suggested by Peckham (2013), inspired by May, Levin & Sugihara (2008), many financial and economic crises can be reviewed using contagion models. The price curves, showing the rise of financial assets and the subsequent crash resemble the typical rise and fall of cases in a measles epidemic, or other infection. The main difference is that when an infectious disease epidemic increases, it is bad news, and when it decreases, it is good news. In contrast, rising financial prices are generally considered good news and falling financial prices are bad news. What if rising prices are not always a good sign? The concern is that identifying such “speculative bubbles” can be complex. Indeed, investors may be leveraging their transactions, borrowing money to cover additional investments. It is then difficult to estimate the phase of the bubble we are in. Nevertheless, it sometimes seems possible to spot the signals of unsustainable growth. When the Internet bubble developed in the late 1990s, a common justification for price increases was simply that Internet traffic was doubling every 100 days. It seemed justified that companies were valued at hundreds of billions of dollars, and investors kept pumping money into ISPs based on this exponential growth (WorldCom comes to mind, for example). But if we think back to the ITS model, this increase in the number of users translates into a significant decrease in the number of susceptible people.

For Andrew Hadane, Chief Economist of the Bank of England, when comparing pandemics and financial crises “similarities are striking”. But in the case of an infectious disease, people may wash their hands more often or reduce their social interactions. In finance, banks can hide by hoarding money rather than risk lending to other institutions. But when banks hoard money, it can amplify problems, as happened with the “credit crunch” in the run-up to the 2008 crisis. And thinking of the banking system in terms of a network of interconnections has led to a better understanding of contagion, as shown by Soramäki et al. In a so-called assortative network, highly connected individuals are primarily linked to other highly connected individuals. The result is an epidemic that spreads rapidly through these groups of high-risk individuals, but struggles to reach the other, less connected parts of the network at the edge. Conversely, a “de-assorted” network is one in which high-risk individuals are primarily connected to low-risk individuals. The infection then spreads more slowly at first, but leads to a larger overall epidemic. And the banking network turned out to be de-assorted. A large bank like Lehman Brothers could therefore spread the contagion widely. As Haldane & May (2011) pointed out, when Lehman Brothers failed, it had trading relationships with over a million counterparties. “It was entangled in this mesh of exposures – derivatives and cash – and no one had the faintest idea quite who owed what to whom.” In 2009, it was Warren Buffett who warned against the “frightening web of mutual dependence”, using HIV as a metaphor, “it’s not just who you sleep with, but also who they are sleeping with”. When one bank lends money to another, it creates a tangible link between the two: if the borrower fails, the lender loses its money. In theory, we could trace this network to understand the risk of epidemics, just as researchers have been able to do with sexually transmitted diseases. The difference is that in the financial world, banks have long sought to diversify to reduce their overall risk. By holding a wide range of investments, the bank seems to gain stability. But when multiple banks invest in the same asset, it creates a potential transmission path between them.

If a crisis occurs and one bank starts selling its assets, it will affect all the other firms that hold those investments. The more large banks diversify their investments, the greater the potential for shared contagion. Arinaminpathy, Kapadia, and May, (2012) have thus shown that when a financial crisis occurs, diversification can destabilize the network. And the recent financial crises have clearly shown that “too big to fail” is not a grid, the important thing is “too central to fail”.

What about cyber risk?

On May 12, 2017, a piece of software called WannaCry began holding thousands of computer users to ransom. It first blocked users’ access to their files, then posted a message telling them they had three days to transfer $300 in bitcoins to an anonymous account. If users refused to pay, their files would be permanently locked. And when it hit the computers of Britain’s National Health Service, the NHS, it led to the cancellation of thousands of appointments. In the space of a few days, more than 200,000 computers in a hundred countries were affected, resulting in damage estimated at several billion dollars. We can start by noting that unlike biological infections, which can take days or weeks to develop, these infections can occur on much faster time scales, within hours. The Mirai and WannaCry outbreaks doubled in size every 80 minutes.

The first computer virus to spread outside of a laboratory network was born in February 1982. Called “Elk Cloner,” created by Rich Skrenta, a 15-year-old high school student in Pennsylvania, spread when people exchanged games between computers. Because the computers were not networked, the computer viruses were very similar to biological infections, spreading on floppy disks. Although it hit the computer of a friend of Rich’s who worked for the U.S. Navy, the virus did not circulate much outside a circle of friends. And this virus was relatively harmless (Leyden (2012) reports that it merely displayed a short poem on the screen), viruses quickly evolved. As early as 1984, a distinction was made between viruses and worms. The latter could multiply and spread without attaching to other programs. In 1988, the “Morris Worm”, created by Robert Morris, a student at Cornell, spread rapidly on ARPANET, the forerunner of the Internet. Robert Morris claimed that the worm was supposed to spread silently, in order to estimate the size of the network. Unfortunately, a mutation, a small change in its code, would soon cause big problems. Morris originally coded his worm so that when it reached a new computer, it would first check if the machine was already infected (to avoid installing multiple worms). This approach made it easy for users to block the worm by inoculating it: by mimicking an infection, it was possible to protect oneself. To get around this problem, Morris made the worm duplicate itself sometimes even if the machine was already infected. But he underestimated the effect this would have, with many infected machines becoming unusable. The worm eventually affected 6,000 computers (10% of the Internet at the time).

Less than a day after the Mirai outbreak began in August 2016, nearly 65,000 devices had been infected. At its peak, more than half a million machines were infected, before its size diminished in early 2017. As with the Morris worm, its creators didn’t expect the outbreak to get so out of control. When the FBI traced its origins, it found that it started with a 21-year-old student, Paras Jha, and two of his friends creating a “distributed denial of service attack” (DDoS) in Minecraft, allowing it to slow down other players’ connections. But soon, the virus left Minecraft. On September 30, 2016, Mirai’s source code was published on an Internet forum. This is a common tactic used by hackers, because if the code is publicly available, it’s harder for authorities to nail its creators. The strength of Mirai and WannaCry is that they were very effective at finding vulnerable machines. For comparison, measles, one of the most contagious human infections, it is accepted that in a susceptible population, a person with measles will infect 0.1 other person per hour on average (based on an R0 of about 20 and an infectiousness of 8 days).

Older people may remember the e-mail messages with the subject “ILOVEYOU” in May 2000. The message contained a computer worm, disguised as a text file containing a love letter. Once opened, the worm began corrupting files on the person’s computer and sent itself to everyone in their address book. It spread widely, bringing down the email systems of several organizations, including the British Parliament. And strangely enough, this worm remained present in computers all over the world for a very long time, instead of disappearing, as we should have expected with a biological virus. Alessandro Vespignani and Romualdo Pastor-Satorras showed that if computer viruses did not behave like biological epidemics, it was probably because of the structure of the Internet network. Because of the enormous variability in the number of links between computers, even apparently weak infections can survive. A computer is never more than a few steps away from a highly connected server, which can spread the infection far and wide, then acting as a “superspreader.” Also, on February 28, 2017, when Amazon Web Services (AWS) took several of its servers offline, thousands of people had concerns, largely due to connected objects (light bulbs, doors) that stopped working. Same when Facebook announced that millions of its users had been affected by a security breach on September 28, 2018. Since many people use their Facebook accounts to log into other websites, such attacks can have consequences that users could not imagine.

The similarity to biological viruses can go even further because malware can evolve over time and become harder to detect. Rather than settling into a balanced equilibrium, the ecosystem of computer viruses and anti-virus software would continually shift, as biological theories of evolution and the genetic approach to disease show. A common way to protect against malware is to have antivirus software scan for known threats. Typically, this involves searching for familiar code segments; once a threat is recognized, it can be neutralized. The human immune system works in a relatively similar way. But evolution (also known as mutation) can interfere with this process, with pathogens that once seemed familiar changing their appearance to escape detection. This is the case of influenza, for example, with a pair of proteins on the surface of the virus called hemagglutinin HA and neuraminidase NA. HA allows the virus to cling to host cells, while NA helps release new virus particles from infected cells. The proteins can take many different forms, and the different types of influenza – such as H1N1, H3N2, H5N1, etc. – can have different viruses. Winter flu epidemics are mainly caused by H1N1 and H3N2 viruses, and these viruses gradually evolve during their circulation, which leads to a change in the shape of these proteins. Our immune system no longer recognizes the mutated virus as a threat, resulting in annual flu epidemics. This type of behavior has been observed in computer viruses.

Contagion and fake news…

Kucharski (2020) shows that contagions are everywhere when there are human groups (but also in animals). This is the case of yawning, itching, or laughing. These social chain reactions can spread on very rapid time scales. But often, understanding the contagion is complex. Do you like a certain activity because your friend likes it, or are you friends because you both like that activity? Sociologists have called this a “reflection problem”, where one explanation may reflect another, as Manski (1993) put it. Our friendships and behaviors will often be correlated, but it can be very difficult to show that there is a contagion, which seems to reflect a strong causal mechanism. And understanding how information is shared in a network is important for deciphering the contagion of rumors and conspiratorial ideas whose consequences can be dramatic.

Allen, F., & Gale, D. (1999). The Asian crisis and the process of financial contagion. Journal of Financial Regulation and Compliance.
Arinaminpathy, N., Kapadia, S., & May, R. M. (2012). Size and complexity in model financial systems. Proceedings of the National Academy of Sciences, 109(45), 18338-18343.
Buffett W. (2009) Letter to the Shareholders of Berkshire Hathaway Inc., 27 February 2009.
Charpentier, A. (2019). Les réseaux pour réinventer l’assurance? Risques, 117, 95-99
Charpentier, A. & Barry, L. (2020). Concilier risques collectifs et décisions individuelles. Risques, 123, 122-128
Charpentier, A. (2022). Le tabou de l’exponentielle. Risques,129, 129-134.
Fine, P. E. (1993). Herd immunity: history, theory, practice. Epidemiologic reviews, 15(2), 265-302.
Frith, J. (2012). Syphilis-its early history and treatment until penicillin, and the debate on its origins. Journal of Military and Veterans Health, 20(4), 49-58.
Guerra, F. M., Bolotin, S., Lim, G., Heffernan, J., Deeks, S. L., Li, Y., & Crowcroft, N. S. (2017). The basic reproduction number (R0) of measles: a systematic review. The Lancet Infectious Diseases, 17(12).
Haldane A. (2009) Rethinking the Financial Network, Bank of England, 28 April 2009.
Haldane A. & May R.M. (2011) The birds and the bees, and the big banks, Financial Times, 20 February 2011.
Kucharski, A. (2020). The Rules of Contagion: Why Things Spread–And Why They Stop. Basic Books
Laurent, J. P., & Gregory, J. (2004). In the core of correlation. Risk, 17(10), 87-91.
Leyden J. (2012) The 30-year-old prank that became the first computer virus, The Register, 14 December 2012.
Manski C. (1993) Identification of Endogenous Social Effects: The Reflection Problem. Review of Economic Studies, 60(3), 531-542.
May, R, Levin, S.A and Sugihara, G. (2008) Complex systems: Ecology for bankers. Nature, 451: 893-895.
Pastor-Satorras R. and Vespignani A. (2001) Epidemic Spreading in Scale-Free Networks, Physical Review Letters, 86(14), 3200.
Peckham, R. (2013) Economies of contagion: financial crisis and pandemic, Economy and Society, 42:2, 226-248
Rogers E.M. (1983) Diffusion of Innovations. Collier Macmillan.
Ross, R. (1911). The mathematics of malaria. British Medical Journal, 1(2626), 1023.
Soramäki, K., Bech, M. L., Arnold, J., Glass, R. J., & Beyeler, W. E. (2007). The topology of interbank payment flows. Physica A: Statistical Mechanics and its Applications, 379(1), 317-333
Tavakoli J. (2007) Comments on SEC Proposed Rules and Oversight of NRSROs, Letter to Securities and Exchange Commission, 13 Février 2007.
Woolhouse, M. E., Dye, C., Etard, J. F., Smith, T., Charlwood, J. D., Garnett, G. P. & Anderson, R. M. (1997). Heterogeneities in the transmission of infectious agents: implications for the design of control programs. Proceedings of the National Academy of Sciences, 94(1), 338-342


Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.