# Sensitivity/Specificity

#### kelly g

##### New Member
Here is my question:

The sensitivity of a screening test is 0.95 and it's specificity is 0.85. The rate of the disease for which the test is used is 0.002. What is the positive predictive value of the test?

I assume the word rate means prevalence? I took .95 minus .85/.95 to get an answer of .055

Does anyone know if this is correct?

#### SiBorg

##### New Member
PPV = (sens x prior) / [(sens x prior) + (1 - spec) x (1 - prior)]

sens = sensitivity; spec = specificity; prior = prior probability

= 0.95 x 0.002 / [(0.95 x 0.002) + (1 - 0.85) x (1 - 0.002)]

= 0.0019 / [0.0019 + (0.15 x 0.998)]

= 0.0019 / [0.0019 + 0.1497]

= 0.0019 / 0.1516

= 0.0125

= 1.25%

#### Dason

Note that PPV is just the probability you really do have the disease given that the test was positive. So once again this is a Bayes theorem question.

#### SiBorg

##### New Member
Note that PPV is just the probability you really do have the disease given that the test was positive. So once again this is a Bayes theorem question.
Yes, this question can be more robustly answered using the reasoning in Dason's post to your other question about Bayes theorem. The PPV formula quoted is derived from Bayes theorem and to understand it you would need to use first principles as described in Dason's post.

#### kelly g

##### New Member
Oh boy! Ok when I get home I better see if I can give this a shot! Thank you guys...

#### kelly g

##### New Member
In your equation that you typed out here (which is Bayes) you put 1 - 0.85 for the complement of A yet you use .95 for A...Im confused on this part....

#### Dason

Not quite. .95 was the sensitivity (If we let D+ be "has the disease" and T+ be "tests positive for the disease") then what this says is P(T+|D+) = .95.

.85 was the specificity which tells us that P(T-|D-) = .85. So P(T+|D-) = (1-.85).

#### kelly g

##### New Member
Ok Dason...I am looking at the actual formula for Bayes. I see that I need to have a number for A, BlA, the complement of A and the complement of BlA....or as you have stated issuing "D" and "T". I was using .95 for A and 0.002 for BlA and then .05 for the complement of A and 0.998 for the complement of BlA but then I have nowhere to put the .85

I am sorry...I know I am not grasping this at all!

To make sure...Bayes is:

P(A) x P(BlA) / P(A) x P(BlA) + P(complement A) x P(complement BlA)

#### kelly g

##### New Member
Here is one of the ten ways I have tried this...

.95 x .002 / (.95x.002) + (.15x.05) =
.202

But the second post said my answer should be .0125?

#### kelly g

##### New Member
Lol ok! I get the correct answer of 0.0125 if I use:

Sensitivity x prevalence/ (sensitivity x prevalence) + (1-specificity)(1-prevalence)

Should I be using this because I can't get the correct answer using Bayes....

#### Dason

You implied that

P(A|B) = P(A) x P(BlA) / (P(A) x P(BlA) + P(complement A) x P(complement BlA))

But that's not what Bayes theorem says. Using your notation

P(A|B) = P(A) x P(BlA) / (P(A) x P(BlA) + P(complement A) x P(B l complement A))

#### kelly g

##### New Member
Ya, what I did Dason was Google the formula for positive predictive value and used that which I noticed is what was done in the 2nd post of this thread. Is that answer correct?

I can't figure out where to put what numbers in the Bayes theorem because no matter where I put them I can't come up with 0.0125 and I'm assuming that's the answer I'm looking for...?

#### SiBorg

##### New Member
Sounds right to me. Ok - so let's try to put some actual numbers in here for you. Lets pretend that 100000 people took this test. Now we know that 10% are actually HIV positive.

So that means that 10000 people are HIV positive. We also know the sensitivity is .999 which is the proportion of those 10000 people that are going to get a positive test back. So 10000*.999 = 9990 people have a positive test AND are HIV positive. Which means that 10 people have a negative test AND are HIV positive. Do you see why that last sentence is true?

We can do something similar for those people that are HIV negative. There are 90000 HIV negative people out of the 100000 (do you see why this is?) and we have a specificity of .9999. Specificity is the proportion of those that are actually HIV negative that get a negative test. So .9999*90000 = 89991 people are HIV negative AND have a negative test. Can you work out how to get how many people are HIV negative and have a positive test?

So from this we should be able to make a table

