# Time is running out to catch COVID-19

Your best chance for survival is to *catch COVID-19 now*.
But the window of opportunity is closing!
In approximately two weeks,
the rational strategy will switch from *catch it now*
to *avoid it forever*.
In this post, I show a compartmental simulation of COVID-19,
with interactive parameters that you can play with.
I show a nice “backpropagation” algorithm
that calculates death probabilities in compartmental models,
which lets us analyze optimal selfish strategies.
I find that there are four phases during epidemics,
each with its own optimal strategy.

The following chart shows how likely a person is to be dead by the end of the year, given their current state. For example, on day 8, a person in the “infected with treatment” state has a 2.5% chance of being dead by day 365. But on the same day 8, a person in the “susceptible” state has a full 5% chance of being dead by day 365! It follows that the “susceptible” person should choose to deliberately become infected, to improve their chance of survival!

According to the simulation, which I explain more fully below, it’s rational to infect yourself right now. Intuitively, this is because you’ll get better treatment while our healthcare system is still functioning. But there are in fact four phases of the epidemic, and the strategy is different in each phase. By tracing the blue “susceptible” line in the chart, and observing where it crosses the other lines, we derive the four phases:

**Phase 1: you should infect yourself, getting treatment.**Before the peak, you should infect yourself to get treatment while our healthcare system is still functioning. We’re currently in this phase.**Phase 2: you should still infect yourself, foregoing treatment.**Phase 2 begins when the healthcare system hits capacity, and there are no more beds. In the chart, the red line “infection without treatment” makes its appearance. Surprisingly, for a brief time, it is still rational to infect yourself, and go without treatment! This is because infected people are given priority when beds are freed up, so it’s likely that you will soon get treatment.**Phase 3: you should avoid infection (unless you can jump the queue).**After a short time, there are so many people waiting for treatment that it’s no longer rational to join the “queue”. But during this phase, it’s still rational to infect yourself, if you’re given the unlikely opportunity to get treatment – maybe you can join a clinical trial, or maybe your relative donates their treatment to you.**Phase 4: you should avoid infection forever.**Eventually, the blue “susceptible” line dips under the the “infected with treatment” line. Beyond this point, it’s irrational to infect yourself, even if you can get treatment. You’re better off gambling that you’ll never get the infection, because “herd immunity” makes it unlikely.

Now I show how I simulated the epidemic. Every simulated person is in one of five states: “susceptible”, “infected with treatment”, “infected without treatment”, “recovered”, or “dead”. Each day, people transition between these states like so:

We start the simulation with everyone in the “susceptible” state, except for one person with the novel virus. Each day, people meet each other, through which susceptible people may become infected. Unfortunately, there is a limited number of beds to provide treatment! Infected people either die or recover, but the chance of dying is reduced by receiving treatment. When an infected person dies or recovers, their bed is given an infected person waiting for treatment. There are many parameters in this model, which I’ve attempted to set to the known characteristics of COVID-19, but you can play with them yourself:

The following chart shows the proportion of the population in each state. It should look familar; especially the red curve of infected people. This is the curve that we should be “flattening” to reduce the total death rate. Use the sliders above to flatten the curve by reducing meetings, or by reducing the probability of transmission (e.g., with masks).

We can generate the above population chart by running the model. We end up with a graph like the following (note that I’ve simplified the model for clarity). Each vertex counts the number of people in a given state on a given day, and each edge counts the number of people transferred from one state to another:

But how can we generate the “death probability” chart from this?
Say Bob asks you:
“It’s day 2, and I’m susceptible;
what’s my chance of being dead at the end of the year?”
You could answer this by running the model *forwards*,
keeping track of the probability distribution of Bob’s possible states
on day 2, then day 3, then day 4.
But then to generate our entire “death probability” chart,
you need to run this procedure for every combination of state and day.
That’s very expensive!

Fortunately, I found a more efficient backpropagation-style algorithm!
First, we run the model forwards, as before,
keeping a record of all the transfers of people from one state to another.
Then we run the model *backwards*.
We’ll get a graph that looks like this:

We’ve labelled each node with the probability of ending up dead on day 3
(the bottom-right corner).
For example, “susceptible” on Day 2 has a 1/128 chance of dying.
Labelling day 3 is our easy base-case.
The dead state is 1, i.e. certain to be dead;
all other states are 0, i.e. certain to survive, because they survived.
Then, to generate a previous day’s probabilities,
each node is a *weighted sum* of the previous nodes on the following day.
For example, 1/128 is the weighted sum (87/96 × 0) + (9/96 × 1/12).

Now for some commentary. Notice that the individual selfish strategy of getting infected is in conflict with the the group strategy of avoiding infection to “flatten the curve”. This makes it an example of a social dilemma, like overfishing, or not voting.

Despite this dilemma,
no one appears to be deliberately infecting themselves with COVID-19.
Perhaps the model is wrong, and self-infection is not actually rational.
Or perhaps the model is right, but people don’t act like *homo economicus*.
It’s a moral argument:
I’m self-isolating,
not for my own protection,
but for the good of the population.
At least, that’s what I tell myself.
Maybe it’s just because
my friends would call me a moron if I self-infected.

### More by Jim

- Time is running out to catch COVID-19
- The inception bar: a new phishing method
- The hacker hype cycle
- Project C-43: the lost origins of asymmetric crypto
- How Hacker News stays interesting
- My parents are Flat-Earthers
- The dots do matter: how to scam a Gmail user
- The sorry state of OpenSSL usability
- I hate telephones
- The Three Ts of Time, Thought and Typing: measuring cost on the web
- Granddad died today
- Your syntax highlighter is wrong

Tagged #programming, #epidemiology, #fave. All content copyright James Fisher 2020. This post is not associated with my employer. Found an error? Edit this page.