[WSG21] Daily Study Group: Building and Applying Epidemic Models

A new study group for Building and Applying Epidemic Models with the Wolfram Language begins Monday, May 10, 2021!

Making progress in an online course can be daunting when you have to study all alone. Join a cohort of fellow Wolfram Language users for a two-week study group in which you will start in week one with the basics of implementing compartment-based epidemiological models in the Wolfram Language. In the second week, you will cover multi-group models–taking into account vital demographics (i.e. birth, death) and age groups–in addition to introducing control measures and ending with stochastic models.

Sign up here: Webinar: Daily Study Group: Building and Applying Epidemic Models by Wolfram Research

10 Likes

Hi

The
c19Data = ResourceFunction[“JHUCOVID19VaccineData”][]

will not load on my machine running Mathematica Desktop. It runs forever then gives a kernal dead error .

When I run it in the cloud , it runs but gives a number of warnings

OK , it seems the menu

Evaluation \Dynamic Updating Enabled

must be enabled (have a tick )

then it loads

Related to the question asked, I would like to know the following:
From c19Data = ResourceFunction[“JHUCOVID19VaccineData”][]
how do I determine what the keys are, and
how do I extract a set of values, for example the time series corresponding to TotalVaccineDosesAllocated?

I used

Keys[c19Data ][[1]]

c19Data [[All,{"AdministrativeDivision","TotalVaccineDosesAllocated"}]]
1 Like

Thank you. It worked well.
If I may trouble you again: I did following your instructions for the ResourceFunction[“COVID19EpidemicData”] found in WSG14_Session1.nb but got an unexpected result (as shown in the attachment). What did do wrong?

see

https://resources.wolframcloud.com/FunctionRepository/resources/COVID19EpidemicData

2 Likes

Thank you.

Sir, this might be silly and I am kinda new to Mathematica. I have been a MATLAB and Python user always. When using ParametricNDSolve to solve for solving and plotting, it gives the plot of all the variables S, E, I, and R. I want to vary the parameter using the slider but only focus on the Infection and Recovered compartment. I tried doing it but it showed an error. I am showing what I tried here in the attached notebook. Thank You so much.

Hi Ravi,

It is easier to pick the solutions you want to plot from the full list. They are in S, E, I, R order, I and R are the third and fourth.

With[{seirSolutions = 
   seirCompartments /. 
    ParametricNDSolve[seirEquations /. seirInitialConditions, seirCompartments, {t, 0, 100000},
    {\[Beta], \[Gamma], \[Sigma]}]}, 
 Manipulate[
  Show[{Plot[
     Evaluate@
      Through[seirSolutions[\[Beta], \[Gamma], \[Sigma]]][[3 ;; 4]], {t, 0, tmax}, 
     PlotRange -> {{0, tmax}, {0, ymax}}]}],
     (*paramters in model*)
     {{\[Beta], 1/2}, 0, 1}, {{\[Gamma], 1/10}, 0, 1}, {{\[Sigma], 3/4}, 0, 1}, 
  Delimiter,
    (*plot range limits*)
   {{tmax, 100, "\!\(\*SubscriptBox[\(t\), \(max\)]\)"}, 0, 200}, 
   {{ymax, 1000000, "\!\(\*SubscriptBox[\(y\), \(max\)]\)"}, 0, 1000000}, 
  SaveDefinitions -> True]]

1 Like

Thank you so much, Rohit. This works if they are in order right. can I plot if they are not in order, say S and R.

Edit: Okay I got this from wolfram documentation on Part
if anyone needs it here it is

NDSolve and ParametricNDSolve both return lists of Rules. I find it more convenient to work with those lists of Rules than just a list of their Values (right hand sides) as is done in your code. This way I work directly with the variables I need rather than some part of a list. (In general I try to avoid using Part.)

I also find it easier to solve for the variables vi rather than vi[t].

I made a couple changes to your code. In the first cell I used

seirCompartments = {\[ScriptCapitalS], \[ScriptCapitalE], \
\[ScriptCapitalI], \[ScriptCapitalR]};

and in the second cell I used

Plot[{\[ScriptCapitalS][\[Beta], \[Gamma], \[Sigma]][
     t], \[ScriptCapitalR][\[Beta], \[Gamma], \[Sigma]][t]} /. 
   seirSolutions // Evaluate, {t, 0, tmax}, 
 PlotRange -> {{0, tmax}, {0, ymax}}]

Kiran–SEIR example.nb (37.9 KB)

1 Like

Where are the study notebooks, please? I have joined very late…

Register here

Then you should be able access the the materials.

Post registration (now done 3 times) I land here:
Webinar: Daily Study Group: Building and Applying Epidemic Models by Wolfram Research but I see no NB links.

The series materials are provided daily in the invitation link you get to join the session. You will get them there, but for now, if you have registered here is the link where you can get notebooks. Files for the series

Hopefully, I am not doing something wrong by sharing this.

THanks!

In the DynamicTransmissionModel function, if the option AgeStratification is not enabled, the ForceOfInfection is effectively the probability of one of the contacts made by the suseptibles being with one individual in an infective compartment; if the AgeStratification is enabled, the ForceOfInfection is effectively the multiplication of that probability and the contact rates. Why does this inconsistence exist?

Has the Stochastic Models video been released ?

Can you give any analytical insight into “infections/lives saved” as function of vaccine rollout rate? Clearly it is easy, if vaccination is “instant” and I have had success assuming vaccine rollout is far faster than new infections. I appreciate that “lives” is harder that “cases”, with age stratification on both vaccine rollout and mortality but that is not my question.