Articles

12.4: Bayes Theorem


In this section we concentrate on the more complex conditional probability problems we began looking at in the last section.

Example 19

Suppose a certain disease has an incidence rate of 0.1% (that is, it afflicts 0.1% of the population). A test has been devised to detect this disease. The test does not produce false negatives (that is, anyone who has the disease will test positive for it), but the false positive rate is 5% (that is, about 5% of people who take the test will test positive, even though they do not have the disease). Suppose a randomly selected person takes the test and tests positive. What is the probability that this person actually has the disease?

Solution

There are two ways to approach the solution to this problem. One involves an important result in probability theory called Bayes' theorem. We will discuss this theorem a bit later, but for now we will use an alternative and, we hope, much more intuitive approach.

Let's break down the information in the problem piece by piece.

Suppose a certain disease has an incidence rate of 0.1% (that is, it afflicts 0.1% of the population). The percentage 0.1% can be converted to a decimal number by moving the decimal place two places to the left, to get 0.001. In turn, 0.001 can be rewritten as a fraction: 1/1000. This tells us that about 1 in every 1000 people has the disease. (If we wanted we could write P(disease)=0.001.)

A test has been devised to detect this disease. The test does not produce false negatives (that is, anyone who has the disease will test positive for it). This part is fairly straightforward: everyone who has the disease will test positive, or alternatively everyone who tests negative does not have the disease. (We could also say P(positive | disease)=1.)

The false positive rate is 5% (that is, about 5% of people who take the test will test positive, even though they do not have the disease). This is even more straightforward. Another way of looking at it is that of every 100 people who are tested and do not have the disease, 5 will test positive even though they do not have the disease. (We could also say that (P)(positive | no disease)=0.05.)

Suppose a randomly selected person takes the test and tests positive. What is the probability that this person actually has the disease? Here we want to compute (P)(disease|positive). We already know that (P)(positive|disease)=1, but remember that conditional probabilities are not equal if the conditions are switched.

Rather than thinking in terms of all these probabilities we have developed, let's create a hypothetical situation and apply the facts as set out above. First, suppose we randomly select 1000 people and administer the test. How many do we expect to have the disease? Since about 1/1000 of all people are afflicted with the disease, (frac{1}{1000}) of 1000 people is 1. (Now you know why we chose 1000.) Only 1 of 1000 test subjects actually has the disease; the other 999 do not.

We also know that 5% of all people who do not have the disease will test positive. There are 999 disease-free people, so we would expect ((0.05)(999)=49.95) (so, about 50) people to test positive who do not have the disease.

