## Sunday, June 7

### Checking in on how nations are coping with COVID-19

It has been some five months since the COVID-19 pandemic dawned on people's consciousness and three months since many nations went into some form of compulsory social distancing to help manage the pandemic. In this context, I thought it time to reflect on how nations have performed.

This required me to establish a benchmark for measuring success. For this I have selected four factors:
• how bad did the pandemic get at its peak in the nation (indicated by daily new deaths and daily new cases)
• how bad is the pandemic currently (indicated as aboved)
• how well have nations done in reducing the pandemic from its peak (as a proportion of that peak in daily new deaths and daily new cases)
• what is the case fatality rate for the nation (total deaths over total cases).

The population and COVID data I used for this analysis comes from the European Centre for Disease Prevention and Control.

For simplicity, I will limit my analysis to nations with a population of at least 1 million people.

To enable comparability between large and small nations, I am going to focus on cases and deaths per million population.

As I am working with noisy administrative data, I will do the analysis based on a 14-day rolling average. This irons out the tendency in many nations to under-report on weekends. It also helps reduce the impact of data spikes when nations fess up to additional deaths or cases not previously recorded.

Because the distributions of these data can have nation-states bunched around certain data points, with long tails and outliers, I have decided the group the data into quintiles (5 equal groups), and create an index score from averaging the quintile result across the seven categories:
• average daily new cases per capita at each nation's peak peak
• the most recent result for average daily new cases per capita
• the percentage decline from the peak average daily new cases per capita and now
• average daily new deaths per capita at the peak
• the most recent result for average daily new deaths per capita
• the percentage decline from the peak in average daily new deaths per capita and now
• the case fatality ratio

Before we get to the per-capita charts, let's quickly identify our top ten:
• Top 10 current cases per million population: Qatar, Bahrain, Chile, Kuwait, Peru, Armenia, Oman, Brazil, Belarus, and Panama
• Top 10 national peak cases per million population: Qatar, Bahrain, Chile, Kuwait, Peru, Spain, Ireland, Singapore, Armenia, and Oman
• Top 10 current deaths per million population: Sweden, Brazil, Peru, United Kingdom, Mexico, Chile, United States, Canada, Panama, Armenia
• Top 10 national peak deaths per million population:  Belgium, Spain, France, United Kingdom, Italy, Ireland, Sweden, Netherlands, United States, Ecuador

The following charts show the per-million-population daily cases and deaths data for selected nations. I should note that as the cases data for Qatar is such an outlier, I have adjusted the y-scale in the other case charts where Qatar in not highlighted.

