A trip to the supermarket

Normally even I wouldn’t write about a trip to a supermarket, but these aren’t normal times. With the shutdown scheduled to go on for another two weeks, and with some “essential commodities” emptying, I decided to go stock up.

I might just have postponed my trip by a few more days, but then I saw tweets by the top cop of Bangalore saying they’re starting to seize personal vehicles out on the road during the lockdown. I needed to get some heavy stuff (rice, lentils, oils, etc.) so decided to brave it with the car.

Having taken stock of inventory and made a longlist of things we need, I drove out using “back roads” to the very nearby Simpli Namdhari store. While I expected lines at the large-format store, I expected that it would be compensated for by the variety of stuff I could find there.

I got there at 230 only to be told the store was “closed for lunch” and it would reopen at 3. “All counters are open”, the security guard told me. I saw inside that the store was being cleaned. Since it’s a 3 minute drive away, I headed back home and reached there at 3:15.

There was a small line (10-15 people long) when I got there. I must mention I was super impressed by the store at the outset. Lines had been drawn outside to ensure queueing at a safe distance. Deeper in the queue, chairs had been placed (again at a safe distance from each other) to queue in comfort. They were letting in people about 10 at a time, waiting for an equal number to exit the store each time.

It was around 335 by the time I got in (20 minute wait). From the entrance most shelves seemed full.

The thing with Namdhari’s is that they control the supplies of a large number of things they sell (fruits, vegetables, dairy, bread, etc.), and all of them were well stocked. In times like this (I can’t believe I’m using this phrase!), some sort of vertical integration helps, since you can produce the stuff because you know the downstream demand.

(in any case, for things like vegetables and milk, where there is a large gap between “sowing” and “reaping”, production hasn’t fallen at all. It’s a massive supply chain problem and plenty of stuff is getting wasted while people don’t have enough. Stuff like bread is where vertical integration helps)

In any case I took two trips round the supermarket with my trolley, checking items off my checklist as I put items into the trolley (unusual times mean even disorganised people like me make checklists). Again the vertical integration showed.

Stuff that Namdhari’s owns upstream of, like staples and oils, were well stocked. High demand stuff for which Namdhari’s is only a reseller, like Maggi or crisps or biscuits were poorly stocked. Interestingly, “exotic stuff” (like peanut butter or cheeses, around which Namdhari’s has partly built its reputation) was reasonably well stocked, for which I was really thankful (we consume far more of these than the average Indian household).

How much to buy was a dilemma I had in my head through the shopping trip. For one, there was the instinct to hoard, since I was clear I didn’t want another shopping trip like this until the shutdown ends (milk, vegetables and eggs are reasonably easily available close to home, but I wasn’t there for that).

On the other hand, I was “mindful” of “fair usage policy”, to not take more than what I needed, since you didn’t want stockouts if you could help it.

The other thing that shortages do to you is that you buy stuff you don’t normally buy. Like the other day at another shop I’d bought rice bran oil because groundnut oil wasn’t available. While you might buy something as “backup”, you are cognisant that if you get through the lockdown without needing this backup, this backup will never get used.

So even though we’re running short of sambar powder, I ignored it since the only sambar powder on offer looked pretty sad. On the other hand, I bought Haldiram’s Mixture since no “local mixtures” are available nowadays, and mixture is something I love having with my curd rice.

I was a little more “liberal” with stuff that I know won’t go bad such as dry fruits or staples, but then again that’s standard inventory management – you are willing to hold higher inventories of  items with longer shelf life.

I might have taken a bit longer there to make sure I’d got everything on my list, but then my “mask” made out of a hanky and two rubberbands had started to hurt. So, with half my list unfulfilled, I left.

Even at the checkout line, people stood a metre away from each other. You had to bag your own groceries, which isn’t a standard thing in India, but enforced now since you don’t want too many hands touching your stuff.

Oh, and plenty of people had come by car to the store. There were cops around, but they didn’t bother anyone.

Simulating Covid-19 Scenarios

I must warn that this is a super long post. Also I wonder if I should put this on medium in order to get more footage.

Most models of disease spread use what is known as a “SIR” framework. This Numberphile video gives a good primer into this framework.

The problem with the framework is that it’s too simplistic. It depends primarily on one parameter “R0”, which is the average number of people that each infected patient infects. When R0 is high, each patient infects a number of other people, and the disease spreads fast. With a low R0, the disease spreads slow. It was the SIR model that was used to produce all those “flatten the curve” pictures that we were bombarded with a week or two back.

There is a second parameter as well – the recovery or removal rate. Some diseases are so lethal that they have a high removal rate (eg. Ebola), and this puts a natural limit on how much the disease can spread, since infected people die before they can infect too many people.

