Main content

## Conditional probability and independence

# Conditional probability tree diagram example

AP.STATS:

VAR‑4 (EU)

, VAR‑4.D (LO)

, VAR‑4.D.1 (EK)

, VAR‑4.D.2 (EK)

CCSS.Math: , , , ## Video transcript

- [Instructor] A company
screens job applicants for illegal drug use at a certain stage in their hiring process. The specific test they use
has a false positive rate of two percent and a false
negative rate of one percent. Suppose that five percent
of all their applicants are actually using illegal drugs and we randomly select an applicant. Giving the applicant test positive, what is the probability that
they are actually on drugs? So let's work through this together. So first let's make sure we understand what they're telling us. So there is this drug test
for the job applicants and then the test has a false
positive rate of two percent. What does that mean? That means that in two
percent of the cases, when it should have read negative, that the person didn't do the drugs, it actually read positive. It is a false positive. It should have read negative
but it read positive. Another way to think about it. If someone did not do drugs
and you take this test, there's a two percent chance saying that you did do the illegal drugs. They also say that there
is a false negative rate of one percent. What does that mean? That means that one percent of the time if someone did actually
take the illegal drugs, it'll say that they didn't. It is falsely giving a negative result when it should have given a positive one. And then they say that five
percent of all their applicants are actually using illegal drugs. So there is several ways
that we can think about it. One of the easiest way
to conceptualize is just, let's just make up a large
number of applicants, and I'll use a number where
it's fairly straightforward to do the mathematics. So let's say that we start
of with 10,000 applicants. I will both talk in absolute numbers, and I just made this number up. It could have been 1,000,
it could have been 100,000, but I like this number 'cause
it's easy to do the math better than saying 9,785. This is also going to be
100% of the applicants. Now they give us some
crucial information here. They tell us that five percent
of all their applicants are actually using illegal drugs. So we can immediately
break this 10,000 group into the ones that are doing the drugs and the ones that are not. So five percent are actually on the drugs, 95% are not on the drugs. So what's five percent of 10,000? So that would be 500. So 500 on drugs, on drugs. Once again, this is five percent
of our original population. And then how many are not on drugs? Well 9,500 not on drugs. And once again, this is 95%
of our group of applicants. So now let's administer the test. So what is going to
happen when we administer the test to the people who are on drugs? Well the test, ideally,
would give a positive result. It would say positive for all of them, but we know that it's not a perfect test. It's going to give
negative for some of them. It will falsely give a negative
result for some of them, and we know that because it
has a false negative rate of one percent. Of these 500, 99% is going
to get the correct result in that they're going to test positive. So what is 99% of 500? Well let's see, that would be 495. 495 are going to test positive. I will just use a
positive right over there. And then we're going to have one percent, which is five, are going to test negative. They are going to falsely test negative. This is the false negative rate. If we say, what percent of
our original applicant pool is on drugs and tests positive, well 495 over 10,000. This is 4.95%. What percent is of the
original applicant pool that is on drugs but
tests negative for drugs? The test says that hey
they're not doing drugs. Well this is gonna be five out of 10,000. Which is 0.05%. Another way that you could
get these percentages. If you take five percent
and multiply by one percent, you're goin to get 0.05%. 500ths of a percent. If you take five percent
and multiply by 99%, you're going to get 4.95%. Now let's keep going. Now let's go to the folks
who aren't taking the drugs. And this is where the false positive rate is going to come into effect. So we have a false positive
rate of two percent. So two percent are going to test positive. What's two percent of 9,500? It's 190 would test positive even though they're not on drugs. This is the false positive rate. So they are testing positive, and then the other 98% will
correctly come out negative. The other 98%, so 9,500 minus 190, that's gonna be 9,310 will
correctly test negative. Now what percent of the
original applicant pool is this? Well 190 is 1.9%, and we could calculate
it by 190 over 10,000 or you could just say two
percent of 95% is 1.9%. Once again, multiply
the path along the tree. What percent is 9.310? Well that is going to be 93.10%. You could say this is 9,310 over 10,000 or you can multiply by the path on our probability tree here. 95% times 98% gets us to 93.10%. But now I think we are ready
to answer the question. Given that the applicant tests positive, what is the probability that
they are actually on drugs? So let's look at the first part. Given the applicant tests positive. So which applicants
actually tested positive? You have these 495 here tested positive, correctly tested positive, and then you have these
190 right over here incorrectly tested positive, but they did test positive. So how many tested positive? Well we have 495 plus 190 tested positive. That's the total number
that tested positive, and then which of them
were actually on the drugs? Well of the ones that tested positive, 495 were actually on the drugs. We have 495 divided by 495 plus 190 is equal to 0.7226. So we could say approximately 72%. Approximately 72%. Now this is really interesting. Given the applicant tests positive, what is the probability that
they are actually on drugs? When you look at these false positive and false negative rates,
they seem quite low, but now when you actually
did the calculation, the probability that someone's
actually on drugs is, it's high, but it's not that high. It's not like if someone
were to test positive that you'd say oh they are
definitely taking the drugs. And you could also get to this result just by using the percentages. For example, you could think in terms of what percentage of the original applicants end up testing positive? Well that's 4.95% plus 1.9%. 4.95, we'll just do it in
terms of percent, plus 1.9%, and of them, what percentage
were actually on the drugs? Well that was the 4.95%. And notice this would give
you the exact same result. Now there's an interesting takeaway here. Because this is saying, of the people that test positive, 72% are actually on the drugs. You could think about
it the other way around. Of the people who test positive. 495 plus 190, what
percentage aren't on drugs? Well that was 190, and this comes out to
be approximately 28%. 100% minus 72%. If we were in a court of law and let's say the prosecuting attorney, let's say I got tested positive for drugs and the prosecuting attorney says look, this test is very good. It only has a false
positive rate of two percent and Sal tested positive, he
is probably taking drugs. A jury who doesn't really
understand this well or go through the trouble
that we just did might say, oh yeah Sal probably took the drugs. But when we look at this, even if I test positive using this test, there's a 28% chance that
I'm not taking drugs. That I was just in this
false positive group, and the reason why this
number is a good bit larger than this number is because when we looked
at the original division between those who take
drugs and don't take drugs, most don't take the illegal drugs. Two percent of this larger group of the ones that don't take the drugs, well this is actually
a fairly large number relative to the percentage
that do take the drugs and test positive. So I will leave you there. This is fascinating not just
for this particular case, but you will see analysis
like this all the time when we're looking at
whether a certain medication is effective or a certain
procedure is effective. It's important to be
able to do this analysis.