Which brings us to the score for each nation, reflected in the choropleth map at the top of this post:
Sweden                          4.857143
Mexico                          4.857143
Panama                          4.714286
Brazil                          4.714286
Moldova                         4.714286
Peru                            4.714286
Armenia                         4.571429
North Macedonia                 4.571429
Guatemala                       4.428571
South Africa                    4.428571
Canada                          4.428571
Bolivia                         4.428571
United States                   4.428571
Chile                           4.428571
United Kingdom                  4.428571
Colombia                        4.428571
Iran                            4.285714
Oman                            4.285714
Mauritania                      4.285714
Ecuador                         4.285714
Honduras                        4.142857
Kuwait                          4.142857
Saudi Arabia                    4.142857
Russia                          4.142857
Qatar                           4.142857
Portugal                        4.142857
Bahrain                         4.142857
Argentina                       4.000000
Romania                         4.000000
Egypt                           4.000000
Belgium                         4.000000
Netherlands                     4.000000
Dominican Republic              3.857143
Pakistan                        3.857143
Azerbaijan                      3.857143
Iraq                            3.857143
Ireland                         3.857143
Italy                           3.857143
Belarus                         3.857143
Puerto Rico                     3.857143
France                          3.857143
Gabon                           3.714286
Nicaragua                       3.714286
Poland                          3.714286
Afghanistan                     3.714286
United Arab Emirates            3.714286
Spain                           3.571429
Bulgaria                        3.571429
Ukraine                         3.571429
Cameroon                        3.571429
Denmark                         3.571429
Yemen                           3.571429
El Salvador                     3.571429
Turkey                          3.571429
Bangladesh                      3.571429
Sudan                           3.428571
Bosnia And Herzegovina          3.428571
Guinea Bissau                   3.428571
Haiti                           3.428571
Kyrgyzstan                      3.428571
Estonia                         3.428571
Finland                         3.428571
Austria                         3.428571
Germany                         3.428571
Mali                            3.285714
Central African Republic        3.285714
Kazakhstan                      3.285714
Philippines                     3.285714
Indonesia                       3.285714
India                           3.285714
Hungary                         3.285714
Algeria                         3.285714
Equatorial Guinea               3.285714
South Sudan                     3.285714
Lithuania                       3.285714
Israel                          3.142857
Somalia                         3.142857
Kenya                           3.142857
Switzerland                     3.142857
Czechia                         3.142857
Senegal                         3.000000
Albania                         3.000000
Slovenia                        3.000000
Liberia                         3.000000
Sierra Leone                    3.000000
Serbia                          3.000000
Cote D'Ivoire                   2.857143
Chad                            2.857143
Singapore                       2.857143
Eswatini                        2.857143
Tajikistan                      2.857143
Norway                          2.714286
Nigeria                         2.714286
Venezuela                       2.714286
Croatia                         2.714286
Libya                           2.714286
Uruguay                         2.714286
Kosovo                          2.714286
Congo                           2.714286
Latvia                          2.714286
Nepal                           2.714286
Guinea                          2.571429
Democratic Republic Of Congo    2.571429
Greece                          2.571429
Ethiopia                        2.571429
Syria                           2.428571
Lebanon                         2.428571
Ghana                           2.428571
Japan                           2.428571
Malawi                          2.285714
Sri Lanka                       2.285714
South Korea                     2.285714
Cuba                            2.285714
Morocco                         2.285714
Togo                            2.285714
Madagascar                      2.285714
Jamaica                         2.142857
Georgia                         2.142857
Mozambique                      2.142857
Uzbekistan                      2.142857
Rwanda                          2.142857
Cyprus                          2.142857
Malaysia                        2.000000
Palestine                       2.000000
Tunisia                         2.000000
Trinidad And Tobago             2.000000
Costa Rica                      2.000000
Angola                          2.000000
New Zealand                     2.000000
Niger                           2.000000
Paraguay                        2.000000
China                           1.857143
Burkina Faso                    1.857143
Zimbabwe                        1.857143
Mauritius                       1.857143
Slovakia                        1.714286
Benin                           1.571429
Botswana                        1.571429
Mongolia                        1.571429
Burundi                         1.571429
Uganda                          1.571429
Australia                       1.571429
Lesotho                         1.571429
Myanmar                         1.428571
Zambia                          1.428571
Gambia                          1.428571
Thailand                        1.428571
United Republic Of Tanzania     1.428571
Jordan                          1.428571
Namibia                         1.285714
Taiwan                          1.142857
Vietnam                         1.000000
Cambodia                        1.000000
Laos                            1.000000
Timor Leste                     1.000000
Papua New Guinea                1.000000


## Friday, April 10

### The COVID19 Exit Strategy

Some argue you should not go to war without an exit strategy. Today, I have been thinking about Australia's exit strategy from the public-health measures it has adopted to tackle the SARS-CoV-2 Coronavirus and COVID19. [Note: SARS-CoV-2 is the virus that causes the new disease known as COVID19.] Or to borrow another metaphor: I have been thinking about the signal that should wake us from the hibernation into which we have placed the economy?

The easy answer is that we should take the exit ramp when the virus no longer presents a clear and present threat to the Australian public. To my mind this yields three logical exit points:
• a therapy or pharmaceutical measure is been found that substantially reduces the fatality risk associated with having COVID19,
• a vaccine is found that can be applied to sufficient Australians to confer herd immunity, or
• sufficient Australians have caught and recovered from COVID19, and that experience confers sufficient immunity for herd immunity to be achieved.
Let's consider each of these in some detail.

### Herd immunity

Let's deal with the last one first. I view this as the failure scenario. Ultimately, if we fail to control the spread of the virus we will achieve herd immunity. At that point, there is no need for public health measures.

While estimates vary, the broadly accepted basic reproduction number for SARS-CoV-2 is around 2.5. That means on average, someone with SARS-CoV-2 will pass it on to 2.5 other people. For a virus to propagate, it must have a basic reproduction number greater than 1. If a disease has a basic reproduction number less than one it will burn out.

