# Bayesian analysis: science’s best attempt at fortune telling

## Using math to model the future can help us get a clearer picture of how diseases spread

**By ****Mike Irvine**** **| Postdoctoral research fellow at the University of British Columbia and the British Columbia Centre for Disease Control

I’ve got a question for you: What is the risk an individual will get HIV? It seems like a simple enough problem to solve. Do some research, crunch a few numbers and out pops a percentage. But it’s not so easy. Take the (made-up) Jake and Matt as an example.

Jake is 30 years old and has had one sex partner in the last year. He uses condoms. Matt is also 30 years old, has had 10 sex partners in the last year and doesn’t tend to use condoms. What’s the risk Jake may become infected with HIV? How about Matt?

But it gets even more complicated. If Matt regularly gets tested for HIV, he would have the option to get treated, which can help him prevent further spreading of HIV. How can we show how many future cases we stopped by treating Matt and preventing him from passing on the virus?

That’s where mathematical modelling comes in.

A scenario where a virus spreads through a group of people — what we call a complex system — is incredibly intricate. A mathematical model can be used to create a representation of a complex system. In our case, we can think about a population and divide them up by some key personality traits: how often they get tested, whether they use a condom, and whether they’re infected or not.

We can then use these pieces of information estimate how likely it is for an individual like Jake or Matt would get HIV in a given year. But the model allows us to do even more. We can see how different interventions, like increasing testing, can impact entire communities.

However, modelling comes with challenges. One issue with trying to model such a complex epidemic is that we need to know how often people change traits. How often does an individual go from using condoms to not using condoms? How often do people go from being uninfected to infected? This is where data comes to the rescue. Surveys help us understand how sexual behaviours change, allowing scientists to determine what someone’s risk of getting HIV is. But this data is not always accurate. So the question becomes how to use this data to help build our model. To do this, we need a tool called Bayesian analysis.

Bayesian analysis allows scientists to estimate how uncertain we are about our world. Imagine we wanted to know if it was raining without going outside. We could check an app, but it might only be accurate 66 per cent of the time and wrong 10 per cent of the time. What this means is that the probability the app says it’s raining when it actually is, is about two in three. The probability the app says it’s raining when it’s not is one in 10. We may also know that because it’s spring there’s a (let’s say) 70 per cent chance on any given day it’s raining. Bayesian analysis allows you to take these probabilities and convert them into the actual probability it’s raining given what the app says. In this case, the probability it is raining is 94%.

We can think about this to calculate the average number of sexual partners someone might have in a year. According to a survey this number could be two, but with some uncertainty (people aren’t always truthful about their sex lives). This represents our prior knowledge before looking at our model. Now if we simulate an epidemic, using two sexual partners a year as our starting point, we find 100 new infections occur every year. We can now match this with the known number of diagnoses. If it’s different, we can update our starting point — the number of sexual partners. Bayesian analysis gives us a consistent and reliable way of doing this kind of math.

Remember Jake and Matt, our two hypothetical people? It turns out they aren’t so hypothetical. In our recent paper, the modelling team at UBC and the BC Centre for Disease Control used Bayesian analysis to compare a recent sexual health survey with HIV diagnosis data for men who have sex with men in Vancouver. We found that Vancouver has consistently high HIV testing rates, which means people are very aware of their HIV status. Our model showed that if there was even more testing in Vancouver, 95 infections could be prevented over the next 30 years. With roughly 100 cases diagnosed every year within Metro Vancouver, this number may not seem like much, but it does show that testing is currently quite effective in Vancouver and increased access may be more effective in other locations.

Mathematical modelling gives us the power to peer into the future and see how different interventions, like increased testing, could help patients. This evidence-based approach can help inform decisions in hospitals and legislatures in B.C. and beyond. With these tools, we can make better decisions, not only to help end the HIV epidemic but to solve many of our most pressing issues.

Please share this story with your friends and hit the applause button.

Follow UBC Science on Twitter, Facebook and subscribe to our newsletter.