Now back to the original question, computing P(disease|positive). There are 51 people who test positive in our example (the one unfortunate person who actually has the disease, plus the 50 people who tested positive but don't). Only one of these people has the disease, so

P(disease | positive) (approx frac{1}{51} approx 0.0196)

or less than 2%. Does this surprise you? This means that of all people who test positive, over 98% do not have the disease.

The answer we got was slightly approximate, since we rounded 49.95 to 50. We could redo the problem with 100,000 test subjects, 100 of whom would have the disease and ((0.05)(99,900)=4995) test positive but do not have the disease, so the exact probability of having the disease if you test positive is

P(disease | positive) (approx frac{100}{5095} approx 0.0196)

which is pretty much the same answer.

But back to the surprising result. Of all people who test positive, over 98% do not have the disease. If your guess for the probability a person who tests positive has the disease was wildly different from the right answer (2%), don't feel bad. The exact same problem was posed to doctors and medical students at the Harvard Medical School 25 years ago and the results revealed in a 1978 New England Journal of Medicine article. Only about 18% of the participants got the right answer. Most of the rest thought the answer was closer to 95% (perhaps they were misled by the false positive rate of 5%).

So at least you should feel a little better that a bunch of doctors didn't get the right answer either (assuming you thought the answer was much higher). But the significance of this finding and similar results from other studies in the intervening years lies not in making math students feel better but in the possibly catastrophic consequences it might have for patient care. If a doctor thinks the chances that a positive test result nearly guarantees that a patient has a disease, they might begin an unnecessary and possibly harmful treatment regimen on a healthy patient. Or worse, as in the early days of the AIDS crisis when being HIV-positive was often equated with a death sentence, the patient might take a drastic action and commit suicide.

As we have seen in this hypothetical example, the most responsible course of action for treating a patient who tests positive would be to counsel the patient that they most likely do not have the disease and to order further, more reliable, tests to verify the diagnosis.

One of the reasons that the doctors and medical students in the study did so poorly is that such problems, when presented in the types of statistics courses that medical students often take, are solved by use of Bayes' theorem, which is stated as follows:

Bayes’ Theorem

(P(A | B)=frac{P(A) P(B | A)}{P(A) P(B | A)+P(ar{A}) P(B | ar{A})})

In our earlier example, this translates to

(P( ext { disease } | ext { positive })=frac{P( ext { disease }) P( ext { positive } | ext { disease })}{P( ext { disease }) P( ext { positive } | ext { disease })+P( ext { no disease }) P( ext { positive } | ext { no disease })})

Plugging in the numbers gives

(P( ext { disease } | ext { positive })=frac{(0.001)(1)}{(0.001)(1)+(0.999)(0.05)} approx 0.0196)

which is exactly the same answer as our original solution.

The problem is that you (or the typical medical student, or even the typical math professor) are much more likely to be able to remember the original solution than to remember Bayes' theorem. Psychologists, such as Gerd Gigerenzer, author of Calculated Risks: How to Know When Numbers Deceive You, have advocated that the method involved in the original solution (which Gigerenzer calls the method of "natural frequencies") be employed in place of Bayes' Theorem. Gigerenzer performed a study and found that those educated in the natural frequency method were able to recall it far longer than those who were taught Bayes' theorem. When one considers the possible life-and-death consequences associated with such calculations it seems wise to heed his advice.

Example 20

A certain disease has an incidence rate of 2%. If the false negative rate is 10% and the false positive rate is 1%, compute the probability that a person who tests positive actually has the disease.

Solution

Imagine 10,000 people who are tested. Of these 10,000, 200 will have the disease; 10% of them, or 20, will test negative and the remaining 180 will test positive. Of the 9800 who do not have the disease, 98 will test positive. So of the 278 total people who test positive, 180 will have the disease. Thus

(P( ext { disease } | ext { positive })=frac{180}{278} approx 0.647)

so about 65% of the people who test positive will have the disease.

Using Bayes theorem directly would give the same result:

(P( ext { disease } | ext { positive })=frac{(0.02)(0.90)}{(0.02)(0.90)+(0.98)(0.01)}=frac{0.018}{0.0278} approx 0.647)

Try it Now 5

A certain disease has an incidence rate of 0.5%. If there are no false negatives and if the false positive rate is 3%, compute the probability that a person who tests positive actually has the disease.

Answer

Out of 100,000 people, 500 would have the disease. Of those, all 500 would test positive. Of the 99,500 without the disease, 2,985 would falsely test positive and the other 96,515 would test negative.

(mathrm{P}( ext { disease } | ext { positive })=frac{500}{500+2985}=frac{500}{3485} approx 14.3 \%)


Frequently Asked Bayesian Statistics Interview Questions and Answers

One of the most useful discoveries in the probability and statistics is the Bayesian statistics . The development of this decision theory has immensely increased the power of decision-making and solved many issues faced with frequentist statistics.

The Bayes theorem of Bayesian Statistics often goes by different names such as posterior statistics, inverse probability, or revised probability.

Although the development of Bayesian method has divided data scientists in two group – Bayesians and frequentists but the importance of Bayes theorem are unmatched. In some uncertain instances, it’s not possible to come to a conclusion without Bayesian.

Hence, if you are looking forward to becoming a data scientist, machine learning engineer, or data engineer, Bayesian statistics is an important concept to learn. Knowing what is Bayesian statistics , how it works, and all the essential aspects of the topic are the key to clearing the interview process.

Therefore, we’ve created a simple guide containing crucial interview questions based on Bayes theorem . Briefly study these questions and answers to perform well in your machine-learning interview.


Contents

Bayes' theorem is stated mathematically as the following equation: [3]

Proof Edit

For events Edit

Bayes' theorem may be derived from the definition of conditional probability:

where P ( A ∩ B ) is the joint probability of both A and B being true. Because

For continuous random variables Edit

For two continuous random variables X and Y, Bayes' theorem may be analogously derived from the definition of conditional density:

Drug testing Edit

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

The fact that P ( Positive ) = P ( Positive ∣ User ) P ( User ) + P ( Positive ∣ Non-user ) P ( Non-user ) >)=P(< ext>mid < ext>)P(< ext>)+P(< ext>mid < ext>)P(< ext>)> 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.

