Source: Tables created by Katherine Williams
This is your tutorial on conditional probability. This time, we're going to look at how contingency tables can be used in combination with conditional probability. First off, conditional probability is used when one probability affects another probability, when the events are changing depending on what has happened, sorry, the probabilities are changing depending on what has happened.
So here, one way of saying the conditional probability is that you're looking for the probability event A happening, given that B has already occurred and given that you already know what the result from B was. So here, this is another way of saying that. P and then the A with the bar B, that's read as the probability of event A given that event B has already happened.
And then there's a formula that we can use to help us figure this out. It's a pretty simple formula. It's right here. The probability of A given that B is the same as the probability of A and B divided by the probability of B. Let's go through some examples.
In this first example, we want to know, what's the probability that you got a shake, yes, you had a shake, given that you said no to fries. So we need our formula here. So we have to know the probability of A and B divided by the probability of B. And I like to label my events A and B just to help me keep it straight.
So what's the probability of saying yes to shakes and no to fries. So I'm going to look at the two-way table here. And so the people who said yes to shakes are in this group here. And the people who said no to fries are this group here.
Now where those overlap, where they both are intersecting is the people who did both. So the people who said yes to shakes and no to fries are these 54 people right here. So this 54, and it's 54 out of our total, out of 708.
Now the next part of our formula, we need to know the probability of B. So what's the probability of B? What's the probability of saying no to fries? Well, again, all those people who said no to fries is this row right here. Whoops. Slid my table. So that's 423 out of 708.
When I simplify this fraction down, we get 54 out of 423. And that makes sense. So if you said, OK, I already said no to fries. So I'm in this row right here somewhere. How many of those people said yes to shakes? Well, 54 of those 423 people said yes to shakes. So that's our conditional probability.
Now in our next example, it's flipped around. We have the probability of saying no to fries, given that you said yes to shakes. So this is event B. And this is event A.
Now when we had our formula, it was A given that B. If we want to do the reverse, if we want to know the probability of B given that A, our formula is very similar. It's the probability of A and B divided by, this time, the probability of A. So the only thing that's changed is the denominator.
Now when we go here, that means I just need to change this bottom part here to P of A. So the probability of A and B, of saying no to fries and yes to shakes, so no to fries, yes to shakes, is still these 54 people. So 54/708. And then the probability of A, so the probability of saying yes to shakes, well, it's these people here, the 110 and the 54, which is a total of 164. So 164/708.
Now when this fraction simplifies down, it simplifies down to 54/164. And if we think about that, that makes sense. So we know people said yes to shakes. So we know that they're in this group here. Now how many of those 164 people said no it fries? 54 said no to fries of those 164, so 54 out of 164.
Here, the chart is filled in with relative frequencies. So point 0.07 or 7% of the people we looked at had a low tuition and ended up with a low salary. And this chart as a whole is looking at the salary gains for MBA graduates.
So now let's look at the probabilities. Let's look at the probability of having a low tuition, given that you have a high salary. So of the people with high salaries, how many of them didn't pay very much for their MBA?
Now we need to use our formula. So we need to find the probability of A and B. So what's the probability of giving a low tuition and having a high salary? So low tuition and high salary, this group here, 0.02. Now what's the probability of event B, that denominator for our formula? So the probability of having a high salary is this group here, the probability of everyone with a high salary, 0.26.
Now it's going to be most useful to actually do the division out. So I'm going to pop up my calculator. And we're going to say point-- oops. Clear it out. 0.02 divided by 0.26 gets us 0.076. So that's around-- sorry. 0.0769. So we can round that to 0.077. So that equals 0.077. And that is the same as 7.7%. So of the people who went on to earn a high salary, 7.7% of them came from a low tuition MBA program.
Now let's look at the other things. Let's look at what the probability of having a high tuition is, given that you're someone with a low salary. So again, we need the probability of A and B. I'm going to erase these marks, so I don't get confused.
So what's the probability of having paid a high tuition, given that you have a low salary? So P of A and B, probability of high tuition and low salary. So high tuition and low salary is, again, 0.07.
And then this time, we're dividing by the probability of B. So dividing by the probability of having a low salary. So dividing by this 0.24 right here. And we're going to divide that out 0.07 divided by 0.24 is 0.2916, so 0.292, which is the same as 29.2%. So people with a low salary, once you know they have a low salary, 29.2% of them came from a high tuition program.
So when you're calculating conditional probabilities, it can help to give you some more specific information about your data set and to help you to draw some other conclusions. This has been your tutorial on conditional probabilities, in particular, from contingency tables.