[Dason's table here]

Can you see how to answer the original question using this table?

Just so you know I'm going to head to bed so I won't be answer any more questions until morning. Good luck!
Right. I'm no Bayesian expert so using Dason's original posting let's try and work this through.

PPV = number who test positive who are truly positive. Let's say 10000 people took the test. We know that rate of disease is 0.002 = 0.2%. Therefore 10000 x 0.002 = 20 have the disease. We know that the sensitivity is 0.95 which is proportion of those 20 that are going to get a positive test back. So 20 x 0.95 = 19 people have a positive test AND the disease. And 20 - 19 = 1 person has a negative test but has the disease.

We can do the same for disease negative. There are 9980 disease negative people. Specificity is 0.85 (i.e proportion negative that get a negative result). So 9980 x 0.85 = 8,483 disease negative with a negative result. Negative and positive test are 9980 - 8483 = 1,497.

So we can make a table..... (actually I can't make a table using this but here's my attempt) (I prettied it up for you. I hope you don't mind - Dason)

$$\begin{tabular}{|l|rr|} \hline &Have disease &Don't have disease \\ \hline +ve & 19 & 1497\\ -ve & 1 &8483\\ \hline \end{tabular}$$

So.....

total number who test positive = 19 + 1497 = 1516

Proportion of those who test positive who have the disease (PPV) = 19 / 1516 = 0.0125 = 1.25% [QED]

You can see now where the last lines of the second post come from 0.0019 / (0.0019 + 0.1497)

I hope that this is clearer now...... it certainly is for me!

Thanks to Dason (and kelly g for posting the question) as I have learned something today.

Last edited by a moderator:

#### Outlier

##### TS Contributor

With a surgery/no surgery question the 'game theory' opponent of the doctor is 'nature' and the patient's genetic (dis)advantages and lifestyle.
I'd hope these MDs would at least use software to give them the odds and the best decision to make. They can always ignore what the software says but having this info is a dominant strategy.

#### Dason

I agree. But we probably don't want to throw away the doctor's opinion completely. We could merge all of the information together using a Bayesian analysis.

#### SiBorg

##### New Member
True that many doctors don't understand the maths (even though it's not actually very hard maths) but what they/we do every day (or should do) is to assess the patient first and try to come to a differential diagnosis of what could be wrong with them.

By doing this, we increase the prior probability that they have the condition we are testing for before we test for it.

So Bayes tells us that a good doctor is worth his or her salt and shows mathematically why this is so.

On the other hand, screening for diseases in the general population is fraught with problems because of low prior probabilities. Most leading physicians that determine whether a disease is or is not worth screening for are quite familiar with Bayes' theorem which is why there are so few national screening programmes.

#### kelly g

##### New Member
SiBorg77,

That really helped working through the question in basic steps thank you. That is the "intuitive Bayes" with the table which I understand a little better than the general Bayes theorem. I would love if someone could show me how to plug those numbers into the general Bayes formula as Dason advised that I should get a handle on both ways of doing this...

#### kelly g

##### New Member
Ok I think I finally did it!!

(.95)(.002)/[(.95)(.002)]+[(.15)(.998)]=.0125 using General Bayes Theorem right Dason??

Now could you explain to me how the spot where I put the .15 is supposed to be the complement of A (A is .95) why is it 1-.85 and why the spot where I put the .998 is supposed to be B given the complement of A why is it 1-.002?

This is the problem I am having...rationalizing why the numbers go where they do...

I appreciate all the help everyone has given getting me to the correct answer; now I would like to gain some understanding so my next question I don't have to bother everyone again....

#### Dason

I think the table helps build the intuition but you should still be able to do the symbol manipulations and use the given probabilities directly to find an answer too. I'll let H+ be the event that a person actually has the disease, H- be the event that they don't. Let T+ be the event that they test positive for the disease and T- be the event that they test negative.

So putting the information in the problem into probability statements we have that .002 of the people of interest have the disease. The gives us P(H+) = .002 so correspondingly P(H-) = .998

Our sensitivity is .95 which is the probability of a positive test given that the person truly has the disease. This implies P(T+ | H+) = .95

Our specificity is .85 which is the probability of a negative test given that the person doesn't have the disease. This implies P(T- | H-) = .85. Note that P(T-|H-) + P(T+|H-) = 1 (Do you see why this should be true) which implies that P(T-|H-) = 1-.85 = .15

To summarize:
P(H+) = .002
P(H-) = .998
P(T+|H+) = .95
P(T-|H+) = .05
P(T+|H-) = .15
P(T-|H-) = .85

$$P(H+|T+) = \frac{P(T+|H+)P(H+)}{P(T+|H+)P(H+) + P(T+|H-)P(H-)}$$

Plugging in the numbers should give the answer. Try to figure out where you were making your mistake before. Hint: You were confusing T and H in the denominator.

Note: Yes I just copied my post from the previous thread and updated the numbers.

#### kelly g

##### New Member
Ok but plugging in the numbers does not give me .0125 and I thought that was the answer we were trying to come too....