Even if someone tests positive, the probability they are a cannabis user is only 19%, because in this group only 5% of people are users, 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 yields 235 positive tests, of which only 45 are genuine drug users, about 19%. See Figure 1 for an illustration using a frequency box, and note how small the pink area of true positives is compared to the blue area of false positives.

Sensitivity or specificity Edit

The importance of specificity can be seen by showing that even if sensitivity is raised to 100% and specificity remains at 80%, the probability of someone testing positive really being a cannabis user only rises from 19% to 21%, but if the sensitivity is held at 90% and the specificity is increased to 95%, the probability rises to 49%.

Cancer rate Edit

Even if 100% of patients with pancreatic cancer have a certain symptom, when someone has the same symptom, it does not mean that this person has a 100% chance of getting pancreatic cancer. Assume the incidence rate of pancreatic cancer is 1/100000, while 10/100000 healthy individuals have the same symptoms worldwide, the probability of having pancreatic cancer given the symptoms is only 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.

Which can then be used to calculate the probability of having cancer when you have the symptoms:

Defective item rate Edit

A factory produces an item 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 similarly, 3% of machine B's items and 1% of machine 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 Machine A, 300 by Machine B, and 500 by Machine C. Machine A will produce 5% × 200 = 10 defective items, Machine B 3% × 300 = 9, and Machine C 1% × 500 = 5, for a total of 24. Thus, the likelihood that a randomly selected defective item was produced by machine C is 5/24 (

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. Although machine C produces half of the total output, it produces 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.

The interpretation of Bayes' rule depends on the interpretation of probability ascribed to the terms. The two main interpretations are described below. Figure 2 shows a geometric visualization similar to Figure 1. Gerd Gigerenzer and co-authors have pushed hard for teaching Bayes Rule this way, with special emphasis on teaching it to physicians. [4] An example is Will Kurt's webpage, "Bayes' Theorem with Lego," later turned into the book, Bayesian Statistics the Fun Way: Understanding Statistics and Probability with Star Wars, LEGO, and Rubber Ducks. Zhu and Gigerenzer found in 2006 that whereas 0% of 4th, 5th, and 6th-graders could solve word problems after being taught with formulas, 19%, 39%, and 53% could after being taught with frequency boxes, and that the learning was either thorough or zero. [5]

Bayesian interpretation Edit

In the Bayesian (or epistemological) interpretation, probability measures a "degree of belief". 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 even 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 P(B | A) / P(B) represents the support B provides for A.

For more on the application of Bayes' theorem under the Bayesian interpretation of probability, see Bayesian inference.

Frequentist interpretation Edit

In the frequentist interpretation, probability measures a "proportion of outcomes". 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 is best visualized with tree diagrams such as Figure 3. 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 Edit

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),

Events Edit

Simple form Edit

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 impact of its having been observed on our belief in various possible events A. In such a situation the denominator of the last expression, the probability of the given evidence B, is fixed what we want to vary is A. Bayes' theorem then 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. [6]

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. 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

1 = c ⋅ ( P ( B | A ) ⋅ P ( A ) + P ( B | ¬ A ) ⋅ P ( ¬ A ) ) ,

