16 comments

[ 3.6 ms ] story [ 51.6 ms ] thread
While this is a nice visualization of the SIR model (which is what I think this is), the lack of variation in transmission rates (and no small-world behavior, which is what we'd expect in many cases relating to the current world), makes this an extraordinarily crude approximation.

It's a cool visualization, but I want to be clear that, even plugging in exact values (if we knew them) for Rt and time to recovery will yield very different behavior than anything even close to the true distribution.

You're right, this is not at all an accurate epidemic model. My goal with this was to better understand the relationship between the infection rate and the speed of the virus spread, as well as how it affects different age cohorts via an age-dependent mortality. It's a simple probabilistic model with discrete time steps, I think it yields similar results to the SIR model but isn't based on a differential equation. Cohort simulation techniques are e.g. used by the census bureau here in Germany to simulate aging of the population.

Please note that the transmission rates are not fixed, the model assumes that an infected person makes random connections to other people from the population (so not small world but not far-fetched for a small country like Germany), the more people are already infected or cured from those people, the smaller the effective transmission rate (hence not all people end up infected).

You could of course improve this by using a network model or a much more complex social simulation, most of the dynamics will be qualitatively (not quantitatively) very similar though.

You can see e.g. that as of now, despite the boggling complexity of the real world the number of infections almost perfectly follows an exponential function. So even a simple model can sometimes give you qualitative insights into a problem. I am sure that the epidemology institutes like the Robert-Koch-Institut have much much more powerful models to predict the spread of the disease, this here is just a toy.

Some feedback: use k as a suffix to express thousands (instead of T)
Yeah, I was incredibly confused as to how it got from 900 to a Trillion in a single day...
OK... makes more sense now!
(comment deleted)
Thanks, just got a PR for this and merged it!
This is pretty cool, one thing that confused me was using "T" for thousands instead of "k", but I think that may just be a localization thing (I'm used to "T" signifying trillions).

I am curious how something like population distribution over geography would affect a model like this (obviously it would become a lot more complicated).

My understanding is, at least in the U.S., the goal of public health officials is to stagger the COVID-19 infection rate to draw it out over a long period of time. Given that there is no vaccine, the best they can do is prevent it from spreading as quickly. If 100% of 330 million Americans suddenly got sick, if ~16% of them need hospitalization, we'd run out of beds, and if ~6% needed critical respiratory care, it would be a catastrophe (one of my family members who is a medical doctor estimates there are roughly 70,000 ventilators in the country). So by slowing it down they can stagger the rate at which our medical facilities are impacted.

would? what? if 5% needed ventilators, 70k of them would provide for 1.4 million infected. e.g. you could handle 0.4% of the population being sick concurrently. as is, it is a catastrophe.
Thanks, I fixed that! There are models that take the geographic distribution into account, e.g. this one: https://www.youtube.com/watch?v=aF3FhOPwv2w

That said for a small countrly like Germany the spread seems to even out pretty quickly, two weeks ago we just had some cases localized in a small region and now almost every state reports many new cases daily.

It would be prudent for the author to consider reinfections in the next update
And let people who are not Deceased People but Cured People be counted as Healthy People again.

Or can one never be counted as Healthy People once one has been Sick People?

I wanted to make it easy to see how many people become infected during the simulation, hence they are not counted as healthy even though they technically are.
Somewhat refreshingly, this is apparently not using any framework or libraries. Would have been madness a decade or two ago, but now it seems to work well for a small project like this, the source is pretty readable (though the single js file is a bit on the large side): https://github.com/adewes/epidemic

Also, I have no idea what the numbers on the X axis represent for the first few graphs. It seems like it should be "days", but the numbers are all over the place.

Thanks! I think frameworks are overkill for such small projects, setting up a full project e.g. using React, Babel, Webpack, D3 and SASS would have taken me longer than I needed to finish this whole project, I think :D

Most modern browsers have really good support for JS and CSS so you don't need any additional libraries.

It's the date on the first graph, I'll add a more obvious format that will be readable for English/US speakers as well (in Germany/Europe the date format is often dd.mm).