Explore what it means to do computer simulation with respect to healthcare by writing a simple program that simulates the effect of virus spread. Modify it to see how changing assumptions changes the predictions
try a fun if chaotic unplugged version that involves tossing plastic balls around a room full of people.
Vaccination programmes work best when the majority of the population are vaccinated. One way scientists simulate the effects of disease and vaccination programmes is by using computer simulations. But what is a computer simulation?
Unplugged Simulation of Virus Spread
You can visualise what a simulation is with ping pong balls (or large plastic ball pool balls) bouncing around a crowd. Imagine having a large room full of people. A virus is represented by a ping pong ball, bouncing from person to person, infecting each person it touches. Each person who is hit by a ping pong ball and not already infected becomes infected. That means they toss that ping pong ball back into the crowd to infect more people, but they also toss an extra one too (and then they sit down: dead). Start with a few ping pong balls. Quickly the virus spreads everywhere and lots of people sit down (die).
You have run a physical simulation of how a virus spreads!
Now start again but ‘vaccinate’ 80 per cent of the people first: give them a baseball cap to wear to show who is who. If those people get a ping pong ball, they just destroy it: they infect no one else. Start with the same number of ping pong balls. This time, the virus quickly dies out and only a few people sit down (die). Not only are the vaccinated people protected but they protect many of the un-protected people too who might have died.
In these versions you are assuming each person is potentially coming into contact with anyone in the room as indicated by the balls being tossed around. If you assume people are only coming in to contact with their immediate neighbours (eg the 8 people closest to them) virus spread will be slower. Try an experiment where each infected person randomly passes a ball to half the people round them rather than tossing it. How does that change things?
What other variations can you think up to explore and so virtual experiments you can come up with?
Write your own Computer Simulation of Virus Spread
Now (if you can program) you can write a program to do the same thing, and so simulate and explore the spread of infection, which is easier perhaps than getting a thousand people to chuck ping pong balls about. Create a grid (an array) of 1000 cells. Each represents a person. They can be infected or not. They can also be vaccinated or not. Start with five random cells (so people marked as infected). Run a series of rounds. After each round, a newly infected cell randomly chooses two others to infect. If not infected already and not vaccinated, then they become newly infected. If already infected or vaccinated, they do not pass the infection on.
You can run lots of different experiments with different conditions. For example, experiment with different proportions of people infected at the start or explore what percentage of people need to be vaccinated for the virus to quickly die out. Is 50 per cent enough? You could also change how many people one person infects, or for how long a person can infect others before dying, or as above what happens if people only spread to people close to them. Perhaps they each keep causing new infections for three rounds before stopping instead of only one. In what situations does the virus infect lots of people and when does it die out quickly?
What you are doing here is computer modelling or simulating the effects of the virus in different scenarios, and that is essentially how computer scientists make the predictions that governments use to make decisions about lockdowns and mask wearing, if they are “following the science”. Of course, such models are only as good as the data that goes into them, such as how many other people does each person infect. In reality, this is data provided by surveys, experimental studies, and so on.
This page and issue 27 of the cs4fn magazine have been funded by EPSRC as part of the PAMBAYESIAN project.