Help with Bayesian question please

#1
Just got a question with Bayes problem, I always struggle to understand the actual question in Bayes problems so that could be why I'm stuck, but would really appreciate your help :)

It's about a diagnostic test,
specificity of 0.90 and sensitivity of 0.98. population prevalence is 1/10 000

Question is what is the prob. that a person who has got two consecutive positive results is ill?

and another one is support you want the prob. of a person being ill after one positive test result to be 0.80, keeping sensitivity and prevalence constant. What is the minimal level of specificity to guarantee that outcome?

Thanks guys!
 

hlsmith

Omega Contributor
#2
For the first I think you may just multiply the SEN times itself.

I thik you need to write out the second question verbatim, I am missing something.
 

rogojel

TS Contributor
#3
hi,
there is a rather easy way to calculate the numbers: imagine you test one million people. You have in total 100 with the illness, out of those 98 will be recognized. You also have a 10% false alarms so in total 100 098 positive cases oit of which 98 are real so the probability is 98/100098 of being actually ill after a first test.

Now imagine repeating the test with those who tested positive the first time - you have 100098 cases out of which 98 are real. Of thos 96 will be recognized by the test ( 98*0.98) and you will again have a 10% false alarms i.e. 10000. So your probability of being ill will be 96/10096.

As for the second question: again taking the case of one million you will get 98 real cases plus x false alarms. In order to get a probability of 0.8 of being a real case after one test you need to solve 98/(98+x) =0.8 for x and you get x= 245. so out of 1 million tests you are allowed to have 245 false alarms .

Regards
 

hlsmith

Omega Contributor
#4
rogojel, I like your style, but you are going to have to sell me on this one. I admit that I did not give it enough thought last night. What I meant to say was square PPV, so 90/19,998 - given your numbers. I will investigate this further, but I don't know that you need to assume a whole population took the test and adjust the pre-test probability for the second test. I say this just based on the presented wording. You would perhaps do that if a the test was applied to a whole, sample, but I may be wrong. Though if you adjusted the numbers based on 1 person, then I would imagine that there would not be a noticeable difference and you would get the same probability, thus square the PPV.
 

Dason

Ambassador to the humans
#7
Well I just ask because they should find out from their professor if they are supposed to assume that the readings are iid with the same specificity and sensitivity. In real life I wouldn't assume that consecutive draws are independent.
 

hlsmith

Omega Contributor
#8
I get what you are saying, but jamesuh36 needs us, and I love the number 36 - who doesn't.


I am assuming that the test are independent and the outcome of the first does not change the pretest probability of the second test. And the probability after the first test is 0.0045. So given this, I believe you would take 0.0045*0.0045.
 

hlsmith

Omega Contributor
#9
I am ranting, but you could take


pre-test odds * +LR = .0004 * 45 = 1.8% then multiply again by 45 to account for the second test and get: 81%


That approach would take into account prior 0.0004 and new prior 1.8%, AKA the results of the first test.
 

Dason

Ambassador to the humans
#10
I don't get .0045 as the answer and I don't believe you are correct in saying that you would just square the PPV.

What you would do is repeat the calculation but you would square the sensitivity and specificity and use those as the "new" sensitivity and specificity.
 

rogojel

TS Contributor
#11
hi hlsmith,
this is a way to do the bayes calculations in an easy way. You do not actually assume sampling any number, you just have to imagine a large enough population that your probability numbers come out as integers e.g. for a prevalence of 10^-4 imagining 10^6 samples is just handy because you get exactly 100 true cases, and so on. To me this way of calculating seems quite easy to follow and it should give the same probabilities as a rigorous Bayes-based calculation.

I have the method from the book Risk by Gerd Gigerenzer , he devised it as a way to enable doctors to use bayes calculation in practice.
 

Dason

Ambassador to the humans
#12
I like the method of using integers and thinking of them as cases to make it more concrete. But with that said I think your math got mixed up somewhere along the line - I'm getting different answers.
 

