Message Boards Message Boards

Epidemiological Models for Influenza and COVID-19

37 Replies

Congratulations! This post was featured in the Wolfram Blog Wolfram Community Takes on Current Events: COVID-19 Data, Green Spaces, Homeschool Puzzles and More. We are looking forward to your future contributions.

enter image description here

POSTED BY: Moderation Team

Indeed you do! How did you "download" it?

Using the "Download" button in the Wolfram Cloud, using the "Open from Cloud..." button on the Desktop Mathematica Welcome screen, or using File > Open from Wolfram Cloud... menu work OK.

The only time I've seen this behavior is with

NotebookOpen["https://www.wolframcloud.com/obj/rnachbar/Published/\
EpidemiologicalModelsForInfluenzaAndCOVID-19--part_1.nb"]

from the desktop.

Try one of the three methods I first mentioned.

PS. I see that you're using Mathematica 11.3. Some things may not render correctly when the notebook is first opened (e.g., some cell styles are not defined), but reevaluating inputs should take care of that.

POSTED BY: Robert Nachbar

Hi, I have a problem with notebook 1, I already downloaded the package and put it in the same directoryenter image description here

Posted 4 years ago

Thanks for a really nice post and nice work! I've made my own model that includes quarantine but instead of creating a compartment (state variable) for quarantined I simply made beta a time varying function that drops a certain level once quarantine is started. I guess that's a good enough approximation even though it might not catch all dynamics.

Now my question. Looking at e.g. Hubai outbreak you get beta = 0.79 and gamma = 0.04, which would correspond to an R0 of =19.8 (beta/gamma). But I've seen work estimating R0 to between 2 and 2.5 for Corona. Why the discrepancy?

Regards Peter Aronsson

POSTED BY: Peter Aronsson
Posted 4 years ago
POSTED BY: john garnham
Posted 4 years ago

Hi Robert,

I am trying access the covid19 data for Iran by using the following

fitData = 
  fitDataWDR[Entity["Country", {"Iran"}], "1 March 2020", 
   "dateRange" -> All];

but getting following error :

fitDataWDR::locnf: Locale Entity[Country,{Iran}] not found.

Could you please tell me what wrong am I doing here.

Regards

POSTED BY: M Farooq

There is a syntax error in the Entity specification. Use

fitData = fitDataWDR[Entity["Country", "Iran"], "1 March 2020", "dateRange" -> All];
POSTED BY: Robert Nachbar
Posted 4 years ago

Many thanks for your contribution. I Excellent work. But what would happen if used with QuantileRegression.m?

POSTED BY: Arthur Albano
POSTED BY: Robert Nachbar
Posted 4 years ago

Thank you. I am testing them.

Once again: A very impresive project! Statistical fit does not work though (see attached notebook). Please advise!

Attachments:

I had updated the package last week, but unfortunately missed two necessary changes needed in the full version notebook.

There is an updated version of that notebook in the Cloud now. It has today's date for the most recent revision.

POSTED BY: Robert Nachbar

Any pointer to that notebook?

fitDataWDR returns a list of 3 data series. Each data series is a list of pairs of values of the form {time, number}. The first data series in the number of confirmed cases (not the cumulative number), the second is the number of recovered cases (which happens to be cumulative because it's a sink), and the third series is the number of deaths (also cumulative because it's a sink).

For example the first 5 elements of each series for Beijing is

In[18]:= fitData = 
  fitDataWDR[Entity["AdministrativeDivision", {"Beijing", "China"}], 
   "21 Jan 2020", "dateRange" -> All];