In any case, such modelling is great for academic studies, and post-facto analyses where R0 can be estimated. As we are currently in the middle of an epidemic, this kind of simplistic modelling can’t take us far. Nobody has a clue yet on what the R0 for covid-19 is. Nobody knows what proportion of total cases are asymptomatic. Nobody knows the mortality rate.

And things are changing well-at-a-faster-rate. Governments are imposing distancing of various forms. First offices were shut down. Then shops were shut down. Now everything is shut down, and many of us have been asked to step out “only to get necessities”. And in such dynamic and fast-changing environments, a simplistic model such as the SIR can only take us so far, and uncertainty in estimating R0 means it can be pretty much useless as well.

In this context, I thought I’ll simulate a few real-life situations, and try to model the spread of the disease in these situations. This can give us an insight into what kind of services are more dangerous than others, and how we could potentially “get back to life” after going through an initial period of lockdown.

The basic assumption I’ve made is that the longer you spend with an infected person, the greater the chance of getting infected yourself. This is not an unreasonable assumption because the spread happens through activities such as sneezing, touching, inadvertently dropping droplets of your saliva on to the other person, and so on, each of which is more likely the longer the time you spend with someone.

Some basic modelling revealed that this can be modelled as a sort of negative exponential curve that looks like this.

p = 1 - e^{-\lambda T}

T is the number of hours you spend with the other person. \lambda is a parameter of transmission – the higher it is, the more likely the disease with transmit (holding the amount of time spent together constant).

The function looks like this: 

We have no clue what \lambda is, but I’ll make an educated guess based on some limited data I’ve seen. I’ll take a conservative estimate and say that if an uninfected person spends 24 hours with an infected person, the former has a 50% chance of getting the disease from the latter.

This gives the value of \lambda to be 0.02888 per hour. We will now use this to model various scenarios.

  1. Delivery

This is the simplest model I built. There is one shop, and N customers.  Customers come one at a time and spend a fixed amount of time (1 or 2 or 5 minutes) at the shop, which has one shopkeeper. Initially, a proportion p of the population is infected, and we assume that the shopkeeper is uninfected.

And then we model the transmission – based on our \lambda = 0.02888, for a two minute interaction, the probability of transmission is 1 - e^{-\lambda T} = 1 - e^{-\frac{0.02888 * 2}{60}} ~= 0.1%.

In hindsight, I realised that this kind of a set up better describes “delivery” than a shop. With a 0.1% probability the delivery person gets infected from an infected customer during a delivery. With the same probability an infected delivery person infects a customer. The only way the disease can spread through this “shop” is for the shopkeeper / delivery person to be uninfected.

How does it play out? I simulated 10000 paths where one guy delivers to 1000 homes (maybe over the course of a week? that doesn’t matter as long as the overall infected rate in the population otherwise is constant), and spends exactly two minutes at each delivery, which is made to a single person. Let’s take a few cases, with different base cases of incidence of the disease – 0.1%, 0.2%, 0.5%, 1%, 2%, 5%, 10%, 20% and 50%.

The number of NEW people infected in each case is graphed here (we don’t care how many got the disease otherwise. We’re modelling how many got it from our “shop”). The  right side graph excludes the case of zero new infections, just to show you the scale of the problem.

Notice this – even when 50% of the population is infected, as long as the shopkeeper or delivery person is not initially infected, the chances of additional infections through 2-minute delivery are MINUSCULE. A strong case for policy-makers to enable delivery of all kinds, essential or inessential.

2. SHOP

Now, let’s complicate matters a little bit. Instead of a delivery person going to each home, let’s assume a shop. Multiple people can be in the shop at the same time, and there can be more than one shopkeeper.

Let’s use the assumptions of standard queueing theory, and assume that the inter-arrival time for customers is guided by an Exponential distribution, and the time they spend in the shop is also guided by an Exponential distribution.

At the time when customers are in the shop, any infected customer (or shopkeeper) inside can infect any other customer or shopkeeper. So if you spend 2 minutes in a shop where there is 1 infected person, our calculation above tells us that you have a 0.1% chance of being infected yourself. If there are 10 infected people in the shop and you spend 2 minutes there, this is akin to spending 20 minutes with one infected person, and you have a 1% chance of getting infected.

Let’s consider two or three scenarios here. First is the “normal” case where one customer arrives every 5 minutes, and each customer spends 10 minutes in the shop (note that the shop can “serve” multiple customers simultaneously, so the queue doesn’t blow up here). Again let’s take a total of 1000 customers (assume a 24/7 open shop), and one shopkeeper.

 

Notice that there is significant transmission of infection here, even though we started with 5% of the population being infected. On average, another 3% of the population gets infected! Open supermarkets with usual crowd can result in significant transmission.

