Module # 4 Probability theory

Issaiah Jennings 
Module # 4 Probability theory

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

BB1
A1020
A12040

A1. Event A
A2. Event B?
A3. Event A or B

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


# Total observations in the table

> total <- 10 + 20 + 20 + 40

> # A1. Probability of Event A

> P_A <- (10 + 20) / total

> cat("P(A) =", P_A, "\n")

P(A) = 0.3333333 

> # A2. Probability of Event B

> P_B <- (10 + 20) / total

> cat("P(B) =", P_B, "\n")

P(B) = 0.3333333 

> # A3. Probability of A or B

> P_A_or_B <- (10 + 20 + 20) / total

> cat("P(A or B) =", P_A_or_B, "\n")

P(A or B) = 0.5555556 

> # A4. Verifying P(A or B) = P(A) + P(B) - P(A and B)

> P_A_and_B <- 10 / total  # Intersection of A and B

> P_A_or_B_formula <- P_A + P_B - P_A_and_B

> cat("P(A or B) using formula =", P_A_or_B_formula, "\n")

P(A or B) using formula = 0.5555556 


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.

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. --
The answer is True.
B2. 
Please explain why?

Probability that it rains on Jane's wedding (P(A1)P(A1)P(A1)):P(A1)=5365≈0.0136985P(A1) = \frac{5}{365} \approx 0.0136985P(A1)=3655​≈0.0136985


Probability that it does not rain on Jane's wedding (P(A2)P(A2)P(A2)):P(A2)=360365≈0.9863014P(A2) = \frac{360}{365} \approx 0.9863014P(A2)=365360​≈0.9863014


Probability that the weatherman predicts rain given that it rains (P(B∣A1)P(B | A1)P(B∣A1)):P(B∣A1)=0.9P(B | A1) = 0.9P(B∣A1)=0.9


Probability that the weatherman predicts rain given that it does not rain (P(B∣A2)P(B | A2)P(B∣A2)):P(B∣A2)=0.1P(B | A2) = 0.1P(B∣A2)=0.1


>  Looking at data with only 5 rainy days a year alongside the weatherman's accuracy, we can calculate the probability of rain based on his forecast. This indicates that, even with a forecast for rain, the actual chance is only 11%. It highlights the importance of considering underlying probabilities, which makes Bayes' theorem the best method for analyzing this situation.


C. Last assignment from our textbook, pp. 55 Exercise # 2.3.
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. What is the probability of operating on 10 patients successfully with the tradtional method?

> dbinom(0, size = 10,prob = 0.20) [1] 0.1073742

Comments

Popular posts from this blog

The Final project in this class

Module # 8 Assignment

Module # 6 assignment