The COVID-19 testing delays in Sweden as a prime example of queueing theory

One branch of statistics is Queueing Theory. It is an attempt to predict the behaviour of a system as a function of the inflow and the outflow. As examples you typically have either bank tellers or buffered network routers, but now we have an excellent example in front of us in the Swedish news.

One tool in the fight against the COVID-19 pandemic is testing. By tracking who is infected we can better prevent it from spreading to others, but for that to work, we need the test done and the test result returned before the person has already spread the virus.

In Sweden we expanded the testing capactity slowly but steadily during May and June and all through this process the waiting time, if you were allowed to get a test, was short. As vacations ended and autumn colds came, that changed.

Now people may have to wait for 4 days to get a test done and for another 4 days before the result is returned, despite labs working more efficiently and faster than ever before and returning 50% more test results than a couple of weeks ago.

This is a very typical result in Queueing Theory. As you reach capacity, and throughput increases, you also increase latency. The waiting times get longer. An important formula is ρ(1-ρ)n, where ρ is the load factor, but the exact math is not as important as the results.

Using models, since reality is messy, we find that as the load on the labs increase from 50% to 80%, an increase by 60%, the median waiting time increases from 1 cycle to 3 cycles. An increase by 200%.

We get even more extreme numbers if we increase the load from 50% to 90%. An increase by 80%. Now the models tell us that the median waiting time is 6 cycles, an increase by 500%.

I’m sure you can see where this lands. As the system gets closer and closer to absolute maximum capacity, the waiting time increases expontentially (literally, not just as a word for ”a lot”).

This is in models though. In theory you could have a conveyer belt where everything moves smoothly from start to end, but that is not what the models assume. They assume a certain unevenness, which will create queues at some times and have lower inflow at times.

This connection between latency and free capacity is also why spare capacity is important if you want to always be able to give a timely service. Spare capacity that so easily looks like wasted resources and will frustrate any manager responsible for running a tight ship.

The solution for Sweden is not magic. Expand capacity or reduce inflow. Maybe both.