Module 4: Probably applying Probability Rules

 Hi everyone! 

For this week's assignment, we are applying the probability rules we have learned like the addition, multiplication, and conditional rules. An important distinction in choosing the right rule is if the events you analyze are mutually exclusive or not and independent or not. Mutually exclusive means these events cannot happen at the same time like riding a bike to work versus who walks to work on a given day. Independent events means an outcome of one event does not affect the outcome of the other. 

We apply the addition rule with mutual exclusivity or "or" problems and the multiplication rules with the independence or "and" problems. If mutually exclusive P(A or B) is P(A) + P(B), but if not then P(A or B) = P(A) + P(B) - P(A and B). If independent P(A and B) = P(A) * P(B), but if not then P(A and B) = P(A) * P(B|A).

Let's do some stats!

1. A. Based on Table 1 What is the probability of:                 

B

B1

Total

A

10

20

30

A1

20

40

60

Total

30

60

90


*I added a total row and column for easier calculations

A1. Event A? 

P(A) = 30 / 90 = 1/3


A2. Event B?

P(B) = 30 / 90 = 1/3


A3. Event A or B?

P(A or B) = P(A) + P(B) - P(A and B) = 1/3 + 1/3 - 1/9 = 5/9

A4. P(A or B) = P(A) + P(B)?

1/3 + 1/3 = 2/3 

Application: We can tell Event A and B are not mutually exclusive from our answers in A3 and A4 since they are not equal.

-----------------------------------------------------------------------------------------------------------------------------

B. Applying Bayes' Theorem 
Jane is getting married tomorrow, at an outdoor ceremony in the desert. In recent years, it has rained only 5 days each year. Unfortunately, the weatherman has predicted rain for tomorrow. When it actually rains, the weatherman correctly forecasts rain 90% of the time. When it doesn't rain, he incorrectly forecasts rain 10% of the time.

Question: What is the probability that it will rain on the day of Jane's wedding? 

Solution: The sample space is defined by two mutually-exclusive events - it rains or it does not rain. Additionally, a third event occurs when the weatherman predicts rain. Notation for these events appears below.

Event A1. It rains on Jane's wedding.
Event A2. It does not rain on Marie's wedding.
Event B. The weatherman predicts rain.

In terms of probabilities, we know the following:
P( A1 ) = 5/365 =0.0136985 [It rains 5 days out of the year.]
P( A2 ) = 360/365 = 0.9863014 [It does not rain 360 days out of the year.]
P( B | A1 ) = 0.9 [When it rains, the weatherman predicts rain 90% of the time.]
P( B | A2 ) = 0.1 [When it does not rain, the weatherman predicts rain 10% of the time.]
We want to know P( A1 | B ), the probability it will rain on the day of Marie's wedding, given a forecast for rain by the weatherman. The answer can be determined from Bayes' theorem, as shown below.

P( A1 | B ) = P( A1 ) P( B | A1 )
P( A1 ) P( B | A1 ) + P( A2 ) P( B | A2 )
P( A1 | B ) = (0.014)(0.9) / [ (0.014)(0.9) + (0.986)(0.1) ]
P( A1 | B ) = 0.111
Note the somewhat unintuitive result. Even when the weatherman predicts rain, it only rains only about 11% of the time. Despite the weatherman's gloomy prediction, there is a good chance that Marie will not get rained on at her wedding.


B1. Is this answer True or False? 

True

B2. Please explain why?

The prediction it will not rain at her wedding is true because the weatherman only predicts rain 10% of the time when it does not rain and since our answer is 11% which is close to 10% we can estimate it will not rain. 

Another way to look at this is the favorable outcome of it raining when the weather man predicts it is 0.9 estimation times 5 times a year equals 4.5 (our numerator). The unfavorable outcome of it not raining when he predicts it is .1 times 360 times a year added to his probability of being right when it rains (4.5) is 40.5. Our probability it will rain on her wedding when he predicts rain is thus .11. This seems unintuitive because we expect the weather man to be right, but his prediction going wrong is more likely since there are more days (360 > 5) he predicts the 10% rain, making the denominator large and thus his prediction being right low.

-----------------------------------------------------------------------------------------------------------------------------

For a disease known to have a postoperative complication frequency of 20%, a surgeon suggests a new procedure. She/he tests it on 10 patients and found there are not complications.

C1: What is the probability of operating on 10 patients successfully with the traditional method?

>dbinom(10,10,.8) 

[1] 0.1073742

Here I used the density binomial distribution because this finds the probability of success in a sample of n values which here is 10 patients having a successful operation. The probability of no complications in the traditional way, or what the surgeon was trying to change, is 1 - .2 = .8. Our sample size is 10 patients. First, we input the x value of 10 patients (we want 10 successes), the sample size which is also 10 patients, and the probability of no complications at .8. There is about a 10.7% chance of operating on 10 patients successfully with the traditional method.

-Ramya's POV


Comments

Popular posts from this blog

Module 10: Varying Multivariate Regression

Final Project: Serially looking at your Cereal Choices

Module 12: Timely Time Series