Articles

9.2.1: Bayes' Formula (Exercises) - Mathematics


SECTION 9.2 PROBLEM SET: BAYES' FORMULA

  1. Jar I contains five red and three white marbles, and Jar II contains four red and two white marbles. A jar is picked at random and a marble is drawn. Draw a tree diagram below, and find the following probabilities.
    1. P(marble is red)
    2. P(It came from Jar II | marble is white)
    3. P(Red | Jar I)
  1. In Mr. Symons' class, if a student does homework most days, the chance of passing the course is 90%. On the other hand, if a student does not do homework most days, the chance of passing the course is only 20%.
    H = event that the student did homework
    C = event that the student passed the course
    Mr. Symons claims that 80% of his students do homework on a regular basis. If a student is chosen at random from Mr. Symons' class, find the following probabilities.
    1. P(C)
    2. P(H|C)
    3. P(C|H)
  1. A city has 60% Democrats, and 40% Republicans. In the last mayoral election, 60% of the Democrats voted for their Democratic candidate while 95% of the Republicans voted for their candidate. Which party's mayor runs city hall?
  1. In a certain population of 48% men and 52% women, 56% of the men and 8% of the women are color-blind.
    1. What percent of the people are color-blind?
    2. If a person is found to be color-blind, what is the probability that the person is a male?
  1. A test for a certain disease gives a positive result 95% of the time if the person actually carries the disease. However, the test also gives a positive result 3% of the time when the individual is not carrying the disease. It is known that 10% of the population carries the disease. If a person tests positive, what is the probability that he or she has the disease?
  1. A person has two coins: a fair coin and a two-headed coin. A coin is selected at random, and tossed. If the coin shows a head, what is the probability that the coin is fair?
  1. A computer company buys its chips from three different manufacturers. Manufacturer I provides 60% of the chips and is known to produce 5% defective; Manufacturer II supplies 30% of the chips and makes 4% defective; while the rest are supplied by Manufacturer III with 3% defective chips. If a chip is chosen at random, find the following probabilities:
    1. P(the chip is defective)
    2. P(chip is from Manufacturer II | defective)
    3. P(defective |chip is from manufacturer III)
  1. Lincoln Union High School District is made up of three high schools: Monterey, Fremont, and Kennedy, with an enrollment of 500, 300, and 200, respectively. On a given day, the percentage of students absent at Monterey High School is 6%, at Fremont 4%, and at Kennedy 5%. If a student is chosen at random, find the probabilities below: Hint: Convert the enrollments into percentages.
    1. P(the student is absent)
    2. P(student is from Kennedy | student is absent)
    3. P(student is absent | student is from Fremont)

9. At a retail store, 20% of customers use the store’s online app to assist them when shopping in the store ; 80% of store shoppers don’t use the app.

Of those customers that use the online app while in the store, 50% are very satisfied with their purchases, 40% are moderately satisfied, and 10% are dissatisfied.

Of those customers that do not use the online app while in the store, 30% are very satisfied with their purchases, 50% are moderately satisfied and 20% are dissatisfied.

Indicate the events by the following:

A = shopper uses the app in the store
N = shopper does not use the app in the store
V = very satisfied with purchase
M = moderately satisfied
D = dissatisfied

a. Find P(A and D), the probability that a store customer uses the app and is dissatisfied

b. Find P(A|D), the probability that a store customer uses the app if the customer is dissatisfied.

10. A medical clinic uses a pregnancy test to confirm pregnancy in patients who suspect they are pregnant. Historically data has shown that overall, 70% of the women at this clinic who are given the pregnancy test are pregnant, but 30% are not.

The test's manufacturer indicates that if a woman is pregnant, the test will be positive 92% of the time.

But if a woman is not pregnant, the test will be positive only 2% of the time and will be negative 98% of the time.

a. Find the probability that a woman at this clinic is pregnant and tests positive.

b. Find the probability that a woman at this clinic is actually pregnant given that she tests positive.



The definition of conditional probability is used to write

( P(A) P(E_i | A) = P(E_i) P(A | E_i) )
which gives
( P(E_i | A) = dfrac )

Substitute ( P(A) ) by the above sum to write Bayes' theorem as follows


Teacher

The curriculum is defined to be all that is covered in lectures and exercises, as described on the course homepage under "Lecture plan and progress" and "Exercises".

