In this article I attempt to answer questions regarding the very important and equally difficult subject of probability. *Cheering noises*
A. Based on the table, calculate the following probabilities:
B | B1 | |
A | 10 | 20 |
A1 | 20 | 40 |
A1: Event A occurs.
The probability of event A occurring would be about 30/90 or 33% chance of A occurring.
A2: Event B occurs.
The probability of event B occurring would be about 30/90 or 33% chance of B occurring.
A3: Event A or B occurs.
The probability of A or B occurring would be the sum of both minus the probability of both occurring.
P(A or B) = P(A + B) = P(A) + P(B) – P(A and B)
Plugging in for A and B it becomes,
P(A or B) = 30/90 + 30/90 – 10/90 = 50/90
Thus the probability of A or B occurring is 50/90 or 55.5% chance of either A or B occurring.
B. Applying Bayes’ Theorem
The given problem is stated as thus:
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.
LIS 4273 Module 4 Assignment Page
A potential solution is also given, and is stated as:
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 )
LIS 4273 Module 4 Assignment Page
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?
This answer is true.
B2. Explain why.
To begin, the math provided in the potential solution is correct, there are no errors in the arithmetic, so if there was to be an error there, it does not exist. Thus the only errors that will be found, given the assumptions stated by the problem, will be in the application of Bayes’ Theorem. To explain why the solution given is correct, I will attempt to solve the problem in a slightly different way.
The question that Julie and the weatherman are trying to answer is weather(haha, see what I did there?) or not it will rain tomorrow. Prior experience says 5 out of 365 days of the year it will rain. Or in other words on any given day of the year there is a 5 out of 365 chance that there will be rain on any single day. Thus our Prior assumption is that tomorrow there is a 5 out of 365 chance of rain.
Next we are provided with new evidence, the weatherman has stated that tomorrow it will rain. It is known he has a 90% accuracy in being correct about whether it will rain tomorrow.
I phrase the problem in this way because Bayes’ theorem does not determine belief based on evidence, it updates prior belief based on new evidence. Bayes’ theorem is meant to be used in a repetitive fashion, constantly updating prior belief based on new evidence. In this problem the prior assumption or belief was that tomorrow has a 5 out of 365 chance or 1.37% of rain. The weatherman then provides new evidence saying it will rain, and he is 90% accurate.
With that in mind, our probability of the hypothesis being true becomes 1.37%. Then our evidence given that the hypothesis being true is 90%. So the variables to plugin for Bayes’ theorem are as listed:
- P(H) = 5 / 365 = 0.0137
- P(!H) = 360/365 = 0.9863
- P(E | H) = 0.9
- P(E | !H) = 0.1
(Here the ! means not. Technically in probability one is supposed to use a funny little elbow thing. However I do not know how to type that, and in programming the ! means the same thing, so I use it instead.)
These values are then plugged into the equation below:
P(H | E) = {P(E | H) * P(H)} / {[P(H) * P(E | H)] + [P(!H) * P(E | !H)]}
Or optionally use this simple R script I wrote to quickly punch out a value:
# Code can be copied and pasted directly into R console
A1 <- 5 / 365
A2 <- 360 / 365
B1 <- 0.9
B2 <- 0.1
bayes <- function(H, NotH, E_given_H, E_given_NotH) {
(H * E_given_H) / ((H * E_given_H) + (NotH * E_given_NotH))
}
bayes(A1, A2, B1, B2)
Code language: R (r)
The output from the equation with the given inputs would be 0.1111, or approximately 11%. This would mean given prior assumption and new evidence that there is an 11% chance of rain tomorrow. Now since there was no problem with the arithmetic, and all the variables seem to be properly filled in there was no error in the original solution.
I would like to add, whether the weatherman’s prediction is new evidence, or is a hypothesis is irrelevant with Bayes’ Theorem, the result will be the same in the end regardless. Mistakes can be introduced if for example, the hypothesis and the not hypothesis were flipped without flipping Evidence given the hypothesis and not hypothesis. (In the R script exchange A1 with A2, B1 with B2. The result will be different). This is because probability can be represented by area, with Bayes’ Theorem it is a square. The hypotheses and not hypothesis make up the width, and then the likelihood of the evidence being true given the hypothesis or not hypothesis fills up two small rectangles within. See Image 1 below to see what I mean. To summarize, Bayes’ theorem serves to restrict the space of possibility with evidence and then create a ratio between the restricted hypothesis being true, and the total area of the evidence being true.
Now for Julie’s wedding, does this mean they should forgo their umbrellas? No, with an increase from 1.37% to 11%, that is a significant increase from baseline and should be indicative of rain tomorrow. Julie should also check with another weatherman to increase her confidence level for the chance of rain tomorrow.
For those that do not understand and wish to know more about Bayes’ Theorem, I suggest this video by 3 Blue 1 Brown: https://youtu.be/HZGCoVF3YvM