Alternative form Edit

Another form of Bayes' theorem for two competing statements or hypotheses is:

For an epistemological interpretation:

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

  • P ( A ) is the prior probability, the initial degree of belief in A.
  • P ( ¬ A ) is the corresponding initial degree of belief in not-A, that A is false, where P ( ¬ A ) = 1 − P ( A )
  • P ( B | A ) is the conditional probability or likelihood, the degree of belief in B given that proposition A is true.
  • P ( B | ¬ A ) is the conditional probability or likelihood, the degree of belief in B given that proposition A is false.
  • P ( A | B ) is the posterior probability, the probability of A after taking into account B.

Extended form Edit

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:

In the special case where A is a binary variable:

Random variables Edit

Consider a sample space Ω generated by two random variables X and Y. In principle, Bayes' theorem applies to the events A = <X = x> and B = <Y = y>.

However, terms become 0 at points where either variable has finite probability density. To remain useful, Bayes' theorem must be formulated in terms of the relevant densities (see Derivation).

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

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:

Bayes' rule Edit

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, or in other words, the posterior is proportional to the prior times the likelihood.

Propositional logic Edit

Bayes' theorem represents a generalisation of contraposition which in propositional logic can be expressed as:

The corresponding formula in terms of probability calculus is Bayes' theorem which in its expanded form is expressed as:

Subjective logic Edit

Bayes' theorem represents a special case of conditional inversion in subjective logic expressed as:

¬ B S ) = ( ω B ∣ A S , ω B ∣ ¬ A S ) ϕ

Hence, the subjective Bayes' theorem represents a generalization of Bayes' theorem. [9]

Conditioned version Edit

A conditioned version of the Bayes' theorem [10] results from the addition of a third event C on which all probabilities are conditioned:

Derivation Edit

P ( A ∩ B ∩ C ) = P ( A ∣ B ∩ C ) P ( B ∣ C ) P ( C )

P ( A ∩ B ∩ C ) = P ( B ∩ A ∩ C ) = P ( B ∣ A ∩ C ) P ( A ∣ C ) P ( C )

The desired result is obtained by identifying both expressions and solving for P ( A ∣ B ∩ C ) .

Bayes' rule with 3 events Edit

In the case of 3 events - A, B, and C - it can be shown that:

Bayes' theorem is named after the Reverend Thomas Bayes ( / b eɪ z / c. 1701 – 1761), who first used conditional probability to provide an algorithm (his Proposition 9) that uses evidence to calculate limits on an unknown parameter, published as An Essay towards solving a Problem in the Doctrine of Chances (1763). He studied how to compute a distribution for the probability parameter of a binomial distribution (in modern terminology). On Bayes' death his family transferred his papers to his old friend, Richard Price (1723 – 1791) who over a period of two years significantly edited the unpublished manuscript, before sending it to a friend who read it aloud at the Royal Society on 23 December 1763. [1] [ page needed ] Price edited [12] Bayes's major work "An Essay towards solving a Problem in the Doctrine of Chances" (1763), which appeared in Philosophical Transactions, [13] and contains Bayes' theorem. Price wrote an introduction to the paper which provides some of the philosophical basis of Bayesian statistics and chose one of the two solutions offered by Bayes. In 1765, Price was elected a Fellow of the Royal Society in recognition of his work on the legacy of Bayes. [14] [15] On 27 April a letter sent to his friend Benjamin Franklin was read out at the Royal Society, and later published, where Price applies this work to population and computing 'life-annuities'. [16]

Independently of Bayes, Pierre-Simon Laplace in 1774, and later in his 1812 Théorie analytique des probabilités, 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. [note 1] [17] The Bayesian interpretation of probability was developed mainly by Laplace. [18]

Sir Harold Jeffreys put Bayes's algorithm and Laplace’s formulation on an axiomatic basis, writing that Bayes' theorem "is to the theory of probability what the Pythagorean theorem is to geometry". [19]

