Presentation is loading. Please wait.

Presentation is loading. Please wait.

Bayes Rule for probability

Similar presentations


Presentation on theme: "Bayes Rule for probability"— Presentation transcript:

1 Bayes Rule for probability

2 An generalization of Bayes Rule
Let A1, A2 , … , Ak denote a set of events such that for all i and j. Then

3 Example: We have three urns. Urn 1 contains 14 red balls and 12 black balls. Urn 2 contains 6 red balls and 20 black balls. Urn 3 contains 3 red balls and 23 black balls. An Urn is selected at random and a ball is selected from that urn. Urn 1 Urn 2 Urn 3 If the ball turns out to be red what is the probability that it came from the first urn? second urn? third Urn?

4 Solution: Let Ai = the event that we select urn i
Let B = the event that we select a red ball Note: the desired conditional probability is in the reverse direction of the given conditional probabilities. This is the case when Bayes rule should be used

5 Bayes rule states

6 Suppose that an electronic device is manufactured by a company.
Example: Suppose that an electronic device is manufactured by a company. During a period of a week 15% of this product is manufactured on Monday, 23% on Tuesday, 26% on Wednesday , 24% on Thursday and 12% on Friday.

7 Also during a period of a week
5% of the product is manufactured on Monday is defective 3 % of the product is manufactured on Tuesday is defective, 1 % of the product is manufactured on Wednesday is defective , 2 % of the product is manufactured on Thursday is defective and 6 % of the product is manufactured on Friday is defective. If the electronic device manufactured by this plant turns out to be defective, what is the probability that is as manufactured on Monday, Tuesday, Wednesday, Thursday or Friday?

8 Solution: Let A1 = the event that the product is manufactured on Monday A2 = the event that the product is manufactured on Tuesday A3 = the event that the product is manufactured on Wednesday A4 = the event that the product is manufactured on Thursday A5 = the event that the product is manufactured on Friday Let B = the event that the product is defective

9 Now P[A1] = 0.15, P[A2] = 0.23, P[A3] = 0.26, P[A4] = 0.24 and P[A5] = 0.12 Also P[B|A1] = 0.05, P[B|A2] = 0.03, P[B|A3] = 0.01, P[B|A4] = 0.02 and P[B|A5] = 0.06 We want to find P[A1|B], P[A2|B], P[A3|B], P[A4|B] and P[A5|B] . We will apply Bayes Rule

10 i P[Ai] P[B|Ai] P[Ai]P[B|Ai] P[Ai|B] 1 0.15 0.05 0.0075 0.2586 2 0.23 0.03 0.0069 0.2379 3 0.26 0.01 0.0026 0.0897 4 0.24 0.02 0.0048 0.1655 5 0.12 0.06 0.0072 0.2483 Total 1.00 0.0290 1.0000

11 The sure thing principle and Simpson’s paradox

12 The sure thing principle
Suppose Example – to illustrate Let A = the event that horse A wins the race. B = the event that horse B wins the race. C = the event that the track is dry = the event that the track is muddy

13 Proof:

14 Simpson’s Paradox Does Example to illustrate
D = death due to lung cancer S = smoker C = lives in city, = lives in country

15 If we let Then the statement would be true using the Sure Thing Principle This logic is incorrect The events are not defined and do not make sense. The conditional probabilities are defined.

16 Solution similarly

17 whether is greater than depends also on the values of

18 whether than and

19 The Monty Hall Problem 1 2 3 Behind one of the three doors there is a valuable prize. Behind the other two doors is a worthless prize. You are asked to pick one of the doors. After you have selected, Monty Hall opens one of the doors and reveals a worthless prize. He then asks you do you want to switch your choice.

20 Should you change your choice?
Should you keep your first choice? or It does not matter. Solution Suppose you choice is door #1, and Monty reveals that door #3 has a worthless prize behind it. We can always renumber the doors so that this is the case. Let Ai = the event that the valuable prize is behind door number i. i = 1, 2, 3. P [A1] = P [A2] = P [A3] =1/3 S = A1  A2  A3 and Ai  Aj = f

21

22 Another Solution (the correct solution)
The probability that you pick the correct door is 1/3 . If you pick the correct door Monty will pick randomly between the two worthless doors. If you did not pick the correct door Monty will choose the worthless door to open with with probability 1. Again P [A1] = P [A2] = P [A3] =1/3 and S = A1  A2  A3 and Ai  Aj = f Let Bi = the event that Monty opens door i. i = 1, 2, 3.

23 Also and We want to compute P [A1|B3] andP [A2|B3].

24 and

25 Another Problem We have three chests each having 2 drawers
1 2 3 We have three chests each having 2 drawers In chest 1 there is a gold coin in each drawer. In chest 2 there is a silver coin in each drawer. In chest 3 there is a gold coin in the top drawer and a silver coin in the bottom drawer..

