The deadly model is all very well and good, but actually totally deadly diseases are fortunately fairly rare. It is much more usual for some percentage of people to be immune to the disease, or catch it and recover, becoming immune afterwards. Most diseases are modelled using the "SIR" model: Susceptible - Infected - Recovered model. 'Recovered' people can't usually get the disease again, either because they are immune or dead (which, agreed, is a funny definition of "recovered" - sometimes the 'R' is taken to mean 'Removed', which might be better).
1) Building on the deadly model here's the extra code for a SIR model (it replaces the
killer if
block):
Note that this relies on another costume, "immune", different in colour from the others (blue, for example). Note also that you may have to end your model run manually by pushing the red stop button next to the green flag in the top-left corner of scratch.
2) We now have two options to play with: the time until the infected person either dies or recovers, and
the probability they die. The block generates
a random number between 1 and 10 and checks whether it is under 5 or not. If it is, the first part of the
if-else
block happens, if it isn't, the second part happens. There's therefore a 50% chance of either.
You can adjust this to change the likelihood of deaths and recovery (something you could also record using the
techniques from Showing disease spread).
3) On top of this, we could introduce a certain percentage of immune sprites at the start of the program, using a similar set of code. Remember back in the basic model when we made sure a sprite was always infected? We can adjust this code to give a probability some of the sprites start off with our immune "blue" costume:
4) We now have one final option to play with: the probability that someone will be immune to start off. This is now a fully realistic epidemic model. Have a play with these three options:
a) the time until the infected person either dies or recovers;
b) the probability they die vs. recover and are immune;
c) the probability that someone will be immune to start off.
What kinds of effects to these different options have? What settings would you give these options for the following diseases:
Note: if you want something more accurate than chances out of ten, you can change the random number maker to give percentages like this:
5) Finally, what is still wrong with the model? What could we still make much more realistic?
When you're done head back to the start page.