Stephen Stigler used a Bayesian argument to conclude that Bayes' theorem was discovered by Nicholas Saunderson, a blind English mathematician, some time before Bayes [20] [21] that interpretation, however, has been disputed. [22] Martyn Hooper [23] and Sharon McGrayne [24] have argued that Richard Price's contribution was substantial:

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. [24]

In genetics, Bayes' theorem can be used to calculate the probability of an individual having a specific genotype. Many people seek to approximate 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, in order to predict whether an individual will develop a disease or pass one on to their children. Genetic testing and prediction is a common practice among couples who plan to have children but are concerned that they may both be carriers for a disease, especially within communities with low genetic variance. [ citation needed ]

The first step in Bayesian analysis for genetics is to propose mutually exclusive hypotheses: for a specific allele, an individual either is or is not a carrier. Next, four probabilities are calculated: Prior Probability (the likelihood of each hypothesis considering information such as family history or predictions based on Mendelian Inheritance), Conditional Probability (of a certain outcome), Joint Probability (product of the first two), and Posterior Probability (a weighted product calculated by dividing the Joint Probability for each hypothesis by the sum of both joint probabilities). This type of analysis can be done based purely on family history of a condition or in concert with genetic testing. [ citation needed ]

Using pedigree to calculate probabilities Edit

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

Example of a Bayesian analysis table for a female individual'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). However, the probability that the subject’s four sons would all be unaffected is 1/16 (½·½·½·½) if she is a carrier, 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. [25]

Using genetic test results Edit

Parental genetic testing can detect around 90% of known disease alleles in parents that can lead to carrier or affected status in their child. Cystic fibrosis is a heritable disease caused by an autosomal recessive mutation on the CFTR gene, [26] located on the q arm of chromosome 7. [27]

Bayesian analysis of a female patient with a family history of cystic fibrosis (CF), who has tested negative for CF, demonstrating how this 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:

Homozygous for the wild-
type allele (a non-carrier)

Heterozygous (a CF carrier)

Homozygous for the wild-
type allele (a non-carrier)

Heterozygous (a CF carrier)

(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 ⅔ and ⅓.

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 chances of their child being affected is equal to the product of the parents' respective posterior probabilities for being carriers times the chances that two carriers will produce an affected offspring (¼).

Genetic testing done in parallel with other risk factor identification. Edit

Bayesian analysis can be done using phenotypic information associated with a genetic condition, and when combined with genetic testing this analysis becomes much more complicated. Cystic Fibrosis, for example, can be identified in a fetus through an ultrasound looking for an echogenic bowel, meaning one that appears brighter than normal on a scan2. 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 actually has the disease is very high (0.64). However, once the father has tested negative for CF, the posterior probability drops significantly (to 0.16). [25]

Risk factor calculation is a powerful tool in genetic counseling and reproductive planning, but it cannot be treated as the only important factor to consider. 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.


11.2 Bayes’ theorem and inverse inference

The reason that Bayesian statistics has its name is because it takes advantage of Bayes’ theorem to make inferences from data about the underlying process that generated the data. Let’s say that we want to know whether a coin is fair. To test this, we flip the coin 10 times and come up with 7 heads. Before this test we were pretty sure that the (P_=0.5) , but finding 7 heads out of 10 flips would certainly give us pause if we believed that (P_=0.5) . We already know how to compute the conditional probability that we would flip 7 or more heads out of 10 if the coin is really fair ( (P(nge7|p_=0.5)) ), using the binomial distribution.

The resulting probability is 0.055. That is a fairly small number, but this number doesn’t really answer the question that we are asking – it is telling us about the likelihood of 7 or more heads given some particular probability of heads, whereas what we really want to know is the true probability of heads for this particular coin. This should sound familiar, as it’s exactly the situation that we were in with null hypothesis testing, which told us about the likelihood of data rather than the likelihood of hypotheses.

Remember that Bayes’ theorem provides us with the tool that we need to invert a conditional probability:

We can think of this theorem as having four parts:

  • prior ( (P(Hypothesis)) ): Our degree of belief about hypothesis H before seeing the data D
  • likelihood ( (P(Data|Hypothesis)) ): How likely are the observed data D under hypothesis H?
  • marginal likelihood ( (P(Data)) ): How likely are the observed data, combining over all possible hypotheses?
  • posterior ( (P(Hypothesis|Data)) ): Our updated belief about hypothesis H, given the data D

In the case of our coin-flipping example:

  • prior ( (P_) ): Our degree of belief about the likelhood of flipping heads, which was (P_=0.5)
  • likelihood ( (P( ext<7 or more heads out of 10 flips>|P_=0.5)) ): How likely are 7 or more heads out of 10 flips if (P_=0.5)) ?
  • marginal likelihood ( (P( ext<7 or more heads out of 10 flips>)) ): How likely are we to observe 7 heads out of 10 coin flips, in general?
  • posterior ( (P_| ext<7 or more heads out of 10 coin flips>)) ): Our updated belief about (P_) given the observed coin flips

