Answers.Body: <p>You probably could adapt A. K. Dewdney’s “Sharks and Fishes” programming challenge from his old Scientific American column (<a href="https://www.cs.mcgill.ca/~carl/fishnsharks.html" rel="nofollow noreferrer">https://www.cs.mcgill.ca/~carl/fishnsharks.html</a>).  Here’s another example of it being used in education <a href="https://people.eecs.berkeley.edu/~jrs/61bf06/hw/pj1/readme" rel="nofollow noreferrer">https://people.eecs.berkeley.edu/~jrs/61bf06/hw/pj1/readme</a></p>
  
  <p>In this case, you could just have one subject type (people) but maintain states for them with pixel colors :</p>
  
  <ul>
  <li>White: Uninfected</li>
  <li>Yellow: Infected but asymptomatic (optional)</li>
  <li>Red: Infected</li>
  <li>Green: Recovered (immune)</li>
  <li>Black: Deceased</li>
  </ul>
  
  <p>You can make the people like sharks in that they move around (unless sick or deceased) and have a chance of infecting others within a certain distance.</p>
  
  <p>Then you can study how changing parameters affects the spread:</p>
  
  <ul>
  <li>Population total/density</li>
  <li>Probability of infection</li>
  <li>Range of contact for infection</li>
  <li>Length of illness before recovery/mortality</li>
  <li>Chance of recovery vs mortality</li>
  <li>Social Behavior: people/sharks move towards each other, vs moving away from each other</li>
  </ul>
  
  <hr>
  
  <p>Initially, it might be easier to just start with the Sharks and Fishes problems and when completed, morph it into a mobile infection problem.</p>
  
  <p>Alternatively, you could start with a non-mobile problem (ie., people don't move), just make sure that in the initial distribution of people, everyone is adjacent to at least one other person.</p>
  
  <hr>
  
  <p>I had missed the part about doing it in a spreadsheet.  If you mean just doing it with spreadsheet formulas, then you'll probably run into a problem with circular references.  In Excel I think that you can use either the Optimization tools or else advanced settings to get around that, but its tricky.</p>
  
  <p>In Excel for Windows (but not the other OS's) you can use VBA to implement a simple model like this.  I did it decades ago, but I don't have any of those with me now.  </p>
  
  <p>If a full blown VBA project is too much, then you could also do it with just sheet formulas and one or two simple VBA macros.  Let me know if you want and I can explain how.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-28T15:21:28.783Z
Answers.Text: Welcome to the site.. Come back for more.
Answers.UserDisplayName: Buffy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-28T15:40:43.077Z
Answers.Text: It's not especially relevant here, but the late professor Pat Doyle once wrote a paper: _An In-Eating Cannibalistic Society Could Be Stable_. It used the standard predator-prey model and unified the predator and prey variables.
Answers.UserDisplayName: Buffy
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-30T13:13:18.603Z
Answers.Text: Added stuff about using spreadsheets for this.
Answers.UserDisplayName: RBarryYoung
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-28T15:04:50.640Z
Answers.LastActivityDate: 2020-03-30T13:13:01.503Z
Answers.LastEditDate: 2020-03-30T13:13:01.503Z
Answers.UserDisplayName: RBarryYoung
Answers.Body: <p>Here are two resources that might be appropriate, but neither is a spreadsheet model. </p>
  
  <p>The first is a resource called Contagion that has just been created for the Greenfoot Java system (IDE plus resources). You can find it at the <a href="https://greenroom.greenfoot.org" rel="nofollow noreferrer">Greenroom</a>. </p>
  
  <p>The second is a section on Simulation in a book called <a href="https://rads.stackoverflow.com/amzn/click/com/1940113067" rel="nofollow noreferrer" rel="nofollow noreferrer">Polymorphism Companion</a>. The book is actually the second volume of a pair and you might need the first one also <a href="https://rads.stackoverflow.com/amzn/click/com/1940113059" rel="nofollow noreferrer" rel="nofollow noreferrer">Polymorphism: As It Is Played</a>. They are both about using polymorphism, especially in Java. </p>
  
  <p>Both of these resources model a disease spreading through a population. They have various parameters you can set to get some realistic(ish) results. Think of a <em>Disease</em> interface, for example, with diseases of various characteristics implemented via polymorphism. </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-27T19:07:37.723Z
Answers.LastActivityDate: 2020-03-28T00:01:14.790Z
Answers.LastEditDate: 2020-03-28T00:01:14.790Z
Answers.UserDisplayName: Buffy
Answers.Body: <p>I teach a Mathematical Modeling elective at the high school where Ben I. and I teach. I would love to do an in-depth object-based model using programming with my students, but generally speaking I don't have the ability to assume that all of my students know how to code. <em>Most of them,</em> but not all.</p>
  
  <p>So, my solution is typically to use spreadsheets and the standard differential equation models to deal with disease spread. One of the simplest models is what's called the SIR model, which is an example of a <a href="https://en.wikipedia.org/wiki/Compartmental_models_in_epidemiology" rel="noreferrer">compartmental model</a> . Because these mathematical models are focused on total numbers in each category of the population and not on individuals, a spreadsheet is sufficient to see what happens.</p>
  
  <p>Typically, for a three-compartment model, you need a minimum of three columns/variables to track overall counts. I would strongly recommend a fourth to keep track of time, and if you want, a fifth to keep track of deaths. You will need initial values for each quantity and parameters that are used to keep track of movement from one category to another.</p>
  
  <p>For example, if I use the F1 cell to store the virulence parameter of the disease, F2 to store the recovery rate and F3 to store the lethality parameter, then we can build the model. I also recommend including a time-step parameter somewhere, let's say in F4. This will give you one control that will help to avoid calculation nonsense if some of your numbers are too large.</p>
  
  <pre><code>          A         B         C         D          E         F
  1         Time      Suscept   Infected  Recovered  Dead      virulence (1/1000000)
  2         0         10000     1         0          0         recovery (1/100)
  3         A2+F$4    B formula C formula D formula  E formula lethality (1/1000)
  4         c  o  p  y     t  h  e     f  o  r  m  u  l  a  s  time step (0.1)
  
  Where the B formula in B3 is =B2-F<span class="math-container">$4*(F$</span>1*B2*C2)
  Where the C forumla in C3 is =C2+F<span class="math-container">$4*(F$</span>1*B2*C2-F<span class="math-container">$2*C2-F$</span>3*C2)
  Where the D formula in D3 is =D2+F<span class="math-container">$4*(F$</span>2*C2)
  Where the E formula in E3 is =E2+F<span class="math-container">$4*(F$</span>3*C2)
  </code></pre>
  
  <p>Drag those formulas down as far as you want and make a scatter plot with all of the variable columns highlighted and you have a basic differential equation epidemiological model. It can be used to convey the <em>very important fact</em> that the most dangerous diseases to a population are the ones which are highly contagious, and not the ones that will kill you quickly, and that the ones which are highly lethal are actually safer for the population.</p>
  
  <p>If you want other lessons from this, you're going to need to delve into the more complicated epidemiological models that demonstrate the effects of things like imposed quarantine, self-quarantine behavior, gathering of sick people at hospitals, vaccination, re-infection, or multi-stage diseases.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-03-27T22:01:57.213Z
Answers.LastActivityDate: 2020-03-27T22:01:57.213Z
Answers.UserDisplayName: Mark B
Body: <p>I'd like to try teaching an online lesson to high school CS students on modeling the spread of a virus. Ideally it would be something that could be coded in a spreadsheet, Code.Org's Game Lab or App Lab, or in Unity.</p>
  
  <p>I'd appreciate any pointers to how to get started – what are the important underlying concepts for students to understand, what are the minimal skills they would need to produce a "satisfying" model, what are the key variables that a model should incorporate?</p>
  
  <p>Suggestions about how to get my own head around the field, or videos of modelers talking about their work, or articles would all be welcome.</p>
  
  <p><strong>Update:</strong></p>
  
  <p>First: many thanks for the great and concrete suggestions coming in, they really help.</p>
  
  <p>Second: this is, or could be, a collaboration across disciplines – math, CS, health, social studies, and art / graphic design all have a role in developing and presenting a good model.</p>
  
  <p>Third: clearly, in these times, this is a distance learning question as well.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-27T21:07:10.030Z
Comments.Text: I love this idea.  I'm going to see if I can figure out a way to steal it in my own classroom :)  Oh, and I sent the question to someone who may have some interesting things to add about the actual mathematics of the modeling!
Comments.UserDisplayName: Ben I.
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-03-28T15:55:02.503Z
Comments.Text: I highly recommend the Numberphile video https://www.youtube.com/watch?v=k6nLfCbAzgo where they're modeling the SIR model in Geogebra.
Comments.UserDisplayName: Guntram Blohm
Tags: <lesson-ideas><distance-learning>
Title: HS Lessons On Modeling Virus Spread
ThreadText: # HS Lessons On Modeling Virus Spread
  
  (Asked by: username_0 on 2020-03-27)
  
  I'd like to try teaching an online lesson to high school CS students on modeling the spread of a virus. Ideally it would be something that could be coded in a spreadsheet, Code.Org's Game Lab or App Lab, or in Unity.
  
  I'd appreciate any pointers to how to get started – what are the important underlying concepts for students to understand, what are the minimal skills they would need to produce a "satisfying" model, what are the key variables that a model should incorporate?
  
  Suggestions about how to get my own head around the field, or videos of modelers talking about their work, or articles would all be welcome.
  
  **Update:**
  
  First: many thanks for the great and concrete suggestions coming in, they really help.
  
  Second: this is, or could be, a collaboration across disciplines – math, CS, health, social studies, and art / graphic design all have a role in developing and presenting a good model.
  
  Third: clearly, in these times, this is a distance learning question as well.
  
  **Tags:** lesson-ideas, distance-learning
  
  > **Comments:**
  > **username_1**: I love this idea.  I'm going to see if I can figure out a way to steal it in my own classroom :)  Oh, and I sent the question to someone who may have some interesting things to add about the actual mathematics of the modeling!  
  > **username_2**: I highly recommend the Numberphile video https://www.youtube.com/watch?v=k6nLfCbAzgo where they're modeling the SIR model in Geogebra.  
  
  ---
  
  ## 3 answers
  
  ### Answer by username_5 on 2020-03-27. Score: 5
  
  I teach a Mathematical Modeling elective at the high school where username_1. and I teach. I would love to do an in-depth object-based model using programming with my students, but generally speaking I don't have the ability to assume that all of my students know how to code. *Most of them,* but not all.
  
  So, my solution is typically to use spreadsheets and the standard differential equation models to deal with disease spread. One of the simplest models is what's called the SIR model, which is an example of a [compartmental model](https://en.wikipedia.org/wiki/Compartmental_models_in_epidemiology) . Because these mathematical models are focused on total numbers in each category of the population and not on individuals, a spreadsheet is sufficient to see what happens.
  
  Typically, for a three-compartment model, you need a minimum of three columns/variables to track overall counts. I would strongly recommend a fourth to keep track of time, and if you want, a fifth to keep track of deaths. You will need initial values for each quantity and parameters that are used to keep track of movement from one category to another.
  
  For example, if I use the F1 cell to store the virulence parameter of the disease, F2 to store the recovery rate and F3 to store the lethality parameter, then we can build the model. I also recommend including a time-step parameter somewhere, let's say in F4. This will give you one control that will help to avoid calculation nonsense if some of your numbers are too large.
  
  ```
            A         B         C         D          E         F
  1         Time      Suscept   Infected  Recovered  Dead      virulence (1/1000000)
  2         0         10000     1         0          0         recovery (1/100)
  3         A2+F$4    B formula C formula D formula  E formula lethality (1/1000)
  4         c  o  p  y     t  h  e     f  o  r  m  u  l  a  s  time step (0.1)
  
  Where the B formula in B3 is =B2-F$4*(F$1*B2*C2)
  Where the C forumla in C3 is =C2+F$4*(F$1*B2*C2-F$2*C2-F$3*C2)
  Where the D formula in D3 is =D2+F$4*(F$2*C2)
  Where the E formula in E3 is =E2+F$4*(F$3*C2)
  
  ```
  
  Drag those formulas down as far as you want and make a scatter plot with all of the variable columns highlighted and you have a basic differential equation epidemiological model. It can be used to convey the *very important fact* that the most dangerous diseases to a population are the ones which are highly contagious, and not the ones that will kill you quickly, and that the ones which are highly lethal are actually safer for the population.
  
  If you want other lessons from this, you're going to need to delve into the more complicated epidemiological models that demonstrate the effects of things like imposed quarantine, self-quarantine behavior, gathering of sick people at hospitals, vaccination, re-infection, or multi-stage diseases.
  
  
  ---
  
  ### Answer by username_3 on 2020-03-28. Score: 4
  
  You probably could adapt A. K. Dewdney’s “Sharks and Fishes” programming challenge from his old Scientific American column (<https://www.cs.mcgill.ca/~carl/fishnsharks.html>). Here’s another example of it being used in education <https://people.eecs.berkeley.edu/~jrs/61bf06/hw/pj1/readme>
  
  In this case, you could just have one subject type (people) but maintain states for them with pixel colors :
  
  * White: Uninfected
  * Yellow: Infected but asymptomatic (optional)
  * Red: Infected
  * Green: Recovered (immune)
  * Black: Deceased
  
  You can make the people like sharks in that they move around (unless sick or deceased) and have a chance of infecting others within a certain distance.
  
  Then you can study how changing parameters affects the spread:
  
  * Population total/density
  * Probability of infection
  * Range of contact for infection
  * Length of illness before recovery/mortality
  * Chance of recovery vs mortality
  * Social Behavior: people/sharks move towards each other, vs moving away from each other
  
  ---
  
  Initially, it might be easier to just start with the Sharks and Fishes problems and when completed, morph it into a mobile infection problem.
  
  Alternatively, you could start with a non-mobile problem (ie., people don't move), just make sure that in the initial distribution of people, everyone is adjacent to at least one other person.
  
  ---
  
  I had missed the part about doing it in a spreadsheet. If you mean just doing it with spreadsheet formulas, then you'll probably run into a problem with circular references. In Excel I think that you can use either the Optimization tools or else advanced settings to get around that, but its tricky.
  
  In Excel for Windows (but not the other OS's) you can use VBA to implement a simple model like this. I did it decades ago, but I don't have any of those with me now.
  
  If a full blown VBA project is too much, then you could also do it with just sheet formulas and one or two simple VBA macros. Let me know if you want and I can explain how.
  
  > **Comments:**
  > **username_4**: Welcome to the site.. Come back for more.  
  > **username_4**: It's not especially relevant here, but the late professor Pat Doyle once wrote a paper: _An In-Eating Cannibalistic Society Could Be Stable_. It used the standard predator-prey model and unified the predator and prey variables.  
  > **username_3**: Added stuff about using spreadsheets for this.  
  
  ---
  
  ### Answer by username_4 on 2020-03-27. Score: 4
  
  Here are two resources that might be appropriate, but neither is a spreadsheet model.
  
  The first is a resource called Contagion that has just been created for the Greenfoot Java system (IDE plus resources). You can find it at the [Greenroom](https://greenroom.greenfoot.org).
  
  The second is a section on Simulation in a book called [Polymorphism Companion](https://rads.stackoverflow.com/amzn/click/com/1940113067). The book is actually the second volume of a pair and you might need the first one also [Polymorphism: As It Is Played](https://rads.stackoverflow.com/amzn/click/com/1940113059). They are both about using polymorphism, especially in Java.
  
  Both of these resources model a disease spreading through a population. They have various parameters you can set to get some realistic(ish) results. Think of a *Disease* interface, for example, with diseases of various characteristics implemented via polymorphism.
  
  
  ---
  
  