Bayes' theorem

From Wikipedia, the free encyclopedia
Jump to: navigation, search


One of the many applications of Bayes’ theorem is Bayesian inference, a particular approach to statistical inference. When applied, the probabilities involved in Bayes’ theorem may have different probability interpretations. With the Bayesian probability interpretation the theorem expresses how a subjective degree of belief should rationally change to account for availability of prior related evidence. Bayesian inference is fundamental to Bayesian statistics.

Bayes’ theorem is named after Rev. Thomas Bayes (/ˈbz/; 1701–1761), who first provided an equation that allows new evidence to update beliefs. It was further developed by Pierre-Simon Laplace, who first published the modern formulation in his 1812 “Théorie analytique des probabilités.” Sir Harold Jeffreys put Bayes’ algorithm and Laplace's formulation on an axiomatic basis. Jeffreys wrote that Bayes’ theorem “is to the theory of probability what the Pythagorean theorem is to geometry.”[1]

Statement of theorem[edit]

Visualization of Bayes' theorem by the superposition of two decision trees





Bayes’ theorem was named after the Reverend Thomas Bayes (1701–1761), who studied how to compute a distribution for the probability parameter of a binomial distribution (in modern terminology). Bayes’ unpublished manuscript was significantly edited by Richard Price before it was posthumously read at the Royal Society. Price edited[3] Bayes’ major work “An Essay towards solving a Problem in the Doctrine of Chances” (1763), which appeared in “Philosophical Transactions,”[4] and contains Bayes’ Theorem. Price wrote an introduction to the paper which provides some of the philosophical basis of Bayesian statistics. In 1765 he was elected a Fellow of the Royal Society in recognition of his work on the legacy of Bayes.[5][6]

The French mathematician Pierre-Simon Laplace reproduced and extended Bayes’ results in 1774, apparently quite unaware of Bayes’ work.[7][8] The Bayesian interpretation of probability was developed mainly by Laplace.[9]

Stephen Stigler suggested in 1983 that Bayes’ theorem was discovered by Nicholas Saunderson, a blind English mathematician, some time before Bayes;[10][11] that interpretation, however, has been disputed.[12] Martyn Hooper[13] and Sharon McGrayne[14] have argued that Richard Price's contribution was substantial:



Cancer at age 65[edit]

Suppose that an individual’s probability of having cancer, assigned according to the general prevalence of cancer, is 1%. This is known as the “base rate” or prior (i.e. before being informed about the particular case at hand) probability of having cancer. Writing C for the event "having cancer", we have . Suppose also that the probability of being 65 years old is 0.2%. We write . Finally, let us suppose next that cancer and age are related in the following way: the probability for someone diagnosed with cancer to be 65 is 0.5%. This is written .

Knowing this, we can calculate the probability of having cancer as a 65-year-old , by applying Bayes' formula:


Possibly more intuitively, in a community of 100,000 people, 1,000 people will have cancer and 200 people will be 65 years old. Of the 1000 people with cancer, only 5 people will be 65 years old. Thus, of the 200 people who are 65 years old, only 5 can be expected to have cancer.

It may come as a surprise that even though being 65 years old increases the risk of having cancer, that person’s probability of having cancer is still fairly low. This is because the base rate of cancer (regardless of age) is low. This illustrates both the importance of base rate, as well as that it is commonly neglected.[15] Base rate neglect leads to serious misinterpretation of statistics; therefore, special care should be taken to avoid such mistakes. Becoming familiar with Bayes’ theorem is one way to combat the natural tendency to neglect base rates.

Drug testing[edit]


Suppose a drug test is 99% sensitive and 99% specific. That is, the test will produce 99% true positive results for drug users and 99% true negative results for non-drug users. Suppose that 0.5% of people are users of the drug. If a randomly selected individual tests positive, what is the probability that he is a user?

Despite the apparent accuracy of the test, if an individual tests positive, it is more likely that they do not use the drug than that they do. This again illustrates the importance of base rates, and how the formation of policy can be egregiously misguided if base rates are neglected.

This surprising result arises because the number of non-users is very large compared to the number of users; thus the number of false positives outweighs the number of true positives. To use concrete numbers, if 1000 individuals are tested, there are expected to be 995 non-users and 5 users. From the 995 non-users, 0.01 × 995 ≃ 10 false positives are expected. From the 5 users, 0.99 × 5 ≃ 5 true positives are expected. Out of 15 positive results, only 5, about 33%, are genuine.


A more complicated example[edit]

