Let's look at an example. We know that about 1% of women who are age 40 have cancer. Let's say that the sensitivity of a screening mammogram is 80%, and it's specificity is 91%? Does this sound like a reasonably good test?
So a 40 year old patient of yours goes in to get a routine mammogram. The result is positive. The questions is: what is the probability that she has breast cancer? (We call this probability the post probability).
Prior probability of breast cancer in this patient: % .
Sensitivity of a screening mammogram: % .
Specificity of a screening mammogram: % .
You can simulate this scenario over and over again in the population of 100 people shown below and by averaging the number of true positives out of all positives, you'll get a good approximation of the post probability.
However, Bayes theorem allows us to calculate that value. Based on the numbers you use above, the post probability of breast cancer in a 40 year old with a positive screening mammogram is %