# Apple Watch Series 4 ECG and Bayes’ Theorem

## Sep 14, 2018 · 512 words · 3 minutes read apple • bayesian statistics • probability

The Apple Watch Series 4 can perform a single-lead ECG and detect atrial fibrillation. According to the Apple Heart Study by Apple and Stanford, the software can correctly identify 98% of cases of atrial fibrillation (true positives) and 99% of cases of non-atrial fibrillation (true negatives). However, what is the probability of a person having atrial fibrillation when atrial fibrillation is identified by the Apple Watch Series 4?

To answer this let’s use Bayes’ Theorem.

$P(A|B) = \frac{P(B|A)P(A)}{P(B)}$

• $$P(A)$$ is the probability of having atrial fibrillation
• $$P(B)$$ is the probability of a positive test
• $$P(B|A)$$ is the conditional probability of having a positive test when you have atrial fibrillation

We know $$P(B|A)$$ is 0.98 from the Apple Heart Study and according to the CDC the prevalence of atrial fibrillation is 2% among people younger than 65 and 9% 65 and older – so we can use 0.02 for $$P(A)$$. We also know from the Apple Heart Study the probability of the Apple Watch not detecting atrial fibrillation if a person doesn’t have atrial fibrillation is $$P(\neg B|\neg A)$$ = 0.99. However we still need $$P(B)$$, the probability the Apple Watch Series 4 reports atrial fibrillation.

If we had 100,000 random people, we’d expect 98,000 would not have atrial fibrillation. 97,020 (99%) would be correctly identified as without atrial fibrillation and the other 980 (1%) would be predicted to have atrial fibrillation Among the 2,000 people with atrial fibrillation 1,960 (98%) would be correctly identified. So the total number of people predicted to have atrial fibrillation would be 2,940 and we can conclude P(B) is 0.0294.

Predicted atrial fibrillation no atrial fibrillation
atrial fibrillation 1960 980
no atrial fibrillation 40 97020

Now we can apply Bayes’ Theorem:

$0.6667 = \frac{0.98 \cdot 0.02}{0.0294}$

The conditional probability of having atrial fibrillation when the Apple Watch Series 4 detects atrial fibrillation is about 67%. Stated a little differently, this means the probability of the Apple Watch Series 4 detecting atrial fibrillation when the person doesn’t have it is 33%.

Even with 99% sensitivity (correctly identifiying atrial fibrillation when a person has it) and 98% specificity (correctly identifiying no atrial fibrillation when a person doesn’t have it), consumers should be cautious that the Apple Watch Series 4 may mistakenly detect atrial fibrillation when atrial fibrillation isn’t present.

Update (2018-09-15)

The Apple Heart Study findings report the software has a true negative rate of 99% – when the Apple Watch Series 4 detects non-atrial fibrillation it’s correct 99% of the time. So most people don’t have atrial fibrillation (98% of people under 65) and their Apple Watch Series 4 won’t detect atrial fibrillation. But what’s the probability a person has atrial fibrillation but their Apple Watch Series 4 doesn’t detect it?

Among our 100,000 randomly selected people, we’d expect the Apple Watch Series 4 to predict the absence of atrial fibrillation for 97,060 of them. Of these people 40 (0.04%) would actually have atrial fibrillation. So users should feel confident they don’t have atrial fibrillation if the Apple Watch Series 4 doesn’t detect it.