Here we see one of the primary differences between frequentist and Bayesian statistics. Frequentists do not believe in the idea of a probability of a hypothesis (i.e. our degree of belief about a hypothesis) – for them, a hypothesis is either true or it isn’t. Another way to say this is that for the frequentist, the hypothesis is fixed and the data are random, which is why frequentist inference focuses on describing the probability of data given a hypothesis (i.e. the p-value). Bayesians, on the other hand, are comfortable making probability statements about both data and hypotheses.


Addition Law, Multiplication Law and Bayes Theorem

In this lesson we will look at some laws or formulas of probability: the Addition Law, the Multiplication Law and the Bayes&rsquo Theorem or Bayes&rsquo Rule.

The following diagram shows the Addition Rules for Probability: Mutually Exclusive Events and Non-Mutually Exclusive Events. Scroll down the page for more examples and solutions on using the Addition Rules.

Addition Law of Probability

The general law of addition is used to find the probability of the union of two events. The expression denotes the probability of X occurring or Y occurring or both X and Y occurring.

The Addition Law of Probability is given by

If the two events are mutually exclusive, the probability of the union of the two events is the probability of the first event plus the probability of the second event. Since mutually exclusive events do not intersect, nothing has to be subtracted.

If X and Y are mutually exclusive, then the addition law of probability is given by

Multiplication Law of Probability

The following diagram shows the Multiplication Rules for Probability (Independent and Dependent Events) and Bayes' Theorem. Scroll down the page for more examples and solutions on using the Multiplication Rules and Bayes' Theorem.

The probability of the intersection of two events is called joint probability.

The Multiplication Law of Probability is given by

The notation is the intersection of two events and it means that both X and Y must happen. denotes the probability of X occurring given that Y has occurred.

When two events X and Y are independent,

If X and Y are independent then the multiplication law of probability is given by

Bayes&rsquo Theorem or Bayes&rsquo Rule

The Bayes&rsquo Theorem was developed and named for Thomas Bayes (1702 &ndash 1761). Bayes&rsquo rule enables the statistician to make new and different applications using conditional probabilities. In particular, statisticians use Bayes&rsquo rule to &lsquorevise&rsquo probabilities in light of new information.

The Bayes&rsquo theorem is given by

Bayes&rsquo theorem can be derived from the multiplication law

Bayes&rsquo Theorem can also be written in different forms

Try the free Mathway calculator and problem solver below to practice various math topics. Try the given examples, or type in your own problem and check your answer with the step-by-step explanations.

We welcome your feedback, comments and questions about this site or page. Please submit your feedback or enquiries via our Feedback page.


When does Bayes’ Theorem help?

Let’s consider this problem.

A, B, C are the rating that a bank gives to its
borrowers. Let’s the probability of getting rated A, B, and C are as follows.

Some of the customers defaulted on their borrowings. 1%
of the customers who were rated A, 10% of the customers who were rated B and
18% of the customers who were rated C became defaulters.

