Biostatistics course
- Hypothesis testing
- t-test, ANOVA
- Regression
- Risk of bias?
Bayes theorem
- Prior: P(A)
- i.e. the left rectangle
- Given B
- i.e. bottom left and bottom right rectangle
- Posterior: P(A|B)
- i.e. bottom left / (bottom left + bottom right)
- P(A|B) = P(A)P(B|A) / (P(A)P(B|A) + P(A’)P(B|A’))
- Sometimes expressed as: P(A|B) = P(A)P(B|A) / P(B)
- But often computes P(A)P(B|A) and P(A’)P(B|A’) separately
- e.g. restaurant quality
- Assume 60% chance that a restaurant is good
- P(A) = 0.6, P(A’) = 0.4
- Given a good review in openrice, what is the updated probability?
- Find P(A|B)
- If restaurant is good, 80% chance it will get a good review
- P(B|A) = 0.8
- If restaurant is bad, 20% chance it will get a good review
- P(B|A’) = 0.2
- P(A|B) = 0.6*0.8 / (0.6*0.8 + 0.4*0.2) = 0.857 (higher than prior)
- e.g. Covid test
- Assume 30% people have Covid
- P(A) = 0.3, P(A’) = 0.7
- Given a positive test, what is the updated probability?
- Sensitivity = 80% (real positive detected as positive)
- P(B|A) = 0.8
- Specificity = 90% (real negative detected as negative)
- P(B|A’) = 0.1
- P(A|B) = 0.3*0.8 / (0.3*0.8 + 0.7*0.1) = 0.774 (higher than prior)
Bayes factor
- Test result indicates disease
- Test result tells the probability of disease
- Test result updates the probability of disease
- Computation
- Remember the rectangle
- P(D|+) = P(D)P(+|D) / (P(D)P(+|D) + P(ND)P(+|ND))
- P(D|+) = Prior * sensitivity / (Prior * sensitivity + (1-prior) * false positive rate)
- How to compute faster?
- If Prior << 1
- Approximate 1-prior = 1
- Approximate prior * sensitivity << (1-prior) * false positive rate
- P(D|+) = Prior * sensitivity / false positive rate
- Define Bayes factor = sensitivity / false positive rate
- P(D|+) = Prior * Bayes factor
- But limited to prior << 1
- Can we do even better?
- Remember odds? Odds = P / (1-P)
- O(D|+) = P(D|+) / (1-P(D|+))
- = Prior * sensitivity / (1-prior) * false positive rate
- = O(D) * Bayes factor
- Comment: formula is neat, good for computation
- Very nice thought from 3B1B
- The term ‘false positive rate’ is often misinterpreted
- False positive rate = P(+|ND) = 1-P(-|ND) (i.e. 1-specificity)
- If specificity is 90%, false positive rate is 10%
- In clinical situation, suppose test result is positive
- People misinterpret this as ‘10% chance that the test result is wrong’
- In probability, it is often more intuition to think 50% probability = in 100 people,
50 people will…
- e.g. typhoon: in 100 typhoon with this track forecast, 90 typhoons will
fall in the region
- e.g. CI: in 100 experiments, 95 CI will contain the true mean
- e.g. false positive rate: in 100 people that get a positive test result, 10
people are actually healthy
Probability distribution 1, 2