I've tried searching for this problem online but could not find a solution, hopefully you can help me.
I have three random variables [r1,r2,r3], these three variables shows the probabilities of it raining on a specific day. These dependencies construct the following Bayesian network:
I have a dataset containing probabilities telling if it rains on a given day:
data set for probability of rain for given day
What I am trying to figure out is P(r1|r3) but I am completely lost.
I've tried applying Bayes formula which gives:
$$ P(r1|r3) = \frac {P(r3|r1)∗P(r1)} {P(r3)}$$
However, I am unsure how to account r2 into the equation, do I take in all the possibilities from r2 (that it rains and that it doesn't), and sum them together? This would give:
$$ P(r1|r3) = \frac {((0.226∗0.951∗0.951)+(0.226∗0.018∗0.951)∗0.226} {0.951}$$
Some help could be appreciated how to tackle this problem.
Thank you very much.


$$P(r_1|r_3) = \frac{P(r_3|r_1)P(r_1)}{P(r_3)}= \frac{P(r_1)}{P(r_3)}\sum_{r_2=\text{T,F}}P(r_3,r_2|r_1)= \frac{P(r_1)}{P(r_3)}\sum_{r_2=\text{T,F}}P(r_3|r_2)P(r_2|r_1).$$
Can you figure it out from here?