In[19]:= Take[#, 5] & /@ fitData

Out[19]= {{{1., 14}, {2., 22}, {3., 35}, {4., 39}, {5., 66}}, {{1., 
   0}, {2., 0}, {3., 1}, {4., 2}, {5., 2}}, {{1., 0}, {2., 0}, {3., 
   0}, {4., 0}, {5., 0}}}

If you don't have data for one of those series, then leave it out of the list of series, and also leave the corresponding model out of the list of models given to sumSquaredError.

Hope this helps!

POSTED BY: Robert Nachbar
Posted 4 years ago

When I ran the code on your last reply I got the following error. Can I work with the data from Argentina?

Attachments:
POSTED BY: Eric Avila
Posted 4 years ago
POSTED BY: Updating Name
Posted 4 years ago

Hi, I hope you are okay. I want to applied your code to my data, How can I upload my data for it could have the same format as your data?

POSTED BY: Eric Avila

thank you- Gerhard

POSTED BY: Gerhard Fasol

thank you! - where can we find the notebook part_2 and other parts if any? thank you so much Gerhard

POSTED BY: Gerhard Fasol

The table of contents at the top of the first notebook (found here) has links to all the others.

POSTED BY: Robert Nachbar
Posted 4 years ago
POSTED BY: anoldfriend
POSTED BY: Robert Nachbar

Apparently you assigned the value 1.5 to the symbol [Beta] and 0.0478 to [Gamma]. I can reproduce your error messages when I do that. Also, if you look at the second message, you can see that the last argument to ParametricNDSolve is {\[ScriptCapitalN], I0, 1.5, \[Zeta], 0.0478}, which shows numeric values instead of symbols for [Beta] and [Gamma].

It would probably be best to quit and restart the Kernel to fix the problem.

Please let me know if you did not assign values to [Beta] and [Gamma], because that would suggest that the Manipulates are "leaking" dynamic assignments, which I made every effort to code against.

POSTED BY: Robert Nachbar
Posted 4 years ago

Don't worry everything are ok, my bad. :) After including Clear["Global`*"] at the start, everything runs fine. Probably some leftovers from previous notebook.

Thanks for all of these very very good project!

POSTED BY: anoldfriend

Indeed, that is on my To Do list. I can easily get the age distribution for a country from Wolfram|Alpha, so that will help with the initial conditions. However, to estimate the values for an age-stratified parameter we really need the number of confirmed cases, recovered cases, and deaths broken down by age too. There are some data on deaths for various ages.

See the University of Basel model for an example using age groups. They use estimates based on an analysis of the recent data from China, and are not fitting them. Their interface allows the user to adjust them, also.

POSTED BY: Robert Nachbar
POSTED BY: J. Kent Wallace

Very good modeling. I was wondering if you could take into account herd immunity— as the number of recovered individuals goes up, the transmission rate goes down. Once 70% of the population is exposed the rate of infection begins to drastically decrease. Hence it may take a long time for the last 30% to be become infected

Another factor to consider with the data is the sensitivity of the test— at best it is 60% and in real world testing 40%.

POSTED BY: Robert Cheek

Congratulations! This is a very interesting and useful introduction into a highly topical issue. Following the yesterday's fascinating presentation of the models, I have tried unsuccessfully to run the notebook (Mathematica 12.1, Win 10 64). I am getting many error messages. Please advise!

Attachments:

Thanks for your interest. Did you also download the package that's mentioned at the beginning of the initialization section: https://www.wolframcloud.com/obj/rnachbar/Published/CompartmentalModeling.wl?

The code for KineticCompartmentalModel is in the package and that's how the transitions are interpreted and the ODEs generated.

I'll copy the notice about the package to the top of the notebook so it's more obvious.

POSTED BY: Robert Nachbar

No, I had not downloaded the package. I did now. Thank you!

Posted 4 years ago
POSTED BY: Robert Rimmer

A more manageable set of background notebooks is now available, starting with:

EpidemiologicalModelsForInfluenzaAndCOVID-19--part_1.nb

There is a TOC in each one to assist navigation among them.

POSTED BY: Robert Nachbar

enter image description here -- you have earned Featured Contributor Badge enter image description here

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, keep it coming, and consider contributing to the The Notebook Archive!

POSTED BY: Moderation Team
Posted 4 years ago
POSTED BY: Robert Rimmer
POSTED BY: Robert Nachbar
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract