vignettes/stat0002-ch4-more-probability-vignette.Rmd
stat0002-ch4-more-probability-vignette.Rmd
This vignette provides some R code that is related to some of the content of Chapter 4 of the STAT0002 notes, namely to Bayes’ theorem.
A classic application of Bayes’ theorem arises in screening for a disease of condition. This screening test does not determine whether or not the person has the disease. It is used to identify individuals who have a relatively high probability of having the disease and therefore may benefit from a more definitive diagnostic test.
Consider a person selected at random from a population to take the screening test. Let
The mathematical properties of the test are governed by the following probabilities:
What matters to a person who takes the test is their probability of having the disease given the result of their test. We use Bayes’ theorem to calculate the relevant probabilities. These probabilities depend on the pre-test, or prior, probability that the person has the disease. In the current context, where the person is selected at random from a population, is the proportion of population who have the disease.
A screening test for type 2 diabetes (hereafter referred to simply as diabetes) is based on blood glucose levels after a 12-hour period of fasting. A person tests positive for diabetes if their fasting blood glucose level is greater than 6.5 mmol/L. Among people with untreated diabetes the probability is . Among people who do not have diabetes the probability is much smaller, so that the sensitivity of the test is .
We suppose in a population of interest, perhaps people over 50 years of age, that , that is, of this population have type 2 diabetes.
If a person tests positive then what is their probability of having diabetes?
Bayes’ theorem gives
where we have used the law of total probability in the denominator. Substituting the values of the probabilities, noting that , gives
If a person tests negative then what is their probability of not having diabetes?
Bayes’ theorem gives
where .