Bayes' theorem: Difference between revisions
imported>The wub →Interpretations: this is irrelevant if someone doesn't get the reference, and redundant if they do |
imported>Constant314 Reverted good faith edits by Xjwiki (talk): Use the preview button to check formatting before you publish. |
||
| Line 3: | Line 3: | ||
{{Bayesian statistics}} | {{Bayesian statistics}} | ||
'''Bayes' theorem''' (alternatively '''Bayes' law''' or '''Bayes' rule''', after [[Thomas Bayes]]) gives a mathematical rule for inverting [[Conditional probability|conditional probabilities]], allowing | '''Bayes' theorem''' (alternatively '''Bayes' law''' or '''Bayes' rule''', after [[Thomas Bayes]] ({{IPAc-en|b|eɪ|z}})) gives a mathematical rule for inverting [[Conditional probability|conditional probabilities]], allowing the probability of a cause to be found given its effect. For example, with Bayes' theorem, the probability that a patient has a disease given that they tested positive for that disease can be found using the probability that the test yields a positive result when the disease is present. The theorem was developed in the 18th century by Bayes and independently by [[Pierre-Simon Laplace]]. | ||
One of Bayes' theorem's many applications is [[Bayesian inference]], an approach to [[statistical inference]], where it is used to invert the probability of [[Realization (probability)|observations]] given a model configuration (i.e., the [[likelihood function]]) to obtain the probability of the model configuration given the observations (i.e., the [[posterior probability]]). | One of Bayes' theorem's many applications is [[Bayesian inference]], an approach to [[statistical inference]], where it is used to invert the probability of [[Realization (probability)|observations]] given a model configuration (i.e., the [[likelihood function]]) to obtain the probability of the model configuration given the observations (i.e., the [[posterior probability]]). | ||
| Line 9: | Line 9: | ||
== History == | == History == | ||
Bayes' theorem is named after [[Thomas Bayes]] | Bayes' theorem is named after [[Thomas Bayes]], a minister, statistician, and philosopher. Bayes used conditional probability to provide an algorithm (his Proposition 9) that uses evidence to calculate limits on an unknown parameter. His work was published in 1763 as ''[[An Essay Towards Solving a Problem in the Doctrine of Chances]]''. Bayes studied how to compute a distribution for the probability parameter of a [[binomial distribution]] (in modern terminology). After Bayes's death, his family gave his papers to a friend, the minister, philosopher, and mathematician [[Richard Price]]. | ||
Price significantly edited the unpublished manuscript for two years before sending it to a friend who read it aloud at the [[Royal Society]] on 23 December 1763.<ref name="Liberty's Apostle">{{cite book |last1=Frame |first1=Paul |url=https://www.uwp.co.uk/book/libertys-apostle-richard-price-his-life-and-times/ |title=Liberty's Apostle |date=2015 |publisher=University of Wales Press |isbn=978-1783162161 |location=Wales |pages=44 |language=en |access-date=23 February 2021}}</ref> Price edited<ref>{{cite book |first = Richard |last = Allen |title=David Hartley on Human Nature |url = https://books.google.com/books?id=NCu6HhGlAB8C&pg=PA243 |access-date=16 June 2013 |year=1999 |publisher=SUNY Press |isbn=978-0791494516 |pages=243–244}}</ref> Bayes's major work "An Essay Towards Solving a Problem in the Doctrine of Chances" (1763), which appeared in ''[[Philosophical Transactions]]'',<ref name="Price1763">{{cite journal |doi=10.1098/rstl.1763.0053 |journal=Philosophical Transactions of the Royal Society of London |volume=53 |year=1763 |pages=370–418 |title=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.|author1=Bayes, Thomas |author2=Price, Richard |name-list-style=amp |doi-access=free }}</ref> and contains Bayes' theorem. Price wrote an introduction to the paper that provides some of the philosophical basis of [[Bayesian statistics]] and chose one of the two solutions Bayes offered. In 1765, Price was elected a Fellow of the Royal Society in recognition of his work on Bayes's legacy.<ref name="Holland46">Holland, pp. 46–7.</ref><ref>{{cite book |first = Richard |last = Price |title=Price: Political Writings |url = https://books.google.com/books?id=xdH-gjy2vzUC&pg=PR23 |access-date=16 June 2013 |year=1991 |publisher = Cambridge University Press |isbn = 978-0521409698 |page = xxiii }}</ref> On 27 April, a letter sent to his friend [[Benjamin Franklin]] was read out at the Royal Society, and later published, in which Price applies this work to population and computing 'life-annuities'.<ref name="EB1911">{{harvnb|Mitchell|1911|p=314}}.</ref> | Price significantly edited the unpublished manuscript for two years before sending it to a friend who read it aloud at the [[Royal Society]] on 23 December 1763.<ref name="Liberty's Apostle">{{cite book |last1=Frame |first1=Paul |url=https://www.uwp.co.uk/book/libertys-apostle-richard-price-his-life-and-times/ |title=Liberty's Apostle |date=2015 |publisher=University of Wales Press |isbn=978-1783162161 |location=Wales |pages=44 |language=en |access-date=23 February 2021}}</ref> Price edited<ref>{{cite book |first = Richard |last = Allen |title=David Hartley on Human Nature |url = https://books.google.com/books?id=NCu6HhGlAB8C&pg=PA243 |access-date=16 June 2013 |year=1999 |publisher=SUNY Press |isbn=978-0791494516 |pages=243–244}}</ref> Bayes's major work "An Essay Towards Solving a Problem in the Doctrine of Chances" (1763), which appeared in ''[[Philosophical Transactions]]'',<ref name="Price1763">{{cite journal |doi=10.1098/rstl.1763.0053 |journal=Philosophical Transactions of the Royal Society of London |volume=53 |year=1763 |pages=370–418 |title=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.|author1=Bayes, Thomas |author2=Price, Richard |name-list-style=amp |doi-access=free }}</ref> and contains Bayes' theorem. Price wrote an introduction to the paper that provides some of the philosophical basis of [[Bayesian statistics]] and chose one of the two solutions Bayes offered. In 1765, Price was elected a Fellow of the Royal Society in recognition of his work on Bayes's legacy.<ref name="Holland46">Holland, pp. 46–7.</ref><ref>{{cite book |first = Richard |last = Price |title=Price: Political Writings |url = https://books.google.com/books?id=xdH-gjy2vzUC&pg=PR23 |access-date=16 June 2013 |year=1991 |publisher = Cambridge University Press |isbn = 978-0521409698 |page = xxiii }}</ref> On 27 April, a letter sent to his friend [[Benjamin Franklin]] was read out at the Royal Society, and later published, in which Price applies this work to population and computing 'life-annuities'.<ref name="EB1911">{{harvnb|Mitchell|1911|p=314}}.</ref> | ||
Independently of Bayes, [[Pierre-Simon Laplace]] used conditional probability to formulate the relation of an updated [[posterior probability]] from a prior probability, given evidence. He reproduced and extended Bayes's results in 1774, apparently unaware of Bayes's work, and summarized his results in ''[[Théorie analytique des probabilités]]'' (1812).{{NoteTag |1 = Laplace refined Bayes's theorem over a period of decades: | Independently of Bayes, [[Pierre-Simon Laplace]] used conditional probability to formulate the relation of an updated [[posterior probability]] from a [[prior probability]], given evidence. He reproduced and extended Bayes's results in 1774, apparently unaware of Bayes's work, and summarized his results in ''[[Théorie analytique des probabilités]]'' (1812).{{NoteTag |1 = Laplace refined Bayes's theorem over a period of decades: | ||
* Laplace announced his independent discovery of Bayes' theorem in: Laplace (1774) "Mémoire sur la probabilité des causes par les événements", "Mémoires de l'Académie royale des Sciences de MI (Savants étrangers)", '''4''': 621–656. Reprinted in: Laplace, "Oeuvres complètes" (Paris, France: Gauthier-Villars et fils, 1841), vol. 8, pp. 27–65. Available on-line at: [http://gallica.bnf.fr/ark:/12148/bpt6k77596b/f32.image Gallica]. Bayes' theorem appears on p. 29. | * Laplace announced his independent discovery of Bayes' theorem in: Laplace (1774) "Mémoire sur la probabilité des causes par les événements", "Mémoires de l'Académie royale des Sciences de MI (Savants étrangers)", '''4''': 621–656. Reprinted in: Laplace, "Oeuvres complètes" (Paris, France: Gauthier-Villars et fils, 1841), vol. 8, pp. 27–65. Available on-line at: [http://gallica.bnf.fr/ark:/12148/bpt6k77596b/f32.image Gallica]. Bayes' theorem appears on p. 29. | ||
* Laplace presented a refinement of Bayes' theorem in: Laplace (read: 1783 / published: 1785) "Mémoire sur les approximations des formules qui sont fonctions de très grands nombres", "Mémoires de l'Académie royale des Sciences de Paris", 423–467. Reprinted in: Laplace, "Oeuvres complètes" (Paris, France: Gauthier-Villars et fils, 1844), vol. 10, pp. 295–338. Available on-line at: [http://gallica.bnf.fr/ark:/12148/bpt6k775981/f218.image.langEN Gallica]. Bayes' theorem is stated on page 301. | * Laplace presented a refinement of Bayes' theorem in: Laplace (read: 1783 / published: 1785) "Mémoire sur les approximations des formules qui sont fonctions de très grands nombres", "Mémoires de l'Académie royale des Sciences de Paris", 423–467. Reprinted in: Laplace, "Oeuvres complètes" (Paris, France: Gauthier-Villars et fils, 1844), vol. 10, pp. 295–338. Available on-line at: [http://gallica.bnf.fr/ark:/12148/bpt6k775981/f218.image.langEN Gallica]. Bayes' theorem is stated on page 301. | ||
* See also: Laplace, "Essai philosophique sur les probabilités" (Paris, France: Mme. Ve. Courcier [Madame veuve (i.e., widow) Courcier], 1814), [https://books.google.com/books?id=rDUJAAAAIAAJ&pg=PA10 page 10]. English translation: Pierre Simon, Marquis de Laplace with F. W. Truscott and F. L. Emory, trans., "A Philosophical Essay on Probabilities" (New York, New York: John Wiley & Sons, 1902), [https://google.com/books?id=WxoPAAAAIAAJ&pg=PA15#v=onepage p. 15].}}<ref>{{cite book |title = Classical Probability in the Enlightenment |first=Lorraine |last=Daston |publisher=Princeton Univ Press |year=1988 |page=268 |isbn=0691084971 |url = https://books.google.com/books?id=oq8XNbKyUewC&pg=PA268 }}</ref> The [[Bayesian probability|Bayesian interpretation]] of probability was developed mainly by Laplace.<ref>{{cite book |last1=Stigler |first1=Stephen M. |chapter=Inverse Probability |pages=99–138 |chapter-url={{Google books|M7yvkERHIIMC|page=99|plainurl=yes}} |title=The History of Statistics: The Measurement of Uncertainty Before 1900 |date=1986 |publisher=Harvard University Press |isbn=978-0674403413 }}</ref> | * See also: Laplace, "Essai philosophique sur les probabilités" (Paris, France: Mme. Ve. Courcier [Madame veuve (i.e., widow) Courcier], 1814), [https://books.google.com/books?id=rDUJAAAAIAAJ&pg=PA10 page 10]. English translation: Pierre Simon, Marquis de Laplace with F. W. Truscott and F. L. Emory, trans., "A Philosophical Essay on Probabilities" (New York, New York: John Wiley & Sons, 1902), [https://google.com/books?id=WxoPAAAAIAAJ&pg=PA15#v=onepage p. 15].}}<ref>{{cite book |title = Classical Probability in the Enlightenment |first=Lorraine |last=Daston |publisher=Princeton Univ Press |year=1988 |page=268 |isbn=0691084971 |url = https://books.google.com/books?id=oq8XNbKyUewC&pg=PA268 }}</ref> The [[Bayesian probability|Bayesian interpretation]] of probability was developed mainly by Laplace.<ref>{{cite book |last1=Stigler |first1=Stephen M. |authorlink=Stephen Stigler |chapter=Inverse Probability |pages=99–138 |chapter-url={{Google books|M7yvkERHIIMC|page=99|plainurl=yes}} |title=The History of Statistics: The Measurement of Uncertainty Before 1900 |date=1986 |publisher=Harvard University Press |isbn=978-0674403413 }}</ref> | ||
About 200 years later, [[Harold Jeffreys|Sir Harold Jeffreys]] put Bayes's algorithm and Laplace's formulation on an [[axiomatic system|axiomatic]] basis, writing in a 1973 book that Bayes' theorem "is to the theory of probability what the [[Pythagorean theorem]] is to geometry".<ref name="Jeffreys1973">{{cite book |last=Jeffreys |first=Harold |author-link=Harold Jeffreys |year=1973 |title=Scientific Inference |url=https://archive.org/details/scientificinfere0000jeff |url-access=registration |publisher=[[Cambridge University Press]] |edition=3rd |isbn=978-0521180788 |page=[https://archive.org/details/scientificinfere0000jeff/page/31 31]}}</ref> | About 200 years later, [[Harold Jeffreys|Sir Harold Jeffreys]] put Bayes's algorithm and Laplace's formulation on an [[axiomatic system|axiomatic]] basis, writing in a 1973 book that Bayes' theorem "is to the theory of probability what the [[Pythagorean theorem]] is to geometry".<ref name="Jeffreys1973">{{cite book |last=Jeffreys |first=Harold |author-link=Harold Jeffreys |year=1973 |title=Scientific Inference |url=https://archive.org/details/scientificinfere0000jeff |url-access=registration |publisher=[[Cambridge University Press]] |edition=3rd |isbn=978-0521180788 |page=[https://archive.org/details/scientificinfere0000jeff/page/31 31]}}</ref> | ||
[[Stephen Stigler]] used a Bayesian argument to conclude that Bayes' theorem was discovered by [[Nicholas Saunderson]], a blind English mathematician, some time before Bayes,<ref>{{cite journal |last = Stigler |first = Stephen M. |year = 1983 |title = Who Discovered Bayes' Theorem? |journal = The American Statistician |volume = 37 |issue = 4 |pages = 290–296 |doi = 10.1080/00031305.1983.10483122 }}</ref><ref name="Stats, Data and Models">{{cite book |title = Stats, Data and Models |last1 = de Vaux |first1=Richard |last2=Velleman |first2=Paul |last3=Bock |first3=David |year=2016 |publisher=Pearson |isbn = 978-0321986498 |edition=4th |pages=380–381 }}</ref> but that is disputed.<ref>{{cite journal |last = Edwards |first = A. W. F. | year = 1986 | title = Is the Reference in Hartley (1749) to Bayesian Inference? |journal = The American Statistician |volume = 40 |issue = 2 |pages = 109–110 |doi = 10.1080/00031305.1986.10475370 }}</ref> | [[Stephen Stigler]] used a Bayesian argument to conclude that Bayes' theorem was discovered by [[Nicholas Saunderson]], a blind English mathematician, some time before Bayes,<ref>{{cite journal |last = Stigler |first = Stephen M. |authorlink = Stephen Stigler |year = 1983 |title = Who Discovered Bayes' Theorem? |journal = The American Statistician |volume = 37 |issue = 4 |pages = 290–296 |doi = 10.1080/00031305.1983.10483122 }}</ref><ref name="Stats, Data and Models">{{cite book |title = Stats, Data and Models |last1 = de Vaux |first1=Richard |last2=Velleman |first2=Paul |last3=Bock |first3=David |year=2016 |publisher=Pearson |isbn = 978-0321986498 |edition=4th |pages=380–381 }}</ref> but that is disputed.<ref>{{cite journal |last = Edwards |first = A. W. F. | year = 1986 | title = Is the Reference in Hartley (1749) to Bayesian Inference? |journal = The American Statistician |volume = 40 |issue = 2 |pages = 109–110 |doi = 10.1080/00031305.1986.10475370 }}</ref> | ||
Martyn Hooper<ref>{{cite journal |last = Hooper |first = Martyn |s2cid = 153704746 | year = 2013 |title = Richard Price, Bayes' theorem, and God |journal = Significance |volume = 10 |issue = 1 |pages = 36–39 |doi = 10.1111/j.1740-9713.2013.00638.x |doi-access = free }}</ref> and Sharon McGrayne<ref name="mcgrayne2011theory">{{cite book |last = McGrayne |first = S. B. |title = The Theory That Would Not Die: How Bayes' Rule Cracked the Enigma Code, Hunted Down Russian Submarines & Emerged Triumphant from Two Centuries of Controversy |url = https://archive.org/details/theorythatwouldn0000mcgr |url-access = registration |publisher=[[Yale University Press]] |year=2011 |isbn=978-0300188226 }}</ref> have argued that Richard Price's contribution was substantial: | Martyn Hooper<ref>{{cite journal |last = Hooper |first = Martyn |s2cid = 153704746 | year = 2013 |title = Richard Price, Bayes' theorem, and God |journal = Significance |volume = 10 |issue = 1 |pages = 36–39 |doi = 10.1111/j.1740-9713.2013.00638.x |doi-access = free }}</ref> and Sharon McGrayne<ref name="mcgrayne2011theory">{{cite book |last = McGrayne |first = S. B. |title = The Theory That Would Not Die: How Bayes' Rule Cracked the Enigma Code, Hunted Down Russian Submarines & Emerged Triumphant from Two Centuries of Controversy |url = https://archive.org/details/theorythatwouldn0000mcgr |url-access = registration |publisher=[[Yale University Press]] |year=2011 |isbn=978-0300188226 }}</ref> have argued that Richard Price's contribution was substantial: | ||
{{Blockquote|By modern standards, we should refer to the Bayes–Price rule. Price discovered Bayes's work, recognized its importance, corrected it, contributed to the article, and found a use for it. The modern convention of employing Bayes's name alone is unfair but so entrenched that anything else makes little sense.<ref name="mcgrayne2011theory" />|sign=|source=}} | {{Blockquote|By modern standards, we should refer to the Bayes–Price rule. Price discovered Bayes's work, recognized its importance, corrected it, contributed to the article, and found a use for it. The modern convention of employing Bayes's name alone is unfair but so entrenched that anything else makes little sense.<ref name="mcgrayne2011theory" />|sign=|source=}} | ||
[[F. Thomas Bruss]] reviewed Bayes' | [[F. Thomas Bruss]] reviewed Bayes's "An essay towards solving a problem in the doctrine of chances" as communicated by Price.<ref>{{cite journal|last = Bruss |first = F. Thomas|year = 2014 |title = 250 years of "An essay towards solving a problem in the doctrine of chances" communicated by Price to the Royal Society. |journal = Jahresbericht der Deutschen Mathematiker-Vereinigung |volume = 115|issue =3 |pages = 129–133| doi=10.1365/s13291-013-0069-z }}</ref> He agrees with Stigler's analysis in many points, but not as far as the question of priority is concerned. Bruss underlines the intuitive part of Bayes's formula and adds independent arguments of Bayes's probable motivation for his work. He concludes that, unless the contrary is really proven, we are entitled to be faithful to the name "Bayes' Theorem" or "Bayes' formula". | ||
==Statement of theorem== | ==Statement of theorem== | ||
| Line 42: | Line 42: | ||
* <math>P(A\vert B)</math> is a [[conditional probability]]: the probability of event <math>A</math> occurring given that <math>B</math> is true. It is also called the [[posterior probability]] of <math>A</math> given <math>B</math>. | * <math>P(A\vert B)</math> is a [[conditional probability]]: the probability of event <math>A</math> occurring given that <math>B</math> is true. It is also called the [[posterior probability]] of <math>A</math> given <math>B</math>. | ||
* <math>P(B\vert A)</math> is also a conditional probability: the probability of event <math>B</math> occurring given that <math>A</math> is true. It can also be interpreted as the [[Likelihood function|likelihood]] of <math>A</math> given a fixed <math>B | * <math>P(B\vert A)</math> is also a conditional probability: the probability of event <math>B</math> occurring given that <math>A</math> is true. It can also be interpreted as the [[Likelihood function|likelihood]] of <math>A</math> given a fixed <math>B</math>. | ||
* <math>P(A)</math> and <math>P(B)</math> are the probabilities of observing <math>A</math> and <math>B</math> respectively without any given conditions; they are known as the | * <math>P(A)</math> and <math>P(B)</math> are the probabilities of observing <math>A</math> and <math>B</math> respectively without any given conditions; they are known as the prior probability and [[marginal probability]]. | ||
===Proof=== | ===Proof=== | ||
| Line 77: | Line 77: | ||
<math display="block">P_X^y (A) = E (1_A (X) | Y = y)</math> | <math display="block">P_X^y (A) = E (1_A (X) | Y = y)</math> | ||
Existence and uniqueness of the needed [[conditional expectation]] is a consequence of the [[Radon–Nikodym theorem]]. This was formulated by [[Andrey Kolmogorov|Kolmogorov]] in 1933. Kolmogorov underlines the importance of conditional probability, writing, "I wish to call attention to ... the theory of conditional probabilities and conditional expectations".<ref>{{Cite book |last=Kolmogorov |first=A.N. |title=Foundations of the Theory of Probability |publisher=Chelsea Publishing Company |orig-year=1956 |year=1933}}</ref> Bayes' theorem determines the posterior distribution from the prior distribution. Uniqueness requires continuity assumptions.<ref>{{Cite book |last=Tjur |first=Tue |url=http://archive.org/details/probabilitybased0000tjur |title=Probability based on Radon measures |date=1980 |location=New York |publisher=Wiley |isbn=978-0-471-27824-5}}</ref> Bayes' theorem can be generalized to include improper prior distributions such as the uniform distribution on the real line.<ref>{{Cite journal |last1=Taraldsen |first1=Gunnar |last2=Tufto |first2=Jarle |last3=Lindqvist |first3=Bo H. |date=2021-07-24 |title=Improper priors and improper posteriors |journal=Scandinavian Journal of Statistics |volume=49 |issue=3 |language=en |pages=969–991 |doi=10.1111/sjos.12550 |s2cid=237736986 |issn=0303-6898|doi-access=free |hdl=11250/2984409 |hdl-access=free }}</ref> Modern [[Markov chain Monte Carlo]] methods have boosted the importance of Bayes' theorem, including in cases with improper priors.<ref>{{Cite book |last1=Robert |first1=Christian P. |url=http://worldcat.org/oclc/1159112760 |title=Monte Carlo Statistical Methods | Existence and uniqueness of the needed [[conditional expectation]] is a consequence of the [[Radon–Nikodym theorem]]. This was formulated by [[Andrey Kolmogorov|Kolmogorov]] in 1933. Kolmogorov underlines the importance of conditional probability, writing, "I wish to call attention to ... the theory of conditional probabilities and conditional expectations".<ref>{{Cite book |last=Kolmogorov |first=A.N. |authorlink=Andrey Kolmogorov |title=Foundations of the Theory of Probability |publisher=Chelsea Publishing Company |orig-year=1956 |year=1933}}</ref> Bayes' theorem determines the posterior distribution from the prior distribution. Uniqueness requires continuity assumptions.<ref>{{Cite book |last=Tjur |first=Tue |url=http://archive.org/details/probabilitybased0000tjur |title=Probability based on Radon measures |date=1980 |location=New York |publisher=Wiley |isbn=978-0-471-27824-5}}</ref> Bayes' theorem can be generalized to include improper prior distributions such as the uniform distribution on the real line.<ref>{{Cite journal |last1=Taraldsen |first1=Gunnar |last2=Tufto |first2=Jarle |last3=Lindqvist |first3=Bo H. |date=2021-07-24 |title=Improper priors and improper posteriors |journal=Scandinavian Journal of Statistics |volume=49 |issue=3 |language=en |pages=969–991 |doi=10.1111/sjos.12550 |s2cid=237736986 |issn=0303-6898|doi-access=free |hdl=11250/2984409 |hdl-access=free }}</ref> Modern [[Markov chain Monte Carlo]] methods have boosted the importance of Bayes' theorem, including in cases with improper priors.<ref>{{Cite book |last1=Robert |first1=Christian P. |author1-link=Christian Robert |last2=Casella |first2=George |author2-link=George Casella |url=http://worldcat.org/oclc/1159112760 |title=Monte Carlo Statistical Methods |publisher=Springer |year=2004 |isbn=978-1475741452 |oclc=1159112760}}</ref> | ||
==Examples== | ==Examples== | ||
{{Unreferenced section|date=August 2025}} | |||
===Drug testing=== | ===Drug testing=== | ||
Suppose, a particular test for whether someone has been using cannabis is 90% [[Sensitivity (tests)|sensitive]], meaning the [[true positive rate]] (TPR) = 0.90. Therefore, it leads to 90% true positive results (correct identification of drug use) for cannabis users. | Suppose, a particular test for whether someone has been using cannabis is 90% [[Sensitivity (tests)|sensitive]], meaning the [[true positive rate]] (TPR) = 0.90. Therefore, it leads to 90% true positive results (correct identification of drug use) for cannabis users. | ||
| Line 289: | Line 287: | ||
<!-- NOTE: Before changing this image, be sure to seek consensus. The current consensus, as established at [[Talk:Bayes%27_theorem#RfC_on_illustration]], is that the image should stay. --> | <!-- NOTE: Before changing this image, be sure to seek consensus. The current consensus, as established at [[Talk:Bayes%27_theorem#RfC_on_illustration]], is that the image should stay. --> | ||
[[File:Bayes theorem assassin.svg|thumb|A geometric visualization of Bayes' theorem using astronauts who may be suspicious (with eyebrows) and may be assassins (with daggers)]] | [[File:Bayes theorem assassin.svg|thumb|A geometric visualization of Bayes' theorem using astronauts who may be suspicious (with eyebrows) and may be assassins (with daggers)]] | ||
The interpretation of Bayes' rule depends on the [[Probability interpretations|interpretation of probability]] ascribed to the terms. The two predominant | The interpretation of Bayes' rule depends on the [[Probability interpretations|interpretation of probability]] ascribed to the terms. The two predominant classes of interpretation are described below. | ||
===Bayesian | ===Bayesian interpretations=== | ||
In | In [[Bayesian probability|Bayesian (or epistemological) interpretations]], probability measures a "degree of belief".<ref>{{cite book|first1=Persi |last1=Diaconis |first2=Brian |last2=Skyrms |title=Ten Great Ideas About Chance |author-link1=Persi Diaconis |author-link2=Brian Skyrms |publisher=Princeton University Press |year=2018 |isbn=978-0-691-17416-7 |pages=22–27}}</ref><ref>{{cite book|first=Cheryl |last=Misak |title=Frank Ramsey: A Sheer Excess of Powers |author-link=Cheryl Misak |publisher=Oxford University Press |year=2020 |isbn=978-0-19-875535-7 |pages=268–269}}</ref> Bayes' theorem links the degree of belief in a proposition before and after accounting for evidence. For example, suppose it is believed with 50% certainty that a coin is twice as likely to land heads than tails. If the coin is flipped a number of times and the outcomes observed, that degree of belief will probably rise or fall, but might remain the same, depending on the results. For proposition ''A'' and evidence ''B'', | ||
* ''P'' (''A''), the ''prior'', is the initial degree of belief in ''A''. | * ''P'' (''A''), the ''prior'', is the initial degree of belief in ''A''. | ||
* ''P'' (''A'' | ''B''), the ''posterior'', is the degree of belief after incorporating news that ''B'' is true. | * ''P'' (''A'' | ''B''), the ''posterior'', is the degree of belief after incorporating news that ''B'' is true. | ||
* the quotient {{sfrac|''P''(''B'' {{!}} ''A'')|''P''(''B'')}} represents the support ''B'' provides for ''A''. | * the quotient {{sfrac|''P''(''B'' {{!}} ''A'')|''P''(''B'')}} represents the support ''B'' provides for ''A''. | ||
For more on the application of Bayes' theorem under | For more on the application of Bayes' theorem under Bayesian interpretations of probability, see [[Bayesian inference]]. | ||
===Frequentist | ===Frequentist interpretations=== | ||
[[File:Bayes theorem tree diagrams.svg|thumb|Illustration of frequentist interpretation with [[Tree diagram (probability theory)|tree diagrams]]]] | [[File:Bayes theorem tree diagrams.svg|thumb|Illustration of frequentist interpretation with [[Tree diagram (probability theory)|tree diagrams]]]] | ||
In the [[Frequentist interpretation of probability|frequentist | In the [[Frequentist interpretation of probability|frequentist interpretations]], probability measures a "proportion of outcomes".<ref>{{cite SEP|url-id=probability-interpret |title=Interpretations of Probability |date=November 16, 2023 |first=Alan |last=Hájek}}</ref> For example, suppose an experiment is performed many times. ''P''(''A'') is the proportion of outcomes with property ''A'' (the prior) and ''P''(''B'') is the proportion with property ''B''. ''P''(''B'' | ''A'') is the proportion of outcomes with property ''B'' ''out of'' outcomes with property ''A'', and ''P''(''A'' | ''B'') is the proportion of those with ''A'' ''out of'' those with ''B'' (the posterior). | ||
The role of Bayes' theorem can be shown with tree diagrams. The two diagrams partition the same outcomes by ''A'' and ''B'' in opposite orders, to obtain the inverse probabilities. Bayes' theorem links the different partitionings. | The role of Bayes' theorem can be shown with tree diagrams. The two diagrams partition the same outcomes by ''A'' and ''B'' in opposite orders, to obtain the inverse probabilities. Bayes' theorem links the different partitionings. | ||
| Line 341: | Line 339: | ||
|first=Peter M. | |first=Peter M. | ||
|title=Bayesian Statistics | |title=Bayesian Statistics | ||
| | |url=https://www.york.ac.uk/depts/maths/histstat/pml1/bayes/book.htm | ||
|publisher=[[John Wiley & Sons|Wiley]] | |publisher=[[John Wiley & Sons|Wiley]] | ||
|year=2012 | |year=2012 | ||
| Line 347: | Line 345: | ||
|chapter=Chapter 1 | |chapter=Chapter 1 | ||
}} | }} | ||
</ref> | </ref>{{Page needed|date=August 2025}} | ||
If events ''A''<sub>1</sub>, ''A''<sub>2</sub>, ..., are mutually exclusive and exhaustive, i.e., one of them is certain to occur but no two can occur together, we can determine the proportionality constant by using the fact that their probabilities must add up to one. For instance, for a given event ''A'', the event ''A'' itself and its complement ¬''A'' are exclusive and exhaustive. Denoting the constant of proportionality by ''c'', we have: | If events ''A''<sub>1</sub>, ''A''<sub>2</sub>, ..., are mutually exclusive and exhaustive, i.e., one of them is certain to occur but no two can occur together, we can determine the proportionality constant by using the fact that their probabilities must add up to one.{{cn|date=August 2025}} For instance, for a given event ''A'', the event ''A'' itself and its complement ¬''A'' are exclusive and exhaustive. Denoting the constant of proportionality by ''c'', we have: | ||
:<math>P(A| B) = c \cdot P(A) \cdot P(B| A) \text{ and } P(\neg A| B) = c \cdot P(\neg A) \cdot P(B| \neg A). </math> | :<math>P(A| B) = c \cdot P(A) \cdot P(B| A) \text{ and } P(\neg A| B) = c \cdot P(\neg A) \cdot P(B| \neg A). </math> | ||
| Line 416: | Line 414: | ||
:<math>P( X{=}x | Y {=} y) = \frac{P(Y{=}y | X{=}x) P(X{=}x)}{P(Y{=}y)}</math> | :<math>P( X{=}x | Y {=} y) = \frac{P(Y{=}y | X{=}x) P(X{=}x)}{P(Y{=}y)}</math> | ||
Terms become 0 at points where either variable has finite [[probability density function|probability density]]. To remain useful, Bayes' theorem can be formulated in terms of the relevant densities (see [[#Derivation|Derivation]]). | Terms become 0 at points where either variable has finite [[probability density function|probability density]]. To remain useful, Bayes' theorem can be formulated in terms of the relevant densities (see [[#Derivation|Derivation]]).{{cn|date=August 2025}} | ||
====Simple form==== | ====Simple form==== | ||
If ''X'' is continuous and ''Y'' is discrete, | If ''X'' is continuous and ''Y'' is discrete,{{cn|date=August 2025}} | ||
:<math>f_{X | Y{=}y}(x) = \frac{P(Y{=}y| X{=}x) f_X(x)}{P(Y{=}y)}</math> | :<math>f_{X | Y{=}y}(x) = \frac{P(Y{=}y| X{=}x) f_X(x)}{P(Y{=}y)}</math> | ||
| Line 436: | Line 434: | ||
[[File:Continuous event space specification.svg|thumb|A way to conceptualize event spaces generated by continuous random variables X and Y]] | [[File:Continuous event space specification.svg|thumb|A way to conceptualize event spaces generated by continuous random variables X and Y]] | ||
A continuous event space is often conceptualized in terms of the numerator terms. It is then useful to eliminate the denominator using the [[law of total probability]]. For ''f<sub>Y</sub>''(''y''), this becomes an integral: | A continuous event space is often conceptualized in terms of the numerator terms. It is then useful to eliminate the denominator using the [[law of total probability]]. For ''f<sub>Y</sub>''(''y''), this becomes an integral:{{cn|date=August 2025}} | ||
:<math> f_Y(y) = \int_{-\infty}^\infty f_{Y| X = \xi}(y) f_X(\xi)\,d\xi .</math> | :<math> f_Y(y) = \int_{-\infty}^\infty f_{Y| X = \xi}(y) f_X(\xi)\,d\xi .</math> | ||
| Line 463: | Line 461: | ||
or, in words, the posterior odds on <math>A</math> equals the prior odds on <math>A</math> times the likelihood ratio for <math>A</math> given information <math>B</math>. In short, '''posterior odds equals prior odds times likelihood ratio'''. | or, in words, the posterior odds on <math>A</math> equals the prior odds on <math>A</math> times the likelihood ratio for <math>A</math> given information <math>B</math>. In short, '''posterior odds equals prior odds times likelihood ratio'''. | ||
For example, if a medical test has a [[Sensitivity and specificity|sensitivity]] of 90% and a [[Sensitivity and specificity|specificity]] of 91%, then the positive Bayes factor is <math>\Lambda_+ = P(\text{True Positive})/P(\text{False Positive}) = 90\%/(100\%-91\%)=10</math>. Now, if the [[prevalence]] of this disease is 9.09%, and if we take that as the prior probability, then the prior odds is about 1:10. So after receiving a positive test result, the posterior odds of having the disease becomes 1:1, which means that the posterior probability of having the disease is 50%. If a second test is performed in serial testing, and that also turns out to be positive, then the posterior odds of having the disease becomes 10:1, which means a posterior probability of about 90.91%. The negative Bayes factor can be calculated to be 91%/(100%-90%)=9.1, so if the second test turns out to be negative, then the posterior odds of having the disease is 1:9.1, which means a posterior probability of about 9.9%. | For example,{{cn|date=August 2025}} if a medical test has a [[Sensitivity and specificity|sensitivity]] of 90% and a [[Sensitivity and specificity|specificity]] of 91%, then the positive Bayes factor is <math>\Lambda_+ = P(\text{True Positive})/P(\text{False Positive}) = 90\%/(100\%-91\%)=10</math>. Now, if the [[prevalence]] of this disease is 9.09%, and if we take that as the prior probability, then the prior odds is about 1:10. So after receiving a positive test result, the posterior odds of having the disease becomes 1:1, which means that the posterior probability of having the disease is 50%. If a second test is performed in serial testing, and that also turns out to be positive, then the posterior odds of having the disease becomes 10:1, which means a posterior probability of about 90.91%. The negative Bayes factor can be calculated to be 91%/(100%-90%)=9.1, so if the second test turns out to be negative, then the posterior odds of having the disease is 1:9.1, which means a posterior probability of about 9.9%. | ||
The example above can also be understood with more solid numbers: assume the patient taking the test is from a group of 1,000 people, 91 of whom have the disease (prevalence of 9.1%). If all 1,000 take the test, 82 of those with the disease will get a true positive result (sensitivity of 90.1%), 9 of those with the disease will get a false negative result ([[False positives and false negatives|false negative rate]] of 9.9%), 827 of those without the disease will get a true negative result (specificity of 91.0%), and 82 of those without the disease will get a false positive result (false positive rate of 9.0%). Before taking any test, the patient's odds for having the disease is 91:909. After receiving a positive result, the patient's odds for having the disease is | The example above can also be understood with more solid numbers: assume the patient taking the test is from a group of 1,000 people, 91 of whom have the disease (prevalence of 9.1%). If all 1,000 take the test, 82 of those with the disease will get a true positive result (sensitivity of 90.1%), 9 of those with the disease will get a false negative result ([[False positives and false negatives|false negative rate]] of 9.9%), 827 of those without the disease will get a true negative result (specificity of 91.0%), and 82 of those without the disease will get a false positive result (false positive rate of 9.0%). Before taking any test, the patient's odds for having the disease is 91:909. After receiving a positive result, the patient's odds for having the disease is | ||
| Line 493: | Line 491: | ||
:<math>P(A \vert B \cap C) = \frac{P(B \vert A \cap C) \, P(A \vert C)}{P(B \vert C)} </math> | :<math>P(A \vert B \cap C) = \frac{P(B \vert A \cap C) \, P(A \vert C)}{P(B \vert C)} </math> | ||
This can be deduced as follows. Using the [[Chain rule (probability)|chain rule]] | |||
Using the [[Chain rule (probability)|chain rule]] | |||
:<math>P(A \cap B \cap C) = P(A \vert B \cap C) \, P(B \vert C) \, P(C)</math> | :<math>P(A \cap B \cap C) = P(A \vert B \cap C) \, P(B \vert C) \, P(C)</math> | ||
| Line 503: | Line 499: | ||
The desired result is obtained by identifying both expressions and solving for <math>P(A \vert B \cap C)</math>. | The desired result is obtained by identifying both expressions and solving for <math>P(A \vert B \cap C)</math>. | ||
== | ==Applications== | ||
===Recreational mathematics=== | |||
Bayes' rule and computing [[Conditional probability|conditional probabilities]] provide a method to solve a number of popular puzzles, such as the [[Three Prisoners problem]], the [[Monty Hall problem]], the [[Boy or Girl paradox|Two Child problem]], and the [[Two envelopes problem|Two Envelopes problem]].{{cn|date=April 2025}} | |||
=== Genetics === | |||
In genetics, Bayes' rule can be used to estimate the probability that someone has a specific genotype. Many people seek to assess their chances of being affected by a genetic disease or their likelihood of being a carrier for a recessive gene of interest. A Bayesian analysis can be done based on family history or [[genetic testing]] to predict whether someone will develop a disease or pass one on to their children. Genetic testing and prediction is common among couples who plan to have children but are concerned that they may both be carriers for a disease, especially in communities with low genetic variance.<ref>{{cite journal|last1=Kraft|first1=Stephanie A|last2=Duenas|first2=Devan|last3=Wilfond|first3=Benjamin S|last4=Goddard|first4=Katrina AB|author-link4=Katrina A. B. Goddard|date=24 September 2018|title=The evolving landscape of expanded carrier screening: challenges and opportunities|journal=[[Genetics in Medicine]]|volume=21|issue=4|pages=790–797|doi=10.1038/s41436-018-0273-4|pmc=6752283|pmid=30245516}}</ref> | In genetics, Bayes' rule can be used to estimate the probability that someone has a specific genotype. Many people seek to assess their chances of being affected by a genetic disease or their likelihood of being a carrier for a recessive gene of interest. A Bayesian analysis can be done based on family history or [[genetic testing]] to predict whether someone will develop a disease or pass one on to their children. Genetic testing and prediction is common among couples who plan to have children but are concerned that they may both be carriers for a disease, especially in communities with low genetic variance.<ref>{{cite journal|last1=Kraft|first1=Stephanie A|last2=Duenas|first2=Devan|last3=Wilfond|first3=Benjamin S|last4=Goddard|first4=Katrina AB|author-link4=Katrina A. B. Goddard|date=24 September 2018|title=The evolving landscape of expanded carrier screening: challenges and opportunities|journal=[[Genetics in Medicine]]|volume=21|issue=4|pages=790–797|doi=10.1038/s41436-018-0273-4|pmc=6752283|pmid=30245516}}</ref> | ||
{| class="wikitable" | {| class="wikitable" | ||
!Hypothesis | !Hypothesis | ||
| Line 528: | Line 527: | ||
|(1/2) / (1/32 + 1/2) = 16/17 | |(1/2) / (1/32 + 1/2) = 16/17 | ||
|} | |} | ||
Above is an example of a Bayesian analysis table for a female's risk for a disease based on the knowledge that the disease is present in her siblings but not in her parents or any of her four children. Based solely on the status of the subject's siblings and parents, she is equally likely to be a carrier as to be a non-carrier (this likelihood is denoted by the prior hypothesis). The probability that the subject's four sons would all be unaffected is 1/16 ({{frac|1|2}}⋅{{frac|1|2}}⋅{{frac|1|2}}⋅{{frac|1|2}}) if she is a carrier and about 1 if she is a non-carrier (this is the conditional probability). The joint probability reconciles these two predictions by multiplying them together. The last line (the posterior probability) is calculated by dividing the joint probability for each hypothesis by the sum of both joint probabilities.<ref name="Ogino et al 2004">{{cite journal |last1=Ogino |first1=Shuji |last2=Wilson |first2=Robert B |last3=Gold |first3=Bert |last4=Hawley |first4=Pamela |last5=Grody |first5=Wayne W |title=Bayesian analysis for cystic fibrosis risks in prenatal and carrier screening |journal=Genetics in Medicine |date=October 2004 |volume=6 |issue=5 |pages=439–449 |doi=10.1097/01.GIM.0000139511.83336.8F |pmid=15371910 |doi-access=free }}</ref> | |||
Parental genetic testing can detect around 90% of known disease alleles in parents that can lead to carrier or affected status in their children. [[Cystic fibrosis]] is a heritable disease caused by an [[Dominance (genetics)|autosomal recessive]] mutation on the [[Cystic fibrosis transmembrane conductance regulator|CFTR]] gene,<ref>{{cite web|title=Types of CFTR Mutations |website=Cystic Fibrosis Foundation |url=https://www.cff.org/What-is-CF/Genetics/Types-of-CFTR-Mutations/}}</ref> located on [[chromosome 7]].<ref>{{cite web|title=CFTR Gene |website=[[MedlinePlus]] |publisher=U.S. National Library of Medicine, [[National Institutes of Health]] |url=https://ghr.nlm.nih.gov/gene/CFTR#location}}</ref> | |||
Parental genetic testing can detect around 90% of known disease alleles in parents that can lead to carrier or affected status in their children. Cystic fibrosis is a heritable disease caused by an autosomal recessive mutation on the CFTR gene,<ref> | |||
Here is a Bayesian analysis of a female patient with a family history of cystic fibrosis (CF) who has tested negative for CF, demonstrating how the method was used to determine her risk of having a child born with CF: because the patient is unaffected, she is either homozygous for the wild-type allele, or heterozygous. To establish prior probabilities, a Punnett square is used, based on the knowledge that neither parent was affected by the disease but both could have been carriers: | Here is a Bayesian analysis of a female patient with a family history of cystic fibrosis (CF) who has tested negative for CF, demonstrating how the method was used to determine her risk of having a child born with CF: because the patient is unaffected, she is either [[Zygosity|homozygous]] for the wild-type allele, or heterozygous. To establish prior probabilities, a [[Punnett square]] is used, based on the knowledge that neither parent was affected by the disease but both could have been carriers: | ||
{| class="wikitable" style="text-align:center;" | {| class="wikitable" style="text-align:center;" | ||
! {{diagonal split header|<br /><br />Father|Mother}} | ! {{diagonal split header|<br /><br />Father|Mother}} | ||
| Line 579: | Line 577: | ||
After carrying out the same analysis on the patient's male partner (with a negative test result), the chance that their child is affected is the product of the parents' respective posterior probabilities for being carriers times the chance that two carriers will produce an affected offspring ({{frac|1|4}}). | After carrying out the same analysis on the patient's male partner (with a negative test result), the chance that their child is affected is the product of the parents' respective posterior probabilities for being carriers times the chance that two carriers will produce an affected offspring ({{frac|1|4}}). | ||
Bayesian analysis can be done using phenotypic information associated with a genetic condition. When combined with genetic testing, this analysis becomes much more complicated. Cystic fibrosis, for example, can be identified in a fetus with an ultrasound looking for an echogenic bowel, one that appears brighter than normal on a scan. This is not a foolproof test, as an echogenic bowel can be present in a perfectly healthy fetus. Parental genetic testing is very influential in this case, where a phenotypic facet can be overly influential in probability calculation. In the case of a fetus with an echogenic bowel, with a mother who has been tested and is known to be a CF carrier, the posterior probability that the fetus has the disease is very high (0.64). But once the father has tested negative for CF, the posterior probability drops significantly (to 0.16).<ref name="Ogino et al 2004"/> | Bayesian analysis can be done using phenotypic information associated with a genetic condition. When combined with genetic testing, this analysis becomes much more complicated. Cystic fibrosis, for example, can be identified in a fetus with an ultrasound looking for an echogenic bowel, one that appears brighter than normal on a scan. This is not a foolproof test, as an echogenic bowel can be present in a perfectly healthy fetus. Parental genetic testing is very influential in this case, where a phenotypic facet can be overly influential in probability calculation. In the case of a fetus with an echogenic bowel, with a mother who has been tested and is known to be a CF carrier, the posterior probability that the fetus has the disease is very high (0.64). But once the father has tested negative for CF, the posterior probability drops significantly (to 0.16).<ref name="Ogino et al 2004"/> | ||
| Line 593: | Line 590: | ||
* [[Regular conditional probability]] | * [[Regular conditional probability]] | ||
* [[Bayesian persuasion]] | * [[Bayesian persuasion]] | ||
* [[Bayesian network]] | |||
== Notes == | == Notes == | ||
| Line 605: | Line 603: | ||
==Further reading== | ==Further reading== | ||
* {{cite book |last1=Bolstad |first1=William M. |last2=Curran |first2=James M. |title=Introduction to Bayesian Statistics |edition=3rd |location=New York |publisher=Wiley |year=2017 |isbn=978-1-118-09156-2 |chapter=Logic, Probability, and Uncertainty |pages=59–82 }} | * {{cite book |last1=Bolstad |first1=William M. |last2=Curran |first2=James M. |title=Introduction to Bayesian Statistics |edition=3rd |location=New York |publisher=Wiley |year=2017 |isbn=978-1-118-09156-2 |chapter=Logic, Probability, and Uncertainty |pages=59–82 }} | ||
* {{cite SEP|url-id=bayes-theorem |title=Bayes' Theorem |date=September 30, 2003 |first=James |last=Joyce |author-link=James M. Joyce }} | |||
* {{cite book |last=Lee |first=Peter M. |year=2012 |title=Bayesian Statistics: An Introduction |edition=4th |publisher=Wiley |isbn=978-1-118-33257-3 }} | * {{cite book |last=Lee |first=Peter M. |year=2012 |title=Bayesian Statistics: An Introduction |edition=4th |publisher=Wiley |isbn=978-1-118-33257-3 }} | ||
* {{cite book |last=Schmitt |first=Samuel A. |title=Measuring Uncertainty : An Elementary Introduction to Bayesian Statistics |location=Reading |publisher=Addison-Wesley |year=1969 |oclc=5013 |chapter=Accumulating Evidence |pages=61–99 }} | * {{cite book |last=Schmitt |first=Samuel A. |title=Measuring Uncertainty : An Elementary Introduction to Bayesian Statistics |location=Reading |publisher=Addison-Wesley |year=1969 |oclc=5013 |chapter=Accumulating Evidence |pages=61–99 }} | ||
* {{cite journal |last1=Stigler |first1=Stephen M. |title=Laplace's 1774 Memoir on Inverse Probability |journal=Statistical Science |date=August 1986 |volume=1 |issue=3 |pages=359–363 |doi=10.1214/ss/1177013620 |doi-access=free }} | * {{cite journal |last1=Stigler |first1=Stephen M. |authorlink=Stephen Stigler |title=Laplace's 1774 Memoir on Inverse Probability |journal=Statistical Science |date=August 1986 |volume=1 |issue=3 |pages=359–363 |doi=10.1214/ss/1177013620 |doi-access=free }} | ||
==External links== | ==External links== | ||
Latest revision as of 13:05, 15 November 2025
Template:Short description Script error: No such module "redirect hatnote". Template:Bayesian statistics
Bayes' theorem (alternatively Bayes' law or Bayes' rule, after Thomas Bayes (Template:IPAc-en)) gives a mathematical rule for inverting conditional probabilities, allowing the probability of a cause to be found given its effect. For example, with Bayes' theorem, the probability that a patient has a disease given that they tested positive for that disease can be found using the probability that the test yields a positive result when the disease is present. The theorem was developed in the 18th century by Bayes and independently by Pierre-Simon Laplace.
One of Bayes' theorem's many applications is Bayesian inference, an approach to statistical inference, where it is used to invert the probability of observations given a model configuration (i.e., the likelihood function) to obtain the probability of the model configuration given the observations (i.e., the posterior probability).
History
Bayes' theorem is named after Thomas Bayes, a minister, statistician, and philosopher. Bayes used conditional probability to provide an algorithm (his Proposition 9) that uses evidence to calculate limits on an unknown parameter. His work was published in 1763 as An Essay Towards Solving a Problem in the Doctrine of Chances. Bayes studied how to compute a distribution for the probability parameter of a binomial distribution (in modern terminology). After Bayes's death, his family gave his papers to a friend, the minister, philosopher, and mathematician Richard Price.
Price significantly edited the unpublished manuscript for two years before sending it to a friend who read it aloud at the Royal Society on 23 December 1763.[1] Price edited[2] Bayes's major work "An Essay Towards Solving a Problem in the Doctrine of Chances" (1763), which appeared in Philosophical Transactions,[3] and contains Bayes' theorem. Price wrote an introduction to the paper that provides some of the philosophical basis of Bayesian statistics and chose one of the two solutions Bayes offered. In 1765, Price was elected a Fellow of the Royal Society in recognition of his work on Bayes's legacy.[4][5] On 27 April, a letter sent to his friend Benjamin Franklin was read out at the Royal Society, and later published, in which Price applies this work to population and computing 'life-annuities'.[6]
Independently of Bayes, Pierre-Simon Laplace used conditional probability to formulate the relation of an updated posterior probability from a prior probability, given evidence. He reproduced and extended Bayes's results in 1774, apparently unaware of Bayes's work, and summarized his results in Théorie analytique des probabilités (1812).Template:NoteTag[7] The Bayesian interpretation of probability was developed mainly by Laplace.[8]
About 200 years later, Sir Harold Jeffreys put Bayes's algorithm and Laplace's formulation on an axiomatic basis, writing in a 1973 book that Bayes' theorem "is to the theory of probability what the Pythagorean theorem is to geometry".[9]
Stephen Stigler used a Bayesian argument to conclude that Bayes' theorem was discovered by Nicholas Saunderson, a blind English mathematician, some time before Bayes,[10][11] but that is disputed.[12]
Martyn Hooper[13] and Sharon McGrayne[14] have argued that Richard Price's contribution was substantial:
<templatestyles src="Template:Blockquote/styles.css" />
By modern standards, we should refer to the Bayes–Price rule. Price discovered Bayes's work, recognized its importance, corrected it, contributed to the article, and found a use for it. The modern convention of employing Bayes's name alone is unfair but so entrenched that anything else makes little sense.[14]
Script error: No such module "Check for unknown parameters".
F. Thomas Bruss reviewed Bayes's "An essay towards solving a problem in the doctrine of chances" as communicated by Price.[15] He agrees with Stigler's analysis in many points, but not as far as the question of priority is concerned. Bruss underlines the intuitive part of Bayes's formula and adds independent arguments of Bayes's probable motivation for his work. He concludes that, unless the contrary is really proven, we are entitled to be faithful to the name "Bayes' Theorem" or "Bayes' formula".
Statement of theorem
Bayes' theorem is stated mathematically as the following equation:[16]
where and are events and .
- is a conditional probability: the probability of event occurring given that is true. It is also called the posterior probability of given .
- is also a conditional probability: the probability of event occurring given that is true. It can also be interpreted as the likelihood of given a fixed .
- and are the probabilities of observing and respectively without any given conditions; they are known as the prior probability and marginal probability.
Proof
For events
Bayes' theorem may be derived from the definition of conditional probability:
where is the probability of both A and B being true. Similarly,
Solving for and substituting into the above expression for yields Bayes' theorem:
For continuous random variables
For two continuous random variables X and Y, Bayes' theorem may be analogously derived from the definition of conditional density:
Therefore,
This holds for values and within the support of X and Y, ensuring and .
General case
Let be the conditional distribution of given and let be the distribution of . The joint distribution is then . The conditional distribution of given is then determined by
Existence and uniqueness of the needed conditional expectation is a consequence of the Radon–Nikodym theorem. This was formulated by Kolmogorov in 1933. Kolmogorov underlines the importance of conditional probability, writing, "I wish to call attention to ... the theory of conditional probabilities and conditional expectations".[17] Bayes' theorem determines the posterior distribution from the prior distribution. Uniqueness requires continuity assumptions.[18] Bayes' theorem can be generalized to include improper prior distributions such as the uniform distribution on the real line.[19] Modern Markov chain Monte Carlo methods have boosted the importance of Bayes' theorem, including in cases with improper priors.[20]
Examples
Script error: No such module "Unsubst".
Drug testing
Suppose, a particular test for whether someone has been using cannabis is 90% sensitive, meaning the true positive rate (TPR) = 0.90. Therefore, it leads to 90% true positive results (correct identification of drug use) for cannabis users.
The test is also 80% specific, meaning true negative rate (TNR) = 0.80. Therefore, the test correctly identifies 80% of non-use for non-users, but also generates 20% false positives, or false positive rate (FPR) = 0.20, for non-users.
Assuming 0.05 prevalence, meaning 5% of people use cannabis, what is the probability that a random person who tests positive is really a cannabis user?
The Positive predictive value (PPV) of a test is the proportion of persons who are actually positive out of all those testing positive, and can be calculated from a sample as:
- PPV = True positive / Tested positive
If sensitivity, specificity, and prevalence are known, PPV can be calculated using Bayes' theorem. Let mean "the probability that someone is a cannabis user given that they test positive", which is what PPV means. We can write:
The denominator is a direct application of the Law of Total Probability. In this case, it says that the probability that someone tests positive is the probability that a user tests positive times the probability of being a user, plus the probability that a non-user tests positive, times the probability of being a non-user. This is true because the classifications user and non-user form a partition of a set, namely the set of people who take the drug test. This combined with the definition of conditional probability results in the above statement.
In other words, if someone tests positive, the probability that they are a cannabis user is only 19%—because in this group, only 5% of people are users, and most positives are false positives coming from the remaining 95%.
If 1,000 people were tested:
- 950 are non-users and 190 of them give false positive (0.20 × 950)
- 50 of them are users and 45 of them give true positive (0.90 × 50)
The 1,000 people thus have 235 positive tests, of which only 45 are genuine, about 19%.
Sensitivity or specificity
The importance of specificity can be seen by showing that even if sensitivity is raised to 100% and specificity remains at 80%, the probability that someone who tests positive is a cannabis user rises only from 19% to 21%, but if the sensitivity is held at 90% and the specificity is increased to 95%, the probability rises to 49%.
| Template:Diagonal split header | Positive | Negative | Total | |
|---|---|---|---|---|
| User | 45 | 5 | 50 | |
| Non-user | 190 | 760 | 950 | |
| Total | 235 | 765 | 1000 | |
| 90% sensitive, 80% specific, PPV=45/235 ≈ 19% | ||||
| Template:Diagonal split header | Positive | Negative | Total | |
|---|---|---|---|---|
| User | 50 | 0 | 50 | |
| Non-user | 190 | 760 | 950 | |
| Total | 240 | 760 | 1000 | |
| 100% sensitive, 80% specific, PPV=50/240 ≈ 21% | ||||
| Template:Diagonal split header | Positive | Negative | Total | |
|---|---|---|---|---|
| User | 45 | 5 | 50 | |
| Non-user | 47 | 903 | 950 | |
| Total | 92 | 908 | 1000 | |
| 90% sensitive, 95% specific, PPV=45/92 ≈ 49% | ||||
Cancer rate
If all patients with pancreatic cancer have a certain symptom, it does not follow that anyone who has that symptom has a 100% chance of getting pancreatic cancer. Assuming the incidence rate of pancreatic cancer is 1/100000, while 10/99999 healthy individuals have the same symptoms worldwide, the probability of having pancreatic cancer given the symptoms is 9.1%, and the other 90.9% could be "false positives" (that is, falsely said to have cancer; "positive" is a confusing term when, as here, the test gives bad news).
Based on incidence rate, the following table presents the corresponding numbers per 100,000 people.
| Template:Diagonal split header | Yes | No | Total | |
|---|---|---|---|---|
| Yes | 1 | 0 | 1 | |
| No | 10 | 99989 | 99999 | |
| Total | 11 | 99989 | 100000 | |
Which can then be used to calculate the probability of having cancer when you have the symptoms:
Defective item rate
| Template:Diagonal split header | Defective | Flawless | Total | |
|---|---|---|---|---|
| A | 10 | 190 | 200 | |
| B | 9 | 291 | 300 | |
| C | 5 | 495 | 500 | |
| Total | 24 | 976 | 1000 | |
A factory produces items using three machines—A, B, and C—which account for 20%, 30%, and 50% of its output, respectively. Of the items produced by machine A, 5% are defective, while 3% of B's items and 1% of C's are defective. If a randomly selected item is defective, what is the probability it was produced by machine C?
Once again, the answer can be reached without using the formula by applying the conditions to a hypothetical number of cases. For example, if the factory produces 1,000 items, 200 will be produced by A, 300 by B, and 500 by C. Machine A will produce 5% × 200 = 10 defective items, B 3% × 300 = 9, and C 1% × 500 = 5, for a total of 24. Thus 24/1000 (2.4%) of the total output will be defective and the likelihood that a randomly selected defective item was produced by machine C is 5/24 (~20.83%).
This problem can also be solved using Bayes' theorem: Let Xi denote the event that a randomly chosen item was made by the i th machine (for i = A,B,C). Let Y denote the event that a randomly chosen item is defective. Then, we are given the following information:
If the item was made by the first machine, then the probability that it is defective is 0.05; that is, P(Y | XA) = 0.05. Overall, we have
To answer the original question, we first find P(Y). That can be done in the following way:
Hence, 2.4% of the total output is defective.
We are given that Y has occurred and we want to calculate the conditional probability of XC. By Bayes' theorem,
Given that the item is defective, the probability that it was made by machine C is 5/24. C produces half of the total output but a much smaller fraction of the defective items. Hence the knowledge that the item selected was defective enables us to replace the prior probability P(XC) = 1/2 by the smaller posterior probability P(XC | Y) = 5/24.
Interpretations
The interpretation of Bayes' rule depends on the interpretation of probability ascribed to the terms. The two predominant classes of interpretation are described below.
Bayesian interpretations
In Bayesian (or epistemological) interpretations, probability measures a "degree of belief".[21][22] Bayes' theorem links the degree of belief in a proposition before and after accounting for evidence. For example, suppose it is believed with 50% certainty that a coin is twice as likely to land heads than tails. If the coin is flipped a number of times and the outcomes observed, that degree of belief will probably rise or fall, but might remain the same, depending on the results. For proposition A and evidence B,
- P (A), the prior, is the initial degree of belief in A.
- P (A | B), the posterior, is the degree of belief after incorporating news that B is true.
- the quotient Template:Sfrac represents the support B provides for A.
For more on the application of Bayes' theorem under Bayesian interpretations of probability, see Bayesian inference.
Frequentist interpretations
In the frequentist interpretations, probability measures a "proportion of outcomes".[23] For example, suppose an experiment is performed many times. P(A) is the proportion of outcomes with property A (the prior) and P(B) is the proportion with property B. P(B | A) is the proportion of outcomes with property B out of outcomes with property A, and P(A | B) is the proportion of those with A out of those with B (the posterior).
The role of Bayes' theorem can be shown with tree diagrams. The two diagrams partition the same outcomes by A and B in opposite orders, to obtain the inverse probabilities. Bayes' theorem links the different partitionings.
Example
An entomologist spots what might, due to the pattern on its back, be a rare subspecies of beetle. A full 98% of the members of the rare subspecies have the pattern, so P(Pattern | Rare) = 98%. Only 5% of members of the common subspecies have the pattern. The rare subspecies is 0.1% of the total population. How likely is the beetle having the pattern to be rare: what is P(Rare | Pattern)?
From the extended form of Bayes' theorem (since any beetle is either rare or common),
Forms
Events
Simple form
For events A and B, provided that P(B) ≠ 0,
In many applications, for instance in Bayesian inference, the event B is fixed in the discussion and we wish to consider the effect of its having been observed on our belief in various possible events A. In such situations the denominator of the last expression, the probability of the given evidence B, is fixed; what we want to vary is A. Bayes' theorem shows that the posterior probabilities are proportional to the numerator, so the last equation becomes:
In words, the posterior is proportional to the prior times the likelihood. This version of Bayes' theorem is known as Bayes' rule.[24]Script error: No such module "Unsubst".
If events A1, A2, ..., are mutually exclusive and exhaustive, i.e., one of them is certain to occur but no two can occur together, we can determine the proportionality constant by using the fact that their probabilities must add up to one.Script error: No such module "Unsubst". For instance, for a given event A, the event A itself and its complement ¬A are exclusive and exhaustive. Denoting the constant of proportionality by c, we have:
Adding these two formulas we deduce that:
or
Alternative form
| Template:Diagonal split header | B | Template:Tmath (not Template:Mvar) |
Total | |
|---|---|---|---|---|
| Template:Mvar | Template:Tmath | |||
| Template:Tmath (not Template:Mvar) |
= | |||
| Total | Template:Tmath | 1 | ||
Another form of Bayes' theorem for two competing statements or hypotheses is:
For an epistemological interpretation:
For proposition A and evidence or background B,[25]
- is the prior probability, the initial degree of belief in A.
- is the corresponding initial degree of belief in not-A, that A is false, where
- is the conditional probability or likelihood, the degree of belief in B given that A is true.
- is the conditional probability or likelihood, the degree of belief in B given that A is false.
- is the posterior probability, the probability of A after taking into account B.
Extended form
Often, for some partition {Aj} of the sample space, the event space is given in terms of P(Aj) and P(B | Aj). It is then useful to compute P(B) using the law of total probability:
Or (using the multiplication rule for conditional probability),[26]
In the special case where A is a binary variable:
Random variables
Consider a sample space Ω generated by two random variables X and Y with known probability distributions. In principle, Bayes' theorem applies to the events A = {X = x} and B = {Y = y}.
Terms become 0 at points where either variable has finite probability density. To remain useful, Bayes' theorem can be formulated in terms of the relevant densities (see Derivation).Script error: No such module "Unsubst".
Simple form
If X is continuous and Y is discrete,Script error: No such module "Unsubst".
where each is a density function.
If X is discrete and Y is continuous,
If both X and Y are continuous,
Extended form
A continuous event space is often conceptualized in terms of the numerator terms. It is then useful to eliminate the denominator using the law of total probability. For fY(y), this becomes an integral:Script error: No such module "Unsubst".
Bayes' rule in odds form
Bayes' theorem in odds form is:Script error: No such module "Unsubst".
where
is called the Bayes factor or likelihood ratio. The odds between two events is simply the ratio of the probabilities of the two events. Thus:
Thus the rule says that the posterior odds are the prior odds times the Bayes factor; in other words, the posterior is proportional to the prior times the likelihood.
In the special case that and , one writes , and uses a similar abbreviation for the Bayes factor and for the conditional odds. The odds on is by definition the odds for and against . Bayes' rule can then be written in the abbreviated form
or, in words, the posterior odds on equals the prior odds on times the likelihood ratio for given information . In short, posterior odds equals prior odds times likelihood ratio.
For example,Script error: No such module "Unsubst". if a medical test has a sensitivity of 90% and a specificity of 91%, then the positive Bayes factor is . Now, if the prevalence of this disease is 9.09%, and if we take that as the prior probability, then the prior odds is about 1:10. So after receiving a positive test result, the posterior odds of having the disease becomes 1:1, which means that the posterior probability of having the disease is 50%. If a second test is performed in serial testing, and that also turns out to be positive, then the posterior odds of having the disease becomes 10:1, which means a posterior probability of about 90.91%. The negative Bayes factor can be calculated to be 91%/(100%-90%)=9.1, so if the second test turns out to be negative, then the posterior odds of having the disease is 1:9.1, which means a posterior probability of about 9.9%.
The example above can also be understood with more solid numbers: assume the patient taking the test is from a group of 1,000 people, 91 of whom have the disease (prevalence of 9.1%). If all 1,000 take the test, 82 of those with the disease will get a true positive result (sensitivity of 90.1%), 9 of those with the disease will get a false negative result (false negative rate of 9.9%), 827 of those without the disease will get a true negative result (specificity of 91.0%), and 82 of those without the disease will get a false positive result (false positive rate of 9.0%). Before taking any test, the patient's odds for having the disease is 91:909. After receiving a positive result, the patient's odds for having the disease is
which is consistent with the fact that there are 82 true positives and 82 false positives in the group of 1,000.
Generalizations
Bayes' theorem for 3 events
A version of Bayes' theorem for 3 events[27] results from the addition of a third event , with on which all probabilities are conditioned:
This can be deduced as follows. Using the chain rule
And, on the other hand
The desired result is obtained by identifying both expressions and solving for .
Applications
Recreational mathematics
Bayes' rule and computing conditional probabilities provide a method to solve a number of popular puzzles, such as the Three Prisoners problem, the Monty Hall problem, the Two Child problem, and the Two Envelopes problem.Script error: No such module "Unsubst".
Genetics
In genetics, Bayes' rule can be used to estimate the probability that someone has a specific genotype. Many people seek to assess their chances of being affected by a genetic disease or their likelihood of being a carrier for a recessive gene of interest. A Bayesian analysis can be done based on family history or genetic testing to predict whether someone will develop a disease or pass one on to their children. Genetic testing and prediction is common among couples who plan to have children but are concerned that they may both be carriers for a disease, especially in communities with low genetic variance.[28]
| Hypothesis | Hypothesis 1: Patient is a carrier | Hypothesis 2: Patient is not a carrier |
|---|---|---|
| Prior Probability | 1/2 | 1/2 |
| Conditional Probability that all four offspring will be unaffected | (1/2) ⋅ (1/2) ⋅ (1/2) ⋅ (1/2) = 1/16 | About 1 |
| Joint Probability | (1/2) ⋅ (1/16) = 1/32 | (1/2) ⋅ 1 = 1/2 |
| Posterior Probability | (1/32) / (1/32 + 1/2) = 1/17 | (1/2) / (1/32 + 1/2) = 16/17 |
Above is an example of a Bayesian analysis table for a female's risk for a disease based on the knowledge that the disease is present in her siblings but not in her parents or any of her four children. Based solely on the status of the subject's siblings and parents, she is equally likely to be a carrier as to be a non-carrier (this likelihood is denoted by the prior hypothesis). The probability that the subject's four sons would all be unaffected is 1/16 (<templatestyles src="Fraction/styles.css" />1⁄2⋅<templatestyles src="Fraction/styles.css" />1⁄2⋅<templatestyles src="Fraction/styles.css" />1⁄2⋅<templatestyles src="Fraction/styles.css" />1⁄2) if she is a carrier and about 1 if she is a non-carrier (this is the conditional probability). The joint probability reconciles these two predictions by multiplying them together. The last line (the posterior probability) is calculated by dividing the joint probability for each hypothesis by the sum of both joint probabilities.[29]
Parental genetic testing can detect around 90% of known disease alleles in parents that can lead to carrier or affected status in their children. Cystic fibrosis is a heritable disease caused by an autosomal recessive mutation on the CFTR gene,[30] located on chromosome 7.[31]
Here is a Bayesian analysis of a female patient with a family history of cystic fibrosis (CF) who has tested negative for CF, demonstrating how the method was used to determine her risk of having a child born with CF: because the patient is unaffected, she is either homozygous for the wild-type allele, or heterozygous. To establish prior probabilities, a Punnett square is used, based on the knowledge that neither parent was affected by the disease but both could have been carriers:
| Template:Diagonal split header | W
Homozygous for the wild- |
M
Heterozygous |
|---|---|---|
| W
Homozygous for the wild- |
WW | MW |
| M
Heterozygous (a CF carrier) |
MW | MM
(affected by cystic fibrosis) |
Given that the patient is unaffected, there are only three possibilities. Within these three, there are two scenarios in which the patient carries the mutant allele. Thus the prior probabilities are <templatestyles src="Fraction/styles.css" />2⁄3 and <templatestyles src="Fraction/styles.css" />1⁄3.
Next, the patient undergoes genetic testing and tests negative for cystic fibrosis. This test has a 90% detection rate, so the conditional probabilities of a negative test are 1/10 and 1. Finally, the joint and posterior probabilities are calculated as before.
| Hypothesis | Hypothesis 1: Patient is a carrier | Hypothesis 2: Patient is not a carrier |
|---|---|---|
| Prior Probability | 2/3 | 1/3 |
| Conditional Probability of a negative test | 1/10 | 1 |
| Joint Probability | 1/15 | 1/3 |
| Posterior Probability | 1/6 | 5/6 |
After carrying out the same analysis on the patient's male partner (with a negative test result), the chance that their child is affected is the product of the parents' respective posterior probabilities for being carriers times the chance that two carriers will produce an affected offspring (<templatestyles src="Fraction/styles.css" />1⁄4).
Bayesian analysis can be done using phenotypic information associated with a genetic condition. When combined with genetic testing, this analysis becomes much more complicated. Cystic fibrosis, for example, can be identified in a fetus with an ultrasound looking for an echogenic bowel, one that appears brighter than normal on a scan. This is not a foolproof test, as an echogenic bowel can be present in a perfectly healthy fetus. Parental genetic testing is very influential in this case, where a phenotypic facet can be overly influential in probability calculation. In the case of a fetus with an echogenic bowel, with a mother who has been tested and is known to be a CF carrier, the posterior probability that the fetus has the disease is very high (0.64). But once the father has tested negative for CF, the posterior probability drops significantly (to 0.16).[29]
Risk factor calculation is a powerful tool in genetic counseling and reproductive planning but cannot be treated as the only important factor. As above, incomplete testing can yield falsely high probability of carrier status, and testing can be financially inaccessible or unfeasible when a parent is not present.
See also
Template:Wikifunctions Script error: No such module "Portal".
- Bayesian epistemology
- Inductive probability
- Quantum Bayesianism
- Why Most Published Research Findings Are False, a 2005 essay in metascience by John Ioannidis
- Regular conditional probability
- Bayesian persuasion
- Bayesian network
Notes
References
Bibliography
- This article incorporates text from a publication now in the public domain: Script error: No such module "template wrapper".
Further reading
- Script error: No such module "citation/CS1".
- Template:Cite SEP
- Script error: No such module "citation/CS1".
- Script error: No such module "citation/CS1".
- Script error: No such module "Citation/CS1".
External links
- Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "Citation/CS1".
- ↑ Holland, pp. 46–7.
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "Footnotes"..
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "Citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "Citation/CS1".
- ↑ Script error: No such module "Citation/CS1".
- ↑ a b Script error: No such module "citation/CS1".
- ↑ Script error: No such module "Citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "Citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Template:Cite SEP
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "Citation/CS1".
- ↑ a b Script error: No such module "Citation/CS1".
- ↑ Script error: No such module "citation/CS1".
- ↑ Script error: No such module "citation/CS1".