The basic reproduction number is also affected by the proportion of the population that is susceptible to infection. We can divide the population into three cohorts, those who are susceptible to infection (S), those who are infected (I), and those who are resistant to (re)infection (R). We talked about this SIR model yesterday. A key insight from the SIR model is that as more people fall into R-category (resistant to (re)infection), this effectively limits the capacity for the virus reproduce. Herd immunity occurs when enough people are resistant to (re)infection that transmission to the susceptible population is less than 1 on average. By a neat quirk of mathematics, this occurs when the proportion of the population that is susceptible to infection is less than the reciprocal of the basic reproduction number.

$$For\ Herd\ Immunity:\ Susceptible < \frac{1}{R_0} = \frac{1}{2.5} = 40\%$$

In plain English: if more than 60 per cent of the Australian population has had COVID19, and if having had the disease confers immunity, the disease is likely to die out. But there is a cost. If we assume a case fatality rate of 0.9 per cent then this outcome would have seen almost 138,000 Australians die.

And this is not as easy as it seems, Left to run wild, my model suggests that the virus would far overshoot that herd immunity level before it burns out. Indeed the virus would have such a momentum, it would not burn out until around 90 per cent of the population had caught the virus. But note: no-one is suggesting we should let the virus run its natural course.

We will come back to the challenge of getting to herd immunity without overshooting.

In my view, we are most likely to end up here - with the virus spreading in the community - if we declare victory too early.  If we decide that only a handful of people have the virus, so there is no need to continue with social distancing, then we could see things get away from us.

Another pathway here is if the collective cabin-fever of social distancing overwhelms us and people give up on the practice. Let's see how people feel about social distancing in three or six months.

### Vaccination

The theoretically easy way to achieve herd immunity is vaccination. There are a lot of people around the world working hard on this. While many people are optimistic about the development of a safe and effective vaccine, it is not guaranteed. Two previous coronaviruses - SARS and MERS - do not have a vaccine, notwithstanding many attempts. But to be fair, these viruses came and went quite quickly.

### Therapeutic interventions

The third exit pathway identified above is a yet to be developed therapeutic intervention. It could be a treatment based on the blood serum of a previously infected person. Or it might be the discovery that a legacy medicine is also effective in treating COVID19. Or it might be something new. Again, while many people are optimistic about the development of a safe and effective therapeutic intervention, it is not guaranteed. This brings us to a fourth exit point the government needs to consider.

### V1/T1

When pilots prepare to fly, they identify several speed thresholds.  For example, V1 is the speed beyond which a takeoff can no longer be aborted. While it is not a perfect analogy, the government needs to give thought to the point (I will call it T1) at which it is no longer sensible to continue hibernating the economy, in the hope that a vaccine or therapeutic intervention will be found.

And when Australia reaches this point, what does the Government do. Does it transition to a national based economy, with strict and compulsory quarantine for all people coming to (or returning to) Australia? Or does it let the virus spread at this point, in a measured way, to reach herd immunity?

My suspicion is that the answer to this second question - what will the government do once it reaches T1 - will depend on whether we have eradicated SARS-CoV-2 within Australia.

### Eradication in the short run

An ideal outcome in the short run would be the eradication of SARS-CoV-2 within Australia. If we can stamp out the virus locally, and the latest growth numbers are encouraging that this may be possible, restarting the local economy with strong borders becomes possible. But it is not the perfect solution. Some sectors of the Australian economy would not fully recover under this scenario. The affected sectors would include international education, and tourism (both into and out from Australia).

Furthermore, we also need to be honest with ourselves. Notwithstanding China's early success, it is still seeing periods of new case growth. And notwithstanding South Korea's early success, it faces a steady stream of new cases every day (albeit a declining stream). Taiwan might be closer, but it is yet to have a sustained period without new cases. Japan and Singapore started well, but now look like they are losing control. Complete eradication within Australia could take some months, necessitates continued social distancing, and there is a risk it will elude us.

### And perhaps, then back to herd immunity

The ugly exit point, should no vaccine or therapeutic intervention be found, and particularly if eradication within Australia proves impossible, could involve the managed propagation of the virus. This would need to protect the most vulnerable (older Australians, those who are immuno-compromised, etc.) It will also need to make sure we do not overshoot herd immunity (as this would involve unnecessary deaths).

One approach I have considered to virus propagation management is a series of pulses, where the Government clamps down and then relax the public health measures - to allow a slow spread of the virus in a way that does not overwhelm the health system. The model charts for different periods of relaxation follow (to show how finely tuned and challenging a task this is).

