Probability of disease given multiple samples of a single test

Someone either has disease X or they are healthy. A test is used which is 90% sensitive and 80% specific (81.81% precise). The test is performed 8 times with different samples from the same person.

1) What is the rule to calculate the probability that someone has the disease given that 5 out of 8 tests came back positive?

2) More generally: that N out of M samples were positive.

3) Is there a way of calculating the confidence?

Kind regards

• Hello jamesj629, welcome to the site. If this is a homework question please add the self-study tag. – Andy Oct 16 '14 at 11:26
• Thanks Andy - its not homework, just learning. – jamesj629 Oct 16 '14 at 11:32

You need the disease prevalence in order to calculate this probability.

Let $T$ be the indicator variable with $T=1$ denoting the event of a positive test. Similarly let $D$ be the indicator of the disease. You have $P(T=1|D=1)=0.9$ and $P(T=0|D=0)=0.8$. Define $A$ to be the event of N positive result from M tests. Then

$$P(A|D=1)=\binom{M}{N}0.9^N 0.1^{M-N}$$

What you want is $P(D=1|A)$. Using Bayes' rule $$P(D=1|A)= \frac{P(A|D=1)P(D=1)}{P(A)}=\frac{P(A|D=1)P(D=1)}{P(A|D=1)P(D=1) +P(A|D=0)P(D=0)}$$

• I take it P(D=1) on its own is disease prevalence? and P(D=0)=1-P(D=1) ? – jamesj629 Oct 16 '14 at 12:59
• The prevalence is (say) 1 in 100000, but for people taking the test, about 90% actually have the disease, because the test is only done on those presenting with suspect symptoms - does this invalidate the probability? – jamesj629 Oct 16 '14 at 13:05
• @jamesj629 It will increase the probability. If you let $S$ be the indicator of symptom onset. With what you described in the comment, now you are calculating $P(D=1|A,S=1)$ instead of $P(D=1|A)$. You numerator becomes $P(A|D=1,S=1)P(D=1|S=1)=P(A|D=1)P(D=1|S=1)$ if test result is independent of symptom. Note $P(D=1|S=1) > P(D=1)$ if disease is positively dependent with symptom. – Peter Oct 16 '14 at 21:19

You can use the information to calculate the base rate fo the disease:

accuracy: $A$

sensitivity: $s^+$

specificity: $s^-$

base rate: $p$

positive test result: $T^+$

disease: $D$

$A=p\cdot s^++(1-p)\cdot s^-$

$0.8181= p\cdot0.9+ (1-p)\cdot 0.8$

$0.0181= 0.1p$

$p=.181$

For one test positive out of one:

using Bayes' theorem: $P(D|T^+)=\frac{p \cdot s^+}{p \cdot s^+ + (1-p) \cdot (1-s^-)}$

$P(D|T^+)=\frac{.181 \cdot .9}{.181 \cdot .9 + (1-.181) \cdot (1-0.8)}$

$P(D|T^+)=\frac{.1629}{.1629 + .1638}=.4986$

now for k tests out of m: as in Peter's answer, the probabilities are now drawn from a binomial to generate likelihoods:

$L^+$~$B(n,s^+)$ and $L^-$~$B(n,s^-)$ with inverted number of successes for the second. You can probably calculate confidence intervals based on the knwon properties (variance) of bionomial distributions...