The entire output of a factory is produced on three machines. The three machines account for 20%, 30%, and 50% of the output, respectively. The fraction of defective items produced is this: for the first machine, 5%; for the second machine, 3%; for the third machine, 1%. If an item is chosen at random from the total output and is found to be defective, what is the probability that it was produced by the third machine?






P(B) = Σi P(B | Ai) P(Ai) = (0.05)(0.2) + (0.03)(0.3) + (0.01)(0.5) = 0.024.



P(A3 | B) = P(B | A3) P(A3)/P(B) = (0.01)(0.50)/(0.024) = 5/24.




A geometric visualisation of Bayes’ theorem. In the table, the values w, x, y and z give the relative weights of each corresponding condition and case. The figures denote the cells of the table involved in each metric, the probability being the fraction of each figure that is shaded. This shows that P (A |B ) · P (B ) = P (B |A ) · P (A ) i.e. P (A |B ) = P (B |A ) · P (A )/P (B ) . Similar reasoning shows that P (Ā |B ) = P (B |Ā ) · P (Ā )/P (B ) and so forth.


Bayesian interpretation[edit]


For proposition A and evidence B,

  • P (A | B ), the “posterior,” is the degree of belief having accounted for B.


Frequentist interpretation[edit]










Simple form[edit]



(proportionality over A for given B).

In words: posterior is proportional to prior times likelihood.[16]


Adding these two formulas we deduce that


Alternative form[edit]


For an epistemological interpretation:

For proposition A and evidence or background B,[17]

  • P(−A), is the corresponding probability of the initial degree of belief against A: 1 − P(A) = P(−A)
  • P(B | A), the conditional probability or likelihood, is the degree of belief in B, given that the proposition A is true.
  • P(B | −A), the conditional probability or likelihood, is the degree of belief in B, given that the proposition A is false.
  • P(A | B), the posterior probability, is the probability for A after taking into account B for and against A.

Extended form[edit]


In the special case where A is a binary variable:

Random variables[edit]



Simple form[edit]

If X is continuous and Y is discrete,

If X is discrete and Y is continuous,

If both X and Y are continuous,

Extended form[edit]



Bayes’ rule[edit]

Main article: Bayes' rule

Bayes' rule is Bayes’ theorem in odds form.





For events[edit]


For random variables[edit]


See also[edit]


  5. ^ Holland, pp. 46–7.
  7. ^ Laplace refined Bayes’ theorem over a period of decades:
  17. ^ "Bayes' Theorem: Introduction". Trinity University. 

Further reading[edit]

  • Bruss, F. Thomas (2013), “250 years of ‘An Essay towards solving a Problem in the Doctrine of Chance. By the late Rev. Mr. Bayes, communicated by Mr. Price, in a letter to John Canton, A. M. F. R. S.’,” DOI 10.1365/s13291-013-0077-z, Jahresbericht der Deutschen Mathematiker-Vereinigung, Springer Verlag, Vol. 115, Issue 3-4 (2013), 129-133.
  • Gelman, A, Carlin, JB, Stern, HS, and Rubin, DB (2003), “Bayesian Data Analysis,” Second Edition, CRC Press.
  • Grinstead, CM and Snell, JL (1997), “Introduction to Probability (2nd edition),” American Mathematical Society (free pdf available) [1].
  • Hazewinkel, Michiel, ed. (2001), "Bayes formula", Encyclopedia of Mathematics, Springer, ISBN 978-1-55608-010-4 
  • Laplace, P (1774/1986), “Memoir on the Probability of the Causes of Events,” “Statistical Science” 1(3):364–378.
  • Lee, Peter M (2012), “Bayesian Statistics: An Introduction,” 4th edition. Wiley. ISBN 978-1-118-33257-3.
  • Puga JL, Krzywinski M, Altman N (31 March 2015). "Bayes' theorem". Nature Methods. 12 (4): 277–8. 
  • Rosenthal, Jeffrey S (2005), “Struck by Lightning: The Curious World of Probabilities.” HarperCollins. (Granta, 2008. ISBN 9781862079960).
  • Stigler, SM (1986). "Laplace's 1774 Memoir on Inverse Probability". Statistical Science. 1 (3): 359–363. doi:10.1214/ss/1177013620. 
  • Stone, JV (2013), download chapter 1 of “Bayes’ Rule: A Tutorial Introduction to Bayesian Analysis”, Sebtel Press, England.
  • Bayesian Reasoning for Intelligent People An introduction and tutorial to the use of Bayes' theorem in statistics and cognitive science.

External links[edit]