Module # 4 Probability theory
Feb 4, 2025
In this week, we are getting into probability theory. I have taken Statistics previously, so it was fun to jog my memory. The problems this week I found to be slightly challenging, having to apply new concepts within R. Bayes' theorem was particularly interesting—it’s useful not just in theoretical applications but also in everyday situations, like interpreting predictions or making decisions based on uncertain information. I’m looking forward to mastering them further and using R more effectively to solve complex problem. To begin with the homework:
A. Based on Table 1 What is the probability of:
| B | B1 | |
| A | 10 | 20 |
| A1 | 20 | 40 |
A1. Event A - 0.33
A2. Event B - 0.33
A3. Event A or B- 0.56
A4. P(A or B) = P(A) + P(B)- 0.67
B. 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.
True.
B2. Please explain why?
Based on Bayes' Theorem, this answer is true because it accounts for both the prior probability of rain (rain in the desert) and the weatherman's prediction accuracy. We know the weatherman correctly predicts rain 90% of the time, and incorrectly predicts rain 10%.
To determine the probability of rain on Jane’s wedding day, we calculate the prior probabilities:
- P(A1), the probability it will rain, is 5/365.
- P(A2), the probability it will not rain, is 360/365.
Then, we use Bayes' Theorem to update the probability of rain (P(A1|B)), given the weatherman's forecast of rain (event B). This involves calculating the weighted likelihood of rain given the weatherman's prediction, factoring in both the weatherman’s accuracy and the rarity of rain.
When we calculate this, the probability of rain on Jane's wedding day is about 11%. Despite the weatherman's prediction of rain, the rare occurrence of rain in the desert and the chance of a false positive leads to a relatively low final probability of rain. This result highlights how Bayes' Theorem allows us to combine prior knowledge (the rarity of rain) with new evidence (the weatherman's prediction) to make a more informed probability prediction.
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?
A hint, use dbinom function - it is part of R functions that count Density, distribution function, quantile function, and random generation for the binomial distribution with parameters size and prob.
The result 0.10737 or 10.74%.
Comments
Post a Comment