Conditional Probability Explanation

In Slide 43 of Intro to Probability, we saw the following equation for calculating a conditional probability using Bayes’ Theorem:

\[ P(R=1 \mid W=1, S=1)=\frac{P(W=1 \mid R=1, S=1) P(R=1)}{P(W=1 \mid S=1)} \]

This equation can be a bit confusing at first glance, so let’s break it down step by step.

First off, we know three things, by the definition of conditional probability:

\[ P(R=1 \mid W=1,S=1) = \frac{P(R=1,W=1,S=1)}{P(W=1,S=1)} \]

That gets us almost where we need, but we need to figure out both the numerator and denominator in terms of conditional probabilities. What does the numerator equal in terms of conditional probability (only using the definition of conditional probability). I’m “pulling out” \(W\) here so that it looks as similar as possible to the expression above:

\[ P(R=1,W=1,S=1)=P(W=1 \mid R=1,S=1)P(R=1,S=1) \]

What does the denominator equal:

\[ P(W=1, S=1) = P(W=1 | S=1)P(S=1) \]

Okay… let’s plug that in:

\[ P(R=1 \mid W=1,S=1)=\frac{P(W=1\mid R=1,S=1)P(R=1,S=1)}{P(W=1\mid S=1)P(S=1)} \]

Almost there…. what does \(P(R=1,S=1)\) equal?

\[ P(R=1,S=1) = P(R=1|S=1)P(S=1) \]

Let’s plug that in too:

\[ P(R=1 \mid W=1,S=1)=\frac{P(W=1\mid R=1,S=1)P(R=1|S=1)P(S=1)}{P(W=1\mid S=1)P(S=1)} \]

Okay, the \(P(S=1)\) cancel out and we’re left with:

\[ P(R=1 \mid W=1,S=1)=\frac{P(W=1\mid R=1,S=1)P(R=1|S=1)}{P(W=1\mid S=1)} \]

That last part that doesn’t look quite right is \(P(R=1\mid S=1)\) . To answer this question, look at the prompt of the question:

Let’s say that the sprinkler is on a timer, so it doesn’t “know” if it has rained or not. (Slide 39)

What does this imply about the relationship between whether it rains and whether the sprinkler turned on? That the two are independent! So:

\[ P(R=1 \mid S=1) = P(R=1) \]

With this, you now have the equation from above:

\[ P(R=1 \mid W=1, S=1)=\frac{P(W=1 \mid R=1, S=1) P(R=1)}{P(W=1 \mid S=1)} \]

Back to top