Solve Bayes' Rule Question: Probability of Rain Tomorrow

In summary, the question asks for the probability of rain tomorrow given that the app predicts rain, using Bayesian analysis. The prior probability of rain tomorrow is 1/5, and the probability of it not raining is 4/5. The probability of the app correctly predicting rain is 7/10, and the probability of it incorrectly predicting rain is 3/10. Using the formula for Bayesian analysis, the probability of rain tomorrow is calculated to be 0.37.
  • #1
zzmanzz
54
0
Moved from a technical forum, so homework template missing
Hi,

I'm not sure whether my understanding of this question is correct:

An app predicts rain tomorrow. Recently, it has rained only 73 days each year. When it actually rains, the app correctly forecasts rain 70% of the time. When it does not rain, it incorrectly forecasts rain 30% of the time. What is the probability that it will rain tomorrow?

Hint : P(H|D) = P(H) * P (D|H) / P(D)

What I'm mainly confused about is the wording of the question. But here is my attempt:

I set:
H = rain,
D = app predicts rain

then solve for P(D)?

P(H|D) = .3
P(D|H) = .7
P(H) = .2
P(D) = predicts rain (rain tom)
P(D) = (.25 * .7 ) / .3
P(D) = .58

The probability that it will rain tomorrow is .58?

Thanks
 
Physics news on Phys.org
  • #2
is this homework? seems like maybe it is...

Your answer is off a couple ways. (For starters where did the 0.25 come from?) Note: you are supposed to solve for probability of it raining tomorrow given the information you know. I.e. what is the probability of actual rain given that the app has predicted rain. That is ##P(H \vert D)##, not ##P(D)##

I'd strongly recommend drawing a picture (especially a tree here) for these types of problems. Also making a table can be quite helpful.
 
  • #3
Right, so the site has a policy about giving answers to students doing homework, so if this isn't homework let me know and maybe I can say more.

For now, Let us establish what Bayesian analysis does. First, we take the prior probability that something is true and multiply it by the probability that it is true given some new piece of evidence that we have. If the app says it will rain tomorrow, then the prior probability that this is true, without any additional information,is obviously 73/365 which equals, conveniently, 1/5. We multiply this by the strength of our belief that it will rain tomorrow based on our new information, namely, the results of the app saying 'yes, it will rain tomorrow.' That would clearly be 7/10, as I'm pretty sure you already know.

Put that in the numerator.

Next step: we take the prior probability that the hypothesis 'it will rain tomorrow' is not true (which would be?) and multiply that by the probability that we would have the new evidence we have (that evidence being that the app predicts rain) even if the hypothesis is not true (that is, it is not going to rain). This latter probability is given in the question.

Now here's the tricky part: in order to get our denominator we must take the product just above and ADD it to the answer we got for the numerator. This sum then makes up the denominator. Divide and enjoy.

This is a classic situation where the final answer is very different from most people's first intuition. This is because 30 percent is a really high rate for false positives, and 292 days of no rain gives a lot of opportunities for those false positives to show up. So, true positives inevitably take up a smaller fraction of the OVERALL probability space. So this gives us a lower overall probability. How low? Let's put it this way: if you bought this app for free, you paid too much for it.:-)
 
  • #4
zzmanzz said:
Hi,

I'm not sure whether my understanding of this question is correct:

An app predicts rain tomorrow. Recently, it has rained only 73 days each year. When it actually rains, the app correctly forecasts rain 70% of the time. When it does not rain, it incorrectly forecasts rain 30% of the time. What is the probability that it will rain tomorrow?

Hint : P(H|D) = P(H) * P (D|H) / P(D)

What I'm mainly confused about is the wording of the question. But here is my attempt:

I set:
H = rain,
D = app predicts rain

then solve for P(D)?

P(H|D) = .3
P(D|H) = .7
P(H) = .2
P(D) = predicts rain (rain tom)
P(D) = (.25 * .7 ) / .3
P(D) = .58

The probability that it will rain tomorrow is .58?

Thanks

You were NOT told that ##P(H | D) = 0.3##; you were told that ##P(D | \bar{H}) = 0.3##, where ##\bar{H}## is the complement of ##H##, so ##\bar{H}=## {no rain}.
 
  • #5
Thanks so much for your replies and yes, this is a homework question -- but it is not graded. Not sure if that makes a difference.

So please roar with me while I try again:

A = it will rain tom
B = app predicts rain