26 Ci = the event that we select Chest i. i = 1, 2, 3.
One of the chests is selected at random. Then the drawer is selected at random. The coin in that drawer turns out to be gold. What is the probability that the coin in the other drawer is also gold? Is it ½ ? Solution Let Ci = the event that we select Chest i. i = 1, 2, 3. P [C1] = P [C2] = P [C3] =1/3 S = C1  C2  C3 and Ci  Cj = f

27 Let D1 = the event that we select top drawer in the chest. D2 = the event that we select bottom drawer in the chest. Let G = the event the coin in the drawer is gold = (C1  D1)  (C1  D2)  (C3  D1) We want to compute P[C1|G].

28 Thus Comment: There are 6 drawers and three of those drawers contain gold coins. Of those three drawers two are in a chest that has a gold coin in the other drawer.

29 an important concept in probability
Random Variables an important concept in probability

30 A random variable , X, is a numerical quantity whose value is determined be a random experiment
Examples Two dice are rolled and X is the sum of the two upward faces. A coin is tossed n = 3 times and X is the number of times that a head occurs. We count the number of earthquakes, X, that occur in the San Francisco region from 2000 A. D, to 2050A. D. Today the TSX composite index is 11,050.00, X is the value of the index in thirty days

31 Examples – R.V.’s - continued
A point is selected at random from a square whose sides are of length 1. X is the distance of the point from the lower left hand corner. point X A chord is selected at random from a circle. X is the length of the chord. chord X

32 Definition – The probability function, p(x), of a random variable, X.
For any random variable, X, and any real number, x, we define where {X = x} = the set of all outcomes (event) with X = x.

33 Definition – The cumulative distribution function, F(x), of a random variable, X.
For any random variable, X, and any real number, x, we define where {X ≤ x} = the set of all outcomes (event) with X ≤ x.

34 Examples Two dice are rolled and X is the sum of the two upward faces. S , sample space is shown below with the value of X for each outcome (1,1) 2 (1,2) 3 (1,3) 4 (1,4) 5 (1,5) 6 (1,6) 7 (2,1) (2,2) (2,3) (2,4) (2,5) (2,6) 8 (3,1) (3,2) (3,3) (3,4) (3,5) (3,6) 9 (4,1) (4,2) (4,3) (4,4) (4,5) (4,6) 10 (5,1) (5,2) (5,3) (5,4) (5,5) (5,6) 11 (6,1) (6,2) (6,3) (6,4) (6,5) (6,6) 12

35

36 Graph p(x) x

37 The cumulative distribution function, F(x)
For any random variable, X, and any real number, x, we define where {X ≤ x} = the set of all outcomes (event) with X ≤ x. Note {X ≤ x} = f if x < 2. Thus F(x) = 0. {X ≤ x} = {(1,1)} if 2 ≤ x < 3. Thus F(x) = 1/36 {X ≤ x} = {(1,1) ,(1,2),(1,2)} if 3 ≤ x < 4. Thus F(x) = 3/36

38 Continuing we find F(x) is a step function

39 A coin is tossed n = 3 times and X is the number of times that a head occurs.
The sample Space S = {HHH (3), HHT (2), HTH (2), THH (2), HTT (1), THT (1), TTH (1), TTT (0)} for each outcome X is shown in brackets

40 Graph probability function
p(x) x

41 Graph Cumulative distribution function
F(x) x

42 Examples – R.V.’s - continued
A point is selected at random from a square whose sides are of length 1. X is the distance of the point from the lower left hand corner. point X A chord is selected at random from a circle. X is the length of the chord. chord X

43 Examples – R.V.’s - continued
A point is selected at random from a square whose sides are of length 1. X is the distance of the point from the lower left hand corner. point X S An event, E, is any subset of the square, S. P[E] = (area of E)/(Area of S) = area of E E

44 The probability function
S Thus p(x) = 0 for all values of x. The probability function for this example is not very informative

45 The Cumulative distribution function

46 S

47

48

49 The probability density function, f(x), of a continuous random variable
Suppose that X is a random variable. Let f(x) denote a function define for - < x <  with the following properties: f(x) ≥ 0 Then f(x) is called the probability density function of X. The random, X, is called continuous.

50 Probability density function, f(x)

51 Cumulative distribution function, F(x)

52 Thus if X is a continuous random variable with probability density function, f(x) then the cumulative distribution function of X is given by: Also because of the fundamental theorem of calculus.

53 Example A point is selected at random from a square whose sides are of length 1. X is the distance of the point from the lower left hand corner. point X

54 Now

55 Also

56 Now and

57 Finally

58 Graph of f(x)


Download ppt "Bayes Rule for probability"

Similar presentations


Ads by Google