May 18, 2020 · medicine disrupt ml

Disrupt Medicine: Bayesian Machine

What originally inspired this post, was my wish to talk about the math taught during medical school. However, after thinking about it, I realized I could start a mini-series on how tech could play a role in changing healthcare and medicine. While it was difficult to find spare time to blog during the school year, I believe this summer will allow me to create some more meaningful blog posts.

So the math taught during medical school is mostly unexciting, and I've noticed that of the few mathematical tools that show up, the equations are plug-and-chug and rarely show any derivation from the basics. Yeah, I'm a bit of a stickler for showing the steps 😅. But what really intrigues me, is the underlying Bayesian modeling in our Clinical Reasoning course. The literal phrase "Bayesian" is mentioned only a few times, but the school really hammers in the concepts of Risk, Pre-test Probability, and Post-test Probability, along with a whole bunch of statistical tests. For the unintroduced, here's a simple example of what Bayesian inference is and why it's so applicable to medicine. As a warning, these probabilities aren't accurate.

Patient Case

A male patient walks into the hospital complaining of chest pain. Before you even start any diagnoses, let's say you know from daily routine that of the males presenting with chest pain, 40% have anxiety, while 9% have a form of coronary heart disease (CHD), such as a heart attack. This is called the prior distribution, i.e. the initial probabilities for each disease before you do any tests. You can't assume he has anxiety and discharge him! You need to make sure that he isn't having a heart attack. So you decide to order something called a troponin test (actually two tests), which measures the amount of damage in the patient's heart muscles. It comes back negative, so based on this new information and your clinical knowledge, you now believe the probability of heart disease to be very low, and anxiety to be high. You have just created a posterior distribution of the diseases, based on the troponin test, i.e. the condition.

"Prior to Posterior", "Pre-test to Post-test", this is Bayesian inference in action! Everybody uses it to some degree, however, formalizing this gut feeling through statistics allows us to do some crazy stuff, like compute actual numerical probabilities.

Bayesian Inference

Let \( \text{H} \) indicate having CHD. Based on our past observations, we know:

\( P(\text{H}) = \text{Probability of CHD} \) \( \text{in} \) \( \text{our} \) \( \text{Patient} \) \( \text{=} \) \( \text{9\%} \)

We want to find out the new probability of CHD conditioned on our troponin test that came back negative. Let \( \text{T}^{c} \) be the negative test outcome. Bayes' theorem gives us this big honking equation:

\( P(\text{H}| \text{T}^{{c}}) = \text{Probability of CHD} \) \( \text{given} \) \( \text{neg.} \) \( \text{Troponin} \)

\[ \begin{aligned} &= \frac{P(\text{T}^{{c}} |\text{H})P(\text{H})}{P(\text{T}^{{c}}|\text{H})P(\text{H}) + P(\text{T}^{{c}}|\text{H}^{{c}})P(\text{H}^{{c}})}\\ \\ &= \frac{\text{(1 - sens)} \cdot P(\text{H})}{\text{(1 - sens)} \cdot P(\text{H}) + \text{spec} \cdot P(\text{H}^{{c}})} \end{aligned}\]

Where can we get sensitivity and specificity of the troponin test? From research literature! After plugging in 75% sensitivity and 91% specificity, we get

\[ = \frac{\text{(1 - 0.75)} \cdot 0.09}{\text{(1 - 0.75)} \cdot 0.09 + \text{0.91} \cdot \text{(1 - 0.09)}}\\~\\ = 2.6\% \]

Conclusion

At this point, most doctors would have done an ECG etc., and would be comfortable discharging the patient. We stuck to only one outcome here (coronary heart disease), but Bayesian inference is powerful enough to modify all the outcome probabilities, such as anxiety, in one step. Accurately diagnosing a patient's symptoms is one of the main requirements of a doctor, and Bayesian inference is a major tool.

So that's essentially what medicine boils down to, a big Bayesian machine. Of course, there are more aspects to medicine that are just as important, such as empathy, listening, and compassion (I'm not heartless, I promise). Overall, doctors attempt to accurately predict the initial risk of disease (Prior Distribution), conduct the right medical tests (Condition) that will morph our distribution, and finally treat based on the new list of probable diseases (Posterior Distribution). In some later posts, I'll be exploring how machine learning models can learn these distributions.