If a customer who is a defaulter. What is the probability
that he was rated A?

We can show all the customers of the bank by a rectangle and designate the portion of the customer’s who are rated A, B and C respectively by sections which are named A, B, and C as below. Also, the circle represents the customers who are defaulters and is denoted by D.


12.4: Bayes Theorem

In example 17 we considered a diagnostic test, and the probability of the test detecting the disease in someone who has it. But diagnostic tests can sometimes produce ‘false positives’: a test may claim the presence of the disease in someone who does not have it. In these situations, we will want to know how likely it is someone has the disease, conditional on their test result.

A new diagnostic test has been developed for a particular disease. It is known that 0.1% of people in the population have the disease. The test will detect the disease in 95% of all people who really do have the disease. However, there is also the possibility of a “false positive” out of all people who do not have the disease, the test will claim they do in 2% of cases.

A person is chosen at random to take the test, and the result is “positive”. How likely is it that that person has the disease?

Theoremل. (Bayes’ theorem) Suppose we have a partition of $mathcal= < E_1,ldots ,E_n>$ of a sample space $S$. Then for any event $F$,

Note that we can calculate $P(F)$ via the law of total probability:

Using this we can write Bayes’ theorem as

This is often the most useful version in practice.

Note that if $E$ is a single event then $< E,ar> $ is a partition with $n=2$, so we get a special case of Bayes’ theorem,

In the context of Bayes’ theorem, we sometimes refer to $P(E_i)$ as the prior probability of $E_i$, and $P(E_i|F)$ as the posterior probability of $E_i$ given $F$. The prior probability states how likely we thought $E_i$ was before we knew that $F$ had occurred, and the posterior probability states how likely we think $E_i$ is after we have learnt that $F$ has occurred.


Now,lets get back to our problem and try to solve it using Bayes’s Theorem
A = Probability of Bag 1
B = Probability of Black ball

P(A) = 1/2 = 0.5(Since there are two bags,probability of choosing Bag 1 is 1/2)
P(B|A) = 0.48 (Probability of black ball given bag1 #We have already solved this above)
P(B) = (24+40)/110 = 0.58 (Number of black balls in both the bags/Total number of balls in both the bags)

Thus,P(A|B) = 0.5 * 0.48 / 0.58 = 0.41

This example shows one application of Bayes Theorem.This theorem helps you to get one conditional probability from other.


Chapter 13 Class 12 Probability

Get NCERT solutions of all examples, exercises and Miscellaneous questions of Chapter 13 Class 12 Probability with detailed explanation. Formula sheet also available.

We started learning about Probability from Class 6,

we learned that Probability is Number of outcomes by Total Number of Outcomes.

In Class 11, we learned about Sample Space, Events, using Sets.

In this chapter, we will learn about

  • Conditional Probability - Finding probability of something when an event has already occurred. For example - finding probability of 4 coming in second throw of die if 6 has come in first throw. We also discuss its formula, properties and questions
  • Independent events - What is an independent event, and where is it used?
  • Multiplication rule of probability - We learn about dependent and independent events, and the multiplication rule for 2, or more than two events
  • Basic Probability - We solve questions using basic formula - Number of outcomes/Total Outcomes to find Probability, set theory, and permutation and combinations to find probability.
  • Theorem of total probability - We use the formula P(A) = P(B) P(A|B) + P(B') P(A|B')
  • Bayes theorem - Finding probability when an event has already happened
  • Random Variable - Writing random variable
  • Probability distribution - Finding probability distribution of random variable, and finding its mean (or expectation)
  • Variance and Standard Deviation of a Random Variable - Finding variance and standard deviation using probability distribution
  • Bernoulli Trials - Checking if an event is a Bernoulli trial
  • Binomial Distribution - For Bernoulli Trial, finding probability using Binomial Distribution

Check the chapter from different Concepts, starting from Basic to Advanced, or you can also refer to the exercises mentioned in the NCERT Book. Click on a topic below to start


Watch the video: Bayes theorem (December 2021).