Article
Simulations in health and medicine
A new illness spreads through a town. Should the schools close? Should people be vaccinated? You cannot try every plan on real people and wait to see who gets sick. Doctors and scientists use simulations to compare plans before anyone is at risk.
An illness spreading through a town
Let us simulate a town of 1,000 people. To keep it simple, the program makes these assumptions:
- Every person is equally likely to meet every other person.
- Each sick person meets 2 people a day, and is sick for one day only. Then they recover and cannot catch it again.
- Some people are protected (for example by a vaccine). They cannot catch the illness.
On each day, the new sick people are the people that today's sick meet who are still healthy. The share of healthy people is healthy / population, so:
new = sick × contacts × healthy / population
total counts everyone who has been sick so far, so the healthy people are the ones who are neither protected nor in total. int cuts off the part after the decimal point, because there is no such thing as 0.9 of a person. Here are the first days:
| Day | Sick people met | New sick | total |
|---|---|---|---|
| (start) | 10 | 10 | |
| 1 | 10 × 2 × 990 / 1000 = 19.8 | 19 | 29 |
| 2 | 19 × 2 × 971 / 1000 = 36.9 | 36 | 65 |
| 3 | 36 × 2 × 935 / 1000 = 67.3 | 67 | 132 |
The program prints 868. Notice that the numbers rise fast, and then slow down. The illness runs out of healthy people to catch it.
Check your understanding
A town simulation counts how many people get sick. Which pair of runs is a fair test of whether protecting 500 people helps?
Change one setting, run again
The power of a simulation is that you can ask "what if?" Change one setting, run again, and compare. This is called a fair test: if two things change together, you cannot tell which one made the difference.
Testing a plan with a simulation
Choose settings
Start with the town as it is.
runRun it
The program counts who gets sick.
compareChange one setting
For example, protect 500 people.
run it againCompare the results
Which plan helped most?
Set protected to 250, then to 500, and run it each time. Then put protected back to 0 and set contacts to 1.
protected | contacts | People who got sick |
|---|---|---|
| 0 | 2 | 868 |
| 250 | 2 | 408 |
| 500 | 2 | 55 |
| 0 | 1 | 55 |
Protecting half the town and asking everyone to meet only one person a day give the same result in this model. A health leader could use this to compare plans and their costs. But the leader must remember that this is a prediction from a very simple model.
Hospitals and medicines
Illnesses are not the only thing that doctors simulate.
- A hospital plan. Patients arrive at an emergency room at different times. A simulation can test "What if there is one more nurse in the evening?" or "What if a new room opens?" and report how long people wait. It can be tried a hundred times without making one real patient wait.
- Drugs. A medicine is made of tiny molecules. A simulation can check how thousands of possible molecules fit with a part of a germ, and how two medicines taken together may affect each other. It picks the few best ideas to test in a laboratory. This saves time, and keeps people safe from weak ideas.
Simulations do not replace tests on people. A body is far more complicated than any model, so a new medicine is still tested carefully on real patients.
Limits and bias
The answer depends on the assumptions. If sick people really meet 5 people, not 2, the numbers change completely. A simulation built from data about only one group of people, say adults, may give wrong answers for children. That is bias: the model leaves out people who are different. So medical simulations are built with data from many kinds of people, checked against real results, and read as "what might happen", not "what will happen".
Check your understanding
A simulation predicts that 55 people in a town will get sick. Which statement is correct?
Worked example
A town leader sees this table from a simulation of 1,000 people.
| Plan | People who got sick |
|---|---|
| Do nothing | 868 |
| Vaccinate 250 people | 408 |
| Vaccinate 500 people | 55 |
- What did the simulation do? It imitated the spread of the illness, so the plans were tested without risking anyone.
- Which plan works best in the model? The plan with 500 vaccinated people. The number of sick people dropped from 868 to 55.
- Can the leader be sure that exactly 55 people will get sick? No. The result follows from the assumptions (for example, that each sick person meets 2 people a day).
Common mistakes
- "The simulation tells the number who will get sick." It tells the number in the model. Real numbers will differ.
- Changing two settings and comparing. Change one at a time.
- "A simulation can replace a clinical test." It narrows the choices. Real testing is still needed.
- "No bias is possible, because a computer did it." A computer follows the choices and data of the people who made the model.
- Forgetting that "protected" is an assumption. Here the model says a vaccine protects fully. Real vaccines may not.
On the exam
Questions ask you to explain how a simulation helps (testing plans safely, comparing outcomes by changing one setting), what a limitation is (it uses assumptions, so results may differ from real life), and where bias could come from (data that left out a group of people). Read the question for the words "benefit" and "limitation".
Key words
Fair test: changing only one setting between two runs, so you know what caused any difference.
Protected: unable to catch the illness, for example after a vaccine. In the model this is a simple yes or no.
Prediction: a statement of what might happen, found by running a model.