The following list gives references to the planned topics covered from the course book: Statistical Inference by George Casella and Roger Berger (Second Edition)
Chapter 1: Probability theory. Assumed known
Chapter 2: Transformations and expectations. 2.1 (assumed known) 2.2-2.4
Chapter 3: Common families of distributions. 3.1-3.3 (assumed known) 3.4, 3.5, 3.6.1
Chapter 4: Multiple random variables. 4.1-4.6 (4.5 only partly) 4.7 (only Cauchy-Schwarz and Jensen's inequality)
Chapter 5: Properties of a random sample. 5.1-5.3 (not all in detail),5.5.1, 5.5.3, 5.5.4.
Chapter 6: Principles of data reduction. 6.1, 6.2.1, 6.2.2, Def. 6.2.21, Examples 6.22.22-23, Theorem 6.2.25
Chapter 7: Point estimation. 7.1, 7.2.1, 7.2.2, 7.2.3, 7.3.1 (except from "In certain situations…" on p. 333), 7.3.2, 7.3.3 (from beginning to Example 7.3.18, then from top of page 347 and rest of section 7.3.3 Theorem 7.5.1.
Chapter 8: Hypothesis testing. 8.1, 8.2.1, 8.3.1 (except page 387), 8.3.2 until Def. 8.3.16 (only part a in Theorem 8.3.12).
Chapter 9: Interval estimation. 9.1, 9.2
Chapter 10: Asymptotic evaluations. 10.1.1, 10.1.2, 10.1.3, 10.3.1 to theorem 10.3.3, Score statistic on page 494.

The exam will be on December 9., 9.00-13.00. It will be a written exam. You are allowed to bring with you:
Tabeller og formler i statistikk
NTNU certified calculator
Personal, handwritten, stamped yellow sheet, A5-format. You get the sheet in the Department office, 7. floor
The exam text will contain a collections of results from the text-book as given here

Earlier exams with solutions can be found here:earlier exams

Meeting time before the exam

Tuesday December 5 : 12-14
Wednesday December 6: 10-12
Friday December 8 : 12-14


Being General

Let us replace the numbers with letters:

Now let us look at probabilities. So we take some ratios:

  • the overall probability of "A" is P(A) = s+ts+t+u+v
  • the probability of "B given A" is P(B|A) = ss+t

And then multiply them together like this:

Now let us do that again but use P(B) and P(A|B):

Both ways get the same result of ss+t+u+v

Nice and symmetrical isn't it?

It actually has to be symmetrical as we can swap rows and columns and get the same top-left corner.

And it is also Bayes Formula . just divide both sides by P(B):

P(A|B) = P(A) P(B|A)P(B)


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.


A factory has two machines I and II. Machine I produces 40% of items of the output and Machine II produces 60% of the items. Further 4% of items produced by Machine I are defective and 5% produced by Machine II are defective. An item is drawn at random. If the drawn item is defective, find the probability that it was produced by Machine II. (See the previous example, compare the questions).

Let A 1 be the event that the items are produced by Machine-I, A 2 be the event that items are produced by Machine-II. Let B be the event of drawing a defective item. Now we are asked to find the conditional probability P (A 2 / B). Since A 1 , A 2 are mutually exclusive and exhaustive events, by Bayes’ theorem,


P ( A 1 ) =0.40 , P ( B / A 1 ) = 0.04

P ( A 2 ) = 0.60, P ( B / A 2 ) = 0.05



Problem 1:

Let’ s work on a simple NLP problem with Bayes Theorem. By using NLP, I can detect spam e-mails in my inbox. Assume that the word ‘offer’ occurs in 80% of the spam messages in my account. Also, let’s assume ‘offer’ occurs in 10% of my desired e-mails. If 30% of the received e-mails are considered as a scam, and I will receive a new message which contains ‘offer’, what is the probability that it is spam?

Now, I assume that I received 100 e-mails. The percentage of spam in the whole e-mail is 30%. So, I have 30 spam e-mails and 70 desired e-mails in 100 e-mails. The percentage of the word ‘offer’ that occurs in spam e-mails is 80%. It means 80% of 30 e-mail and it makes 24. Now, I know that 30 e-mails of 100 are spam and 24 of them contain ‘offer’ where 6 of them not contains ‘offer’.

The percentage of the word ‘offer’ that occurs in the desired e-mails is 10%. It means 7 of them (10% of 70 desired e-mails) contain the word ‘offer’ and 63 of them not.

Now, we can see this logic in a simple chart.

The question was what is the probability of spam where the mail contains the word ‘offer’:

24 +7 = 31 mail contain the word ‘offer’

2. Find the probability of spam if the mail contains ‘offer’

In 31 mails 24 contains ‘offer’ means 77.4% = 0.774 (probability)

NOTE: In this example, I choose the percentages which give integers after calculation. As a general approach, you can think that we have 100 units at the beginning so if the results are not an integer, it will not create a problem. Such that, we cannot say 15.3 e-mails but we can say 15.3 units.

Solution with Bayes’ Equation:

B = Contains the word ‘offer’

P( contains offer|spam) = 0.8 (given in the question)

P(spam) = 0.3 (given in the question)

Now we will find the probability of e-mail with the word ‘offer’. We can compute that by adding ‘offer’ in spam and desired e-mails. Such that

P(contains offer) = 0.3*0.8 + 0.7*0.1 = 0.31

As it is seen in both ways the results are the same. In the first part, I solved the same question with a simple chart and for the second part, I solved the same question with Bayes’ theorem.


Linda the Banker¶

To introduce conditional probability, I’ll use an example from a famous experiment by Tversky and Kahneman, who posed the following question:

  1. Linda is a bank teller.

  2. Linda is a bank teller and is active in the feminist movement.

Many people choose the second answer, presumably because it seems more consistent with the description. It seems uncharacteristic if Linda is just a bank teller it seems more consistent if she is also a feminist.

But the second answer cannot be “more probable”, as the question asks. Suppose we find 1000 people who fit Linda’s description and 10 of them work as bank tellers. How many of them are also feminists? At most, all 10 of them are in that case, the two options are equally probable. If fewer than 10 are, the second option is less probable. But there is no way the second option can be more probable.

If you were inclined to choose the second option, you are in good company. The biologist Stephen J. Gould wrote :

I am particularly fond of this example because I know that the [second] statement is least probable, yet a little homunculus in my head continues to jump up and down, shouting at me, “but she can’t just be a bank teller read the description.”

If the little person in your head is still unhappy, maybe this chapter will help.


Exercise 12.4: Bayes Theorem

(1) A factory has two Machines-I and II. Machine-I produces 60% of items and Machine-II produces 40% of the items of the total output. Further 2% of the items produced by Machine-I are defective whereas 4% produced by Machine-II are defective. If an item is drawn at random what is the probability that it is defective?

(2) There are two identical urns containing respectively 6 black and 4 red balls, 2 black and 2 red balls. An urn is chosen at random and a ball is drawn from it. (i) find the probability that the ball is black (ii) if the ball is black, what is the probability that it is from the first urn?

(3) A firm manufactures PVC pipes in three plants viz, X, Y and Z. The daily production volumes from the three firms X , Y and Z are respectively 2000 units, 3000 units and 5000 units. It is known from the past experience that 3% of the output from plant X , 4% from plant Y and 2% from plant Z are defective. A pipe is selected at random from a day’s total production,

(i) find the probability that the selected pipe is a defective one.

(ii) if the selected pipe is a defective, then what is the probability that it was produced by plant Y ?

(4) The chances of A, B and C becoming manager of a certain company are 5 : 3 : 2. The probabilities that the office canteen will be improved i f A, B , and C become managers are 0.4, 0.5 and 0.3 respectively. If the office canteen has been improved, what is the probability that B was appointed as the manager?

(5) An advertising executive is studying television viewing habits of married men and women during prime time hours. Based on the past viewing records he has determined that during prime time wives are watching television 60% of the time. It has also been determined that when the wife is watching television, 40% of the time the husband is also watching. When the wife is not watching the television, 30% of the time the husband is watching the television. Find the probability that (i) the husband is watching the television during the prime time of television (ii) if the husband is watching the television, the wife is also watching the television.

Answers (1) 0.028 (2) (i) 11/20 (ii) 6/11 (3) (i) 7/250 (ii) 3/7 (4) 15/41 (5) (i) 9/25 (ii) 2/3


Bayes’ Theorem

In statistics and probability theory, the Bayes&rsquo theorem (also known as the Bayes&rsquo rule) is a mathematical formula used to determine the conditional probability of events. Essentially, the Bayes&rsquo theorem describes the probability Total Probability Rule The Total Probability Rule (also known as the law of total probability) is a fundamental rule in statistics relating to conditional and marginal of an event based on prior knowledge of the conditions that might be relevant to the event.

The theorem is named after English statistician, Thomas Bayes, who discovered the formula in 1763. It is considered the foundation of the special statistical inference approach called the Bayes&rsquo inference.

Besides statistics Basic Statistics Concepts for Finance A solid understanding of statistics is crucially important in helping us better understand finance. Moreover, statistics concepts can help investors monitor , the Bayes&rsquo theorem is also used in various disciplines, with medicine and pharmacology as the most notable examples. In addition, the theorem is commonly employed in different fields of finance. Some of the applications include but are not limited to, modeling the risk of lending money to borrowers or forecasting the probability of the success of an investment.

Formula for Bayes&rsquo Theorem

The Bayes&rsquo theorem is expressed in the following formula:

  • P(A|B) &ndash the probability of event A occurring, given event B has occurred
  • P(B|A) &ndash the probability of event B occurring, given event A has occurred
  • P(A) &ndash the probability of event A
  • P(B) &ndash the probability of event B

Note that events A and B are independent events Independent Events In statistics and probability theory, independent events are two events wherein the occurrence of one event does not affect the occurrence of another event (i.e., the probability of the outcome of event A does not depend on the probability of the outcome of event B).

A special case of the Bayes&rsquo theorem is when event A is a binary variable. In such a case, the theorem is expressed in the following way:

  • P(B|A &ndash ) &ndash the probability of event B occurring given that event A &ndash has occurred
  • P(B|A + ) &ndash the probability of event B occurring given that event A + has occurred

In the special case above, events A &ndash and A + are mutually exclusive outcomes of event A.

Example of Bayes&rsquo Theorem

Imagine you are a financial analyst at an investment bank. According to your research of publicly-traded companies Private vs Public Company The main difference between a private vs public company is that the shares of a public company are traded on a stock exchange, while a private company's shares are not. , 60% of the companies that increased their share price by more than 5% in the last three years replaced their CEOs CEO A CEO, short for Chief Executive Officer, is the highest-ranking individual in a company or organization. The CEO is responsible for the overall success of an organization and for making top-level managerial decisions. Read a job description during the period.

At the same time, only 35% of the companies that did not increase their share price by more than 5% in the same period replaced their CEOs. Knowing that the probability that the stock prices grow by more than 5% is 4%, find the probability that the shares of a company that fires its CEO will increase by more than 5%.

Before finding the probabilities, you must first define the notation of the probabilities.

  • P(A) &ndash the probability that the stock price increases by 5%
  • P(B) &ndash the probability that the CEO is replaced
  • P(A|B) &ndash the probability of the stock price increases by 5% given that the CEO has been replaced
  • P(B|A) &ndash the probability of the CEO replacement given the stock price has increased by 5%.

Using the Bayes&rsquo theorem, we can find the required probability:

Thus, the probability that the shares of a company that replaces its CEO will grow by more than 5% is 6.67%.

Related Readings

CFI offers the Financial Modeling & Valuation Analyst (FMVA)&trade Become a Certified Financial Modeling & Valuation Analyst (FMVA)® CFI's Financial Modeling and Valuation Analyst (FMVA)® certification will help you gain the confidence you need in your finance career. Enroll today! certification program for those looking to take their careers to the next level. To keep learning and advancing your career, the following CFI resources will be helpful:

  • Forecasting Forecasting Forecasting refers to the practice of predicting what will happen in the future by taking into consideration events in the past and present. Basically, it is a decision-making tool that helps businesses cope with the impact of the future&rsquos uncertainty by examining historical data and trends.
  • High-Low Method High-Low Method In cost accounting, the high-low method is a technique used to split mixed costs into variable and fixed costs. Although the high-low method
  • Law of Large Numbers Law of Large Numbers In statistics and probability theory, the law of large numbers is a theorem that describes the result of repeating the same experiment a large number of
  • Nominal Data Nominal Data In statistics, nominal data (also known as nominal scale) is a type of data that is used to label variables without providing any quantitative value

Financial Analyst Certification

Become a certified Financial Modeling and Valuation Analyst (FMVA)® Become a Certified Financial Modeling & Valuation Analyst (FMVA)® CFI's Financial Modeling and Valuation Analyst (FMVA)® certification will help you gain the confidence you need in your finance career. Enroll today! by completing CFI&rsquos online financial modeling classes and training program!