rogojel

TS Contributor
#13
hi Dason,
you are right, the numbers are slightly off.
if I test 1 000 000 cases, there are 100 true illnesses and 999 900 healthy cases. Out of those 99 990 wil be falsely identified as ill. So the probability of being ill if tested positively is 98/(99990+98) ...and so on. I forgot to deduct the true illnesses from the tested population. I hope it works now.

regards
 
#15
Hey guys, thanks for your help.
To answer some of the questions you guys had/talked about,

- it is a homework problem lol
- we do need to assume that it's independent
- i dont think ppv comes into this question just yet, or am I wrong on that one? because we haven't had a class on PPV yet

Cheers
 

hlsmith

Omega Contributor
#16
I still like the idea of the following,

Pretest Probability: 0.0004



+LR: 0.90 / 1 - 0.98 or 45


Post-Test Odds: 0.0004 * 45 or 0.018



New Pre-Test Probability: 0.018 / 1 + 0.018 or 0.018



New Post-Test Odds: 0.018 * 45 = 0.80



New Post-Test Probability: 0.80 / 1 + 0.80 or .44


I don't see how one person's test could change the SEN and SPEC of a serial diagnostic test. The test still has the same properties. But I am going to look into the answer later today.
 

hlsmith

Omega Contributor
#17
Cleaner version. However, I am getting ready to read a simulation study that better defines the issues of using the same test twice (or correlate tests). If tests are not correlated the following estimates should be equal to the true probability.


Pretest Probability: 0.0004


Pretest Odds: 0.0004 / (1 - 0.0004) or 0.0004


+LR: 0.90 / 1 - 0.98 or 45


Post-Test Odds also New Pre-Test Odds: 0.0004 * 45 or 0.018


New Pre-Test Probability (not used): 0.018 / 1 + 0.018 or 0.018


New Post-Test Odds: 0.018 * 45 = 0.80


New Post-Test Probability: 0.80 / 1 + 0.80 or 0.44
 

Dason

Ambassador to the humans
#18
I don't see how one person's test could change the SEN and SPEC of a serial diagnostic test. The test still has the same properties. But I am going to look into the answer later today.
It's not that they are changing the sensitivity or the specificity. It's that what you're looking at changes - you aren't just looking at the result of one test - it's two tests you're looking at.

If we let T+ represent "tested positive" and "D+" represent "has the disease" then we're interested in

\(P(D+ | T+, T+)\) - the probability that they have the disease given that they tested positive twice.

\(P(D+ | T+, T+) = \frac{P(T+, T+ | D+)P(D+)}{P(T+, T+ | D+)P(D+) + P(T+, T+ | D-)P(D-)} \)

Note that this isn't the same as just squaring \(\frac{P(T+ | D+)P(D+)}{P(T+ | D+)P(D+) + P(T+ | D-)P(D-)}\)

We can say that \(P(T+, T+ | D+) = P(T+|D+)^2\) (if we make the assumption that the outcome of these tests in a person are iid - but that doesn't translate mathematically into squaring the entire thing. So the sensitivity/specificity does not change - but the calculation we're doing changes and it turns out that the quantities we need for that calculation [P(T+, T+ | D+)] can be obtained by squaring the sensitivity and specificity.
 

hlsmith

Omega Contributor
#19
You have yet to post your calculated result. I am reading the simulation article right now.


Post-Test Probability is a function of the Pre-Test Probability and +LR. With the new Pre-Test Probability getting updated based on the first test.
 

Dason

Ambassador to the humans
#20
After a single positive test the probability of having the disease is 0.0009791384 (I believe you're saying this should be 0.0045 but I don't know where that is coming from)

After two positive test the probability of having the disease (assuming the tests are iid) is 0.009513583

I believe the result you are claiming is true has the probability of having the disease decrease as the number of positive tests increase which intuitively doesn't make much sense for the numbers we have.