Outstanding post, Christopher!
It's intriguing that the shape of the infected curve in the Simple Example section is fairly symmetrical and does not have the long exponential tail.
Generating the phase plane analysis from the simulations is amazing. I've seen (and done) these analyses using the traditional calculus-based approach, but it's wonderful that you can do the same with this model and show that many of the same principles apply.
Does this model enable to evaluate a number of infected people, using very long tail(s) of the confirmed cases (for example, using published data from China)?
My thought was - the number of reported can be lower than the real/infected cases, but to make a justified decision on quarantine stop, one has to know both.
-- you have earned Featured Contributor Badge
Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!
Excellent post @Christopher Wolfram , I was working along the same lines. I'll switch the focus to cover other interesting aspects of using this type of models.
Impressive project! Congratulations!
I wonder what is the minimum configuration of a Windows 10 Pro workstation to evaluate the notebook, as I was not able to evaluate superGraphSimsByConnectivity, using a workstation with an Intel Core i9-9900K @ 3.60 GHz CPU, 32.0 GB RAM, and Mathematica 12.1.
Hmm. I ran this notebook on my laptop, so it should work on your much higher-spec computer. When I ran that particular line originally, however, I used ParallelTable, but that shouldn't change anything.
In what way did it fail? Did it run out of memory?
Thank you for your prompt reply!
I believe I did not run out of memory.
I am trying again, using ParallelTable.
Aristeidis, I can give you a rough benchmark: I use a desktop with Xeon E2176M 6 core + 16GB RAM to run the whole notebook. It consumes 10 GB (maximum resource I have besides OS resources) and takes 3655 seconds to complete (using ParallelTable). Attached is a notebook with only input code from Christopher's article and my timing result.
Thank you Shenghui!
I ran successfully the notebook covid.nb in 2292 seconds.
Thank you all!
Nice post, Christopher, thanks.
It shows the power of Mathematica to generate and manipulate efficiently highly structured systems.
We're working on similar structured-contact covid model for local settings (e.g. hospitals, city districts et al). Would be glad to share it, when ready
Thanks. Very interesting. As a clinician in, so far, lucky New Zealand, I was interested in how increasing number of degrees of association in networks might affect transmission. I'm watching how Denmark reopening schools will, to my mind, likely create a very large network of associations very quickly.
Also found this paper, which appears to introduce heterogeneity of transmission as a concept. I suspect this is tautologous to how one might model death likelihoods in differing age/risk groups.
Maths so far a bit beyond my weekend explorer level, but the concepts seem useful.
[Percolation on heterogeneous networks as a model
Thanks for this very interesting post.
I did some experiments with your two different implementations and found that they behave differently in a statistically significant sense. To verify this, I ran your simple example a large number of times (1000 simulations) using both implementations and extracted the time and magnitude of the infection peak. The attached histograms show the results. Orange is the "Efficient implementation" and blue is the other implementation. You can see that the infection peak is earlier and higher when run with the efficient implementation, suggesting that it has a higher effective transmission rate.
I thought I understood both implementations, but there must be something I am missing as I can't see why they should behave differently. Can anyone explain why I am finding differences?
I think I now understand the problem identified in my previous post, at least partially. Looking at the section "Make the susceptible neighbors of infected agents meet their neighbors" in the efficient method, and in particular the line Flatten[Lookup[neighbors,Normal[stateAgents["I"]]],1], this picks out all agents that are connected to an infected agent. However, in cases where an agent is connected to more than one infected agent they are then double-counted, effectively being given more than one opportunity to be infected in a single step (note that the fact that they are more likely to be infected if they are connected to more than one infected agent is already taken account of elsewhere).
A simple fix is to change the line to DeleteDuplicates[Flatten[Lookup[neighbors,Normal[stateAgents["I"]]],1]]. This significantly improves the agreement with the slower implementation, although there is still some discrepancy, with the efficient method now slightly favoring a later and lower peak.
Ah, that's a good catch. I'll try to add that change to the notebook and edit the post.
I made that change and recomputed everything. None of the results look significantly affected, but thanks for finding that bug. The main post has been updated to show results from the new version.
Great, thank you for checking.
Do you understand why the two implementations might still differ? They are in much closer agreement now, but there still seems to be a small, but statistically significant difference (as measured by, e.g. the time and height of the peak infection).
Thanks for sharing this incredible project, Christopher. I used it for a for a project with my kids this morning. They are in 8th and 10th grade and your work really made the high level ideas that go into virus modeling accessible to them: https://mikesmathpage.wordpress.com/2020/05/16/sharing-christopher-wolframs-amazing-agent-based-virus-model-with-kids/