### Conclusion

There are two positive exit points, which I am sure we all hope for:
• a therapy or pharmaceutical measure has been found that substantially reduces the fatality risk associated with having COVID19, or
• a vaccine is found that can be applied to sufficient Australians to confer herd immunity.

There is one exit point, which suggests failure:
• sufficient Australians have caught and recovered from COVID19, and that experience confers sufficient immunity for herd immunity to be achieved.

And finally,
• there is an exit at the government's choosing when the ongoing costs of economic hibernation continue for too long. The government should give thought to when this point of time might be, and in particular, what it should do if there are no vaccines nor therapeutic interventions available at that time and the virus has not been eradicated.

## Thursday, April 9

### A back of the envelope model for flattening the curve

Before I retired, I spent a number of years working with computerised policy models in a number of social policy departments in the Commonwealth. While I have no direct knowledge, I expect the Commonwealth Health Department has a sophisticated model for the pandemic. I cannot replicate that level of sophistication. Nor can I replicate the complexity of the model from the Doherty Institute

But I can build a simple, toy model - perhaps in a couple of hundred lines of code - that allows me to get a feel of what the dynamics of the pandemic might look like. In this simple model, I have made a number of assumptions for the sake of easy implementation.
• let's ignore population dynamics - ie. no births, deaths, migration
• let's ignore external sources of infection - ie. I assume there will be no further imported infections from international travel
• let's ignore demographic dynamics - different disease outcomes for different age groups and ethnicities
• let's ignore seasonal dynamics - although we suspect higher transmission rates in winter
• let's ignore the impact of co-morbidities - notwithstanding these seem very important
• let's assume full ongoing immunity for those infected who have recovered - although the reality might only be less than full immunity and/or immunity with a half-life of (say) 3, 6 or 12 months
• let's ignore transmission differences that might be associated with asymptomatic carriers versus symptomatic carriers

The model I have coded is a simple SIR model - which divides the population into three cohorts, those who are susceptible to infection (S), those who are infected (I), and those who are resistant to reinfection (R). I have extended the infection category to three linear phases (infected (but not yet infectious), infectious, and [for some] hospitalised). I have extended the resistant cohort to being either recovered and immune, or dead. So actually, there are six categories or states in my model: 'susceptible', 'infected', 'infectious', 'hospitalised', 'recovered', 'dead'. The model works in proportions of the whole population (so the six categories always sum to one).

The model takes a simulation approach, on a day-to-day basis (rather than using calculus to solve a series of ordinary differential equations). This limits subtlety and nuance. The model requires a number of the inputs to be whole integers and cannot deal with fractional periods of infectiousness for example.

The other key assumptions I have made are starting points and process times.
• At the start of the model, I have assumed there are roughly 1000 people infected/exposed and a further 1000 who are infectious. This is an arbitrary small number, but it may not be too far from the current situation.
• I have assumed the time from infection to being infectious is 3 days on average
• I have assumed people are infectious for 8 days on average.
• I have assumed that infectious people will touch 2.5 other people on average (but only those in the susceptible population will become infected).
• I have assumed that 6 per cent of infectious people will be hospitalised.
• I have assumed the average period of hospitalisation is 9 days.
• And I have assumed that 0.9 per cent of infected people will die (ie. nine in every 1000 infected people will die).

These values are all educated guesses based on my reading of newspapers and journal articles.

I have also had a stab at the policy impact of testing, tracing and social distancing on the basic reproduction number for the pandemic in Australia ($R_0$). While my suspicion is that fatigue will set in after a month or so, and the effectiveness of these measures will wane, I have not looked at this. To model policy impacts, I have arbitrarily assumed that these policy interventions would reduce the basic reproduction number to 1.5 or 1.2. These alternative cases show that the curve flattens, and the peak demand for health services is delayed.

Please note: this is NOT a proper epidemiological model. Think of it more as a rough pencil sketch. Nonetheless, my experience has been that such toy models are a good way to check in on and understand the output from more accurate, sophisticated and complex models. Feel free to play with any of the above assumptions.

Let's start with my base case - no policy response to the virus - a basic reproduction number of $R_0=2.5$ - we just let it rip.