prior probability it will rain tomorrow: P(A) = 1/5
prior probability it will not rain tomorrow. P(A') = 4/5
probability it will rain given app predicts rain : P(A|B) = 7/10
*probability it will not rain given app predicts rain: P(A'|B) = 3/10
*(i think this is the part that threw me off because it says it "incorrectly" forecasts rain, which actually means it will not rain 30% of the time the app predicts rain)

Calculations:

[tex] \frac{P(A) * P(A|B) } { P(A')* P(A'|B) + P(A) * P(A|B) } [/tex]

1/5 * 7/10 / ( 4/5 * 3/10 + 1/5 * 7/10 ) = .37
Thanks!
 
  • #6
zzmanzz said:
Thanks so much for your replies and yes, this is a homework question -- but it is not graded. Not sure if that makes a difference.

So please roar with me while I try again:

A = it will rain tom
B = app predicts rain

prior probability it will rain tomorrow: P(A) = 1/5
prior probability it will not rain tomorrow. P(A') = 4/5
probability it will rain given app predicts rain : P(A|B) = 7/10
*probability it will not rain given app predicts rain: P(A'|B) = 3/10
*(i think this is the part that threw me off because it says it "incorrectly" forecasts rain, which actually means it will not rain 30% of the time the app predicts rain)

Calculations:

[tex] \frac{P(A) * P(A|B) } { P(A')* P(A'|B) + P(A) * P(A|B) } [/tex]

1/5 * 7/10 / ( 4/5 * 3/10 + 1/5 * 7/10 ) = .37
Thanks!

What are you attempting to calculate? It does not look like anything I have ever seen! The denominator looks particularly weird, but the numerator also does not make much sense.

By the way: have you stated the question accurately? If so, it appears to be a "trick" question; it tells you that rain occurs on 73 days in a year, then it asks you for the probability of rain tomorrow. That is just 73/365, and all the material about predictions and conditional probabilities, etc., is irrelevant.
 
  • #7
zzmanzz said:
Thanks so much for your replies and yes, this is a homework question -- but it is not graded. Not sure if that makes a difference.

So please roar with me while I try again:

A = it will rain tom
B = app predicts rain

prior probability it will rain tomorrow: P(A) = 1/5
prior probability it will not rain tomorrow. P(A') = 4/5
probability it will rain given app predicts rain : P(A|B) = 7/10
*probability it will not rain given app predicts rain: P(A'|B) = 3/10
*(i think this is the part that threw me off because it says it "incorrectly" forecasts rain, which actually means it will not rain 30% of the time the app predicts rain)

Calculations:

[tex] \frac{P(A) * P(A|B) } { P(A')* P(A'|B) + P(A) * P(A|B) } [/tex]

1/5 * 7/10 / ( 4/5 * 3/10 + 1/5 * 7/10 ) = .37
Thanks!

I'll sign off on the numeric result, though not the labeling. I.e. your numerator should say ##P(A)P(B\vert A)## i.e. your likelihood function that your are incorporating is the probability the app predicts rain given that it will rain tomorrow... the whole point of the problem is to solve for ##P(A\vert B)##, so I am a bit worried that your interpretation / framing of the problem is off.
 
  • #8
Zzmanzz, congratulations, you got it!

Sorry, Ray Vickson, but you are fantastically wrong. Please don't be one of those people who gets huffy and defensive when someone tells them they are wrong I can demonstrate why you are wrong, if you have the patience.I will be gentle.

"By the way: have you stated the question accurately? If so, it appears to be a "trick" question; it tells you that rain occurs on 73 days in a year, then it asks you for the probability of rain tomorrow. That is just 73/365, and all the material about predictions and conditional probabilities, etc., is irrelevant."

No, it is not a trick question. Also, all the material about predictions and conditional probabilities is not only not irrelevant, it is indispensable. The whole notion of p-values as a statistical measure of cause and effect in all of the sciences that use p-valuest is currently under attack, and rightly so, for this very reason: we have been ignoring prior probability, and ignoring the entire probability space in which an event occurs. So, let us reason thusly:

Imagine you run this app every day for a year. We all need to accept that during this year, it will rain precisely 73 days, no more, no less. (Fiddling with that number is a different issue that we can go into later, if need be.)

Now, we know that 292 days will be rain free, but when we run the app, 30% of those trials will yield a false positive. That is 87.6 false positives!

Remember that all we want to know in this analysis is how likely it is for a positive result from our app to be actually true in reality. So, we need to know the rate of true positives in any given year, as a proportion of ALL POSSIBLE POSITIVES RESULTS which is to say all the likely true positives plus all the likely false positives.

That is the bottom half of the equation which you find weird. But, there is nothing odd about defining the entire probability space before calculating the proportion of that space that is of interest to us.

So, we need to calculate the number of positive results for the year when there are 73 days of actual rain, but our app only correctly predicts this 70% of the time. That is 51.1 days when it will predict rain and then it actually rains. How reliable is this prediction? Not 70%. Because the probability space is defined by ALL POSITIVE RESULTS, some fraction (large or small) of which could be FALSE POSITIVES. So, the overall probability is all true positives, as a portion of (fraction of) all positives both true and false.

Then, it becomes easy. We take the probable number of true positives (51.1) and divide it by the entire probability space for positive results (51.1 plus 87.6) Because there are more false positives than true positives, the probability that the app is correct is less than 50%, in this case, about 37 percent, as Zzmanzz concluded. This is the correct result, and there is no better way to reach it.

You should study Bayesian reasoning. It is counter-intuitive at first, but once you get it, it will change your life. It is nothing less than the key to understanding truth.
 
Last edited:
  • #9
OmneBonum said:
Zzmanzz, congratulations, you got it!

Sorry, Ray Vickson, but you are fantastically wrong. Please don't be one of those people who gets huffy and defensive when someone tells them they are wrong I can demonstrate why you are wrong, if you have the patience.I will be gentle.

"By the way: have you stated the question accurately? If so, it appears to be a "trick" question; it tells you that rain occurs on 73 days in a year, then it asks you for the probability of rain tomorrow. That is just 73/365, and all the material about predictions and conditional probabilities, etc., is irrelevant."

No, it is not a trick question. Also, all the material about predictions and conditional probabilities is not only not irrelevant, it is indispensable. The whole notion of p-values as a statistical measure of cause and effect in all of the sciences that use p-valuest is currently under attack, and rightly so, for this very reason: we have been ignoring prior probability, and ignoring the entire probability space in which an event occurs. So, let us reason thusly:

Imagine you run this app every day for a year. We all need to accept that during this year, it will rain precisely 73 days, no more, no less. (Fiddling with that number is a different issue that we can go into later, if need be.)

Now, we know that 292 days will be rain free, but when we run the app, 30% of those trials will yield a false positive. That is 87.6 false positives!

Remember that all we want to know in this analysis is how likely it is for a positive result from our app to be actually true in reality. So, we need to know the rate of true positives in any given year, as a proportion of ALL POSSIBLE POSITIVES RESULTS which is to say all the likely true positives plus all the likely false positives.

That is the bottom half of the equation which you find weird. But, there is nothing odd about defining the entire probability space before calculating the proportion of that space that is of interest to us.

So, we need to calculate the number of positive results for the year when there are 73 days of actual rain, but our app only correctly predicts this 70% of the time. That is 51.1 days when it will predict rain and then it actually rains. How reliable is this prediction? Not 70%. Because the probability space is defined by ALL POSITIVE RESULTS, some fraction (large or small) of which could be FALSE POSITIVES. So, the overall probability is all true positives, as a portion of (fraction of) all positives both true and false.

Then, it becomes easy. We take the probable number of true positives (51.1) and divide it by the entire probability space for positive results (51.1 plus 87.6) Because there are more false positives than true positives, the probability that the app is correct is less than 50%, in this case, about 37 percent, as Zzmanzz concluded. This is the correct result, and there is no better way to reach it.

You should study Bayesian reasoning. It is counter-intuitive at first, but once you get it, it will change your life. It is nothing less than the key to understanding truth.

I taught this material for over 30 years in graduate and undergraduate operations research programs in a respected engineering school, so I do know a thing or two about Bayesian methods. The OP did correct arithmetic (while computing something that he never identified) but his formulas are wrong. Yes, wrong.
He wrote
$$ \frac{P(A) * P(A|B) } { P(A')* P(A'|B) + P(A) * P(A|B) }$$
Since his formula already contains ##P(A|B)## as an input, I assume he is not trying to calculate that again, so I assume he wants to calculate ##P(B|A)##. If so, he should compute
$$ P(B|A) = \frac{P(A|B) P(B)}{P(A|B)P(B) + P(A|B') P(B')}$$
You really cannot see the difference?

Of course, it is possible that the OP writes ##P(A|B)## when everybody else in the world writes ##P(B|A)##. That would make his arithmetic match his algebra.

I think it is important for the OP to write correct formulas in standard notation when he does correct calculations; otherwise, somebody marking his work could give him a low mark when it might not be warranted. If he writes incorrect formulas (or uses a non-standard notation without explanation) the marker would not know whether he (the OP) really understands the material. Just getting the correct numerical results are not enough, although, of course, that is important as well.

By the way: I agree that if the question really was to compute P(predict rain) and/or P(rain|predict rain) then, indeed, the conditional probabilities are needed and are crucial. My remarks about a "trick question" stem from his statement in Post #1: "What is the probability that it will rain tomorrow?" I just copied and pasted that from his first message. It did NOT ask "what is the probability that the app predicts rain tomorrow" or "what is the probability it will rain tomorrow if the app predicts rain". Those would be "non-trick" questions. Of course, the most probable scenario is the the OP did not state the problem correctly, and that is why I asked him if that was the case.
 
Last edited:
  • #10
Ray, sorry for the delay. I haven't had time to give your reply the attention it deserves yet, but I will. Apparently I misinterpreted what you were saying, it sounded to me like you were dismissing Bayesian reasoning and or conditional probabilities altogether! Which clearly, I now see, you were not. I blame the scotch. And, perhaps, the ambiguity of your wording. But mostly the scotch. :-)
 

1. What is Bayes' Rule and how is it used to calculate the probability of rain tomorrow?

Bayes' Rule, also known as Bayes' Theorem, is a mathematical formula that helps us update our beliefs about the likelihood of an event occurring based on new evidence. In the context of predicting rain tomorrow, Bayes' Rule allows us to combine prior knowledge (such as historical data on weather patterns) with new information (such as current weather conditions) to calculate the probability of rain tomorrow.

2. What are the key components of Bayes' Rule and how do they relate to predicting the probability of rain tomorrow?

The key components of Bayes' Rule are the prior probability, the likelihood, and the posterior probability. The prior probability is our initial belief about the likelihood of an event (in this case, rain tomorrow) based on past data. The likelihood is the probability of observing the new evidence (such as current weather conditions) if the event occurs. The posterior probability is the updated probability of the event occurring after taking into account the new evidence.

3. Can Bayes' Rule be applied to any type of prediction, or is it specifically used for predicting the probability of rain tomorrow?

Bayes' Rule can be applied to any type of prediction that involves updating our beliefs based on new evidence. It is commonly used in fields such as statistics, machine learning, and artificial intelligence to make predictions and decisions based on uncertain or incomplete information.

4. How accurate is Bayes' Rule in predicting the probability of rain tomorrow?

The accuracy of Bayes' Rule in predicting the probability of rain tomorrow depends on the quality of the data and assumptions used in the calculation. If the prior probability and likelihood are based on reliable data and assumptions, then the posterior probability can be a good estimate of the actual probability. However, if the data is biased or the assumptions are incorrect, the accuracy of the prediction may be lower.

5. Are there any limitations to using Bayes' Rule for predicting the probability of rain tomorrow?

One limitation of Bayes' Rule is that it assumes independence between the events being considered. In the case of predicting rain tomorrow, this means that the weather conditions today do not affect the weather tomorrow. However, in reality, weather patterns can be interconnected and influence each other, which may affect the accuracy of the prediction. Additionally, Bayes' Rule relies on accurate and reliable data, so any errors or biases in the data can also impact the accuracy of the prediction.

Similar threads

  • Precalculus Mathematics Homework Help
Replies
28
Views
8K
  • Calculus and Beyond Homework Help
Replies
6
Views
2K
  • Precalculus Mathematics Homework Help
Replies
11
Views
2K
  • Set Theory, Logic, Probability, Statistics
Replies
1
Views
695
  • Precalculus Mathematics Homework Help
Replies
22
Views
3K
  • Precalculus Mathematics Homework Help
Replies
12
Views
1K
  • Calculus and Beyond Homework Help
Replies
8
Views
7K
  • Set Theory, Logic, Probability, Statistics
Replies
17
Views
1K
  • Precalculus Mathematics Homework Help
Replies
4
Views
794
  • Set Theory, Logic, Probability, Statistics
Replies
5
Views
1K
Back
Top