Does keeping the shop open with some sort of social distancing (let’s see only one-fourth as many people arrive) work? So people arrive with an average gap of 20 minutes, and still spend 10 minutes in the shop. There are still 10 shopkeepers. What does it look like when we start with 5% of the people being infected?

The graph is pretty much identical so I’m not bothering to put that here!

3. Office

This scenario simulates for N people who are working together for a certain number of hours. We assume that exactly one person is infected at the beginning of the meeting. We also assume that once a person is infected, she can start infecting others in the very next minute (with our transmission probability).

How does the infection grow in this case? This is an easier simulation than the earlier one so we can run 10000 Monte Carlo paths. Let’s say we have a “meeting” with 40 people (could just be 40 people working in a small room) which lasts 4 hours. If we start with one infected person, this is how the number of infected grows over the 4 hours.

 

 

 

The spread is massive! When you have a large bunch of people in a small closed space over a significant period of time, the infection spreads rapidly among them. Even if you take a 10 person meeting over an hour, one infected person at the start can result in an average of 0.3 other people being infected by the end of the meeting.

10 persons meeting over 8 hours (a small office) with one initially infected means 3.5 others (on average) being infected by the end of the day.

Offices are dangerous places for the infection to spread. Even after the lockdown is lifted, some sort of work from home regulations need to be in place until the infection has been fully brought under control.

4. Conferences

This is another form of “meeting”, except that at each point in time, people don’t engage with the whole room, but only a handful of others. These groups form at random, changing every minute, and infection can spread only within a particular group.

Let’s take a 100 person conference with 1 initially infected person. Let’s assume it lasts 8 hours. Depending upon how many people come together at a time, the spread of the infection rapidly changes, as can be seen in the graph below.

If people talk two at a time, there’s a 63% probability that the infection doesn’t spread at all. If they talk 5 at a time, this probability is cut by half. And if people congregate 10 at a time, there’s only a 11% chance that by the end of the day the infection HASN’T propagated!

One takeaway from this is that even once offices start functioning, they need to impose social distancing measures (until the virus has been completely wiped out). All large-ish meetings by video conference. A certain proportion of workers working from home by rotation.

And I wonder what will happen to the conferences.

I’ve put my (unedited) code here. Feel free to use and play around.

Finally, you might wonder why I’ve made so many Monte Carlo Simulations. Well, as the great Matt Levine had himself said, that’s my secret sauce!

 

Why Border Control Is Necessary

India is shutting down its domestic flights today in order to stop the spread of Covid-19. This comes a day after shutting down the national railways and most inter-city buses. States and districts have imposed border controls to control the movement of people across borders.

The immediate reaction to this would be that this is a regressive step. After a few decades of higher integration (national and international) this drawing of borders at minute levels might seem retrogade. Moreover, the right of a citizen to move anywhere in India is a fundamental right, and so this closing of borders might seem like a violation of fundamental rights as well.

However, the nature of the Covid-19 bug is that such measures are not only permissible but also necessary. The evidence so far is that it has a high rate of transmission between people who meet each other – far higher than for any other flu. The mortality rate due to the illness the bug causes is also low enough that each sick person has the opportunity to infect a large number of others before recovery or death (compared to this, diseases such as Ebola had a much higher death rate, which limited its transmission).

So far no cure for Covid-19 has been found. Instead, the most optimal strategy has been found to prevent infected people from meeting uninfected people. And since it is hard to know who is infected yet (since it takes time for symptoms to develop), the strategy is to prevent people from meeting each other. In fact, places like Wuhan, where the disease originated, managed to stem the disease by completely shutting down the city (it’s about the size of Bangalore).

In this context, open borders (at whatever level) can present a huge threat to Covid-19 containment. You might manage to completely stem the spread of the disease in a particular region, only to see it reappear with a vengeance thanks to a handful of people who came in (Singapore and HongKong have witnessed exactly this).

For this reason, the first step for a region to try and get free of the virus is to “stop importing” it. The second step is to shut down the region itself so that the already infected don’t meet the uninfected and transmit the disease to them.

Also, a complete shutdown can be harmful to the economy, which has already taken a massive battering from the disease. So for this reason, the shutdown is best done at as small a level as possible, so that the overall disruption is minimised. Also different regions might need different levels of shutdown in order to contain the disease. For all these reasons, the handling of the virus is best done at as local a level as possible. City/town better than district better than state better than country.

And once the spread of the disease has been stopped in a region, we should be careful that we don’t import it after that, else all the good work gets undone. For this reason, the border controls need to remain for a while longer until transmission has stopped in neighbouring (and other) regions.

It’s a rather complex process, but the main points to be noted are that the containment has to happen at a local level, and once it has been contained, we need to be careful to not import it. And for both these to happen, it is necessary that borders be shut down.