The key data points from this model were:
• Dead: 206,934 (0.81%)
• Max in hospital at any point in time: 444,770 (1.7%)
• Max hospitalised occurs on day: 86
• Pop still susceptible at conclusion: 2,510,502 (9.8%)
• Max new infections/day at peak: 853,270
• Max new infections/day occurs on day: 71
• Max new hospitalisations/day at peak: 51,196
• Max new hospitalisations/day occurs on day: 82
• Max deaths/day at peak: 7,679
• Max new deaths/day occurs on day: 91

The above outcome is hard to comprehend.  The health system is completely overwhelmed by an enourmous peak. In the next model, we assume that policy measures have reduced the basic reproduction number to $R_0=1.5$.

The key data points from this model were:
• Dead: 134,755 (0.53%)
• Max in hospital at any point in time: 117,820 (0.5%)
• Max hospitalised occurs on day: 162
• Pop still susceptible at conclusion: 10,530,323 (41.3%)
• Max new infections/day at peak: 219,436
• Max new infections/day occurs on day: 147
• Max new hospitalisations/day at peak: 13,166
• Max new hospitalisations/day occurs on day: 158
• Max deaths/day at peak: 1,974
• Max new deaths/day occurs on day: 167

An improvement, but still pretty dire. We still have an overwhelmed health system. Let's look at $R_0=1.2$:

The key outcomes for this model are
• Dead: 71,969 (0.28%)
• Max in hospital at any point in time: 27,352 (0.1%)
• Max hospitalised occurs on day: 291
• Pop still susceptible at conclusion: 17,489,996 (68.6%)
• Max new infections/day at peak: 50,706
• Max new infections/day occurs on day: 276
• Max new hospitalisations/day at peak: 3,042
• Max new hospitalisations/day occurs on day: 287
• Max deaths/day at peak: 456
• Max new deaths/day occurs on day: 296

We can put these three different models side by side to see the potential curve flattening and peak delay:

What these three models suggest to me is that we will need to continue to be vigilant on border control, testing-tracing-isolation, and social distancing, if we don't want to see Australian deaths climb into the hundreds of thousands. And if we don't want to see the health system swamped by the demand for services. But this comes at a very high economic cost. Furthermore, the willingness of people to practice the current level of social distancing is likely to wane over time.

My suspicion is that sustaining the economic cost and the disciplined practice of social distancing is going to prove challenging, the longer it takes for a vaccine to be developed and administered.

The python code for this model can be found on my GitHub gist site.

### Update

I have now solved this model as a series of ordinary differential equations. Which you can see at my GitHub gist site.

## Friday, April 3

### Analysis by differencing

If we difference the series of cumulative case or death data, it yields the daily new case or new death data. Conceptually, this is a process a little like differentiation. The process of differencing yields $\frac{\Delta y}{ \Delta x}$ for each day along the cumulative series ($\Delta x = 1\ day$); where $\frac{\Delta y}{ \Delta x}$ is analogous to $\frac{dy}{dx}$ from high school calculus.

The shape and slope of the new curve tell us about the growth rate in the cumulative series.
• A horizontal straight line in new cases tells us that the cumulative number is growing at a linear rate along the lines $y=mx+b$, (where m is positive).
• An upwards sloping straight line in new that rises to the right tells us that the cumulative cases are rising with a power equation along the lines $y=x^m+b$, (where m is greater than 1).
• If the new cases are curving upwards to the right at an increasing rate, this tells us the growth rate in the cumulative series is exponential. The form, in this case, will be something like $y=m^x+b$, (where m is greater than 1).
• What we would really want to see is a new line that slopes downwards to the right. This tells us that we are arresting growth in the cumulative.

We smooth the differenced cumulative data to get past the noise in the data. This makes it much easier to see the underlying trend in the new data (and infer what might be happening in the cumulative data).

And we can difference this smoothed data again (following our analogy, this is like the second derivative of cumulative data; that is to say, $\frac{d^2y}{dx^2}$). Having this twice differenced data allows us to be more precise about what is happening in the trend with cumulative cases. [Note, I have not included these charts below].

Caveats:
• The Henderson smoothing process can introduce artefacts to the data, especially at each end of the data as the smoothing window becomes smaller. But this is a reasonable compromise, as much of the new daily data is so noisy.
• A larger Henderson smoothing window will make the trends easier to see, but the series will be less responsive to changes in that trend. Turning points and inflexions take longer to show up in the smoothed data, the larger the window for the Henderson moving average.

A complete set of charts for 2 April follows - first new cases, then new deaths.