# Bayes theorem calculation not giving proper result when calculating the positive predictive value

I have following data from experiment to assess accuracy of test in patients with and without disease: Where T stands for test and D stands for disease.

I want to get probability of (D+|T+) with prevalence of disease at 0.9 (90%)

I used formula:

P(D+|T+) = P(T+|D+) * P(D+) / P(T+)

P(T+|D+) = 80/100 = 0.8    (from table)
P(T+) = 90/200 = 0.45      (from table)
P(D+) = 0.9    (given for actual population)

Hence:
P(D+|T+) = 0.8 * 0.9 / 0.45 = 1.6


However, how can probability be > 1

Where is the error in my calculations ?

• But D+ is 50% in the table, not 90%. – COOLSerdash Jun 9 '20 at 11:00
• It is 50% in experiment (table) but I want to apply these results to another (real) population where D+ is 90% – rnso Jun 9 '20 at 11:03

$$P(D+|T+)$$ is commonly called the positive predictive value (PPV). A general formula for the PPV is:

$$\mathrm{PPV} = \frac{\text{sensitivity} \times \text{prevalence}}{\text{sensitivity} \times \text{prevalence} + (1-\text{specificity})\times (1-\text{prevalence})}$$

The sensitivity based on your table is $$P(T+|D+)=80/100=0.8$$ and the specificity is $$P(T-|D-)=90/100=0.9$$. Assuming a prevalence of $$\color{red}{0.9}$$, the PPV is (values of the prevalence are colored in red) $$\mathrm{PPV}=\frac{0.8\times \color{red}{0.9}}{0.8\times \color{red}{0.9} + (1 - 0.9)\times (1-\color{red}{0.9})} = 0.986$$

You could also create a table with the same sensitivity and specificity as in the table above but with a prevalence of $$0.9$$: If you apply Bayes' theorem on this table, you'll get the same result: $$P(D+|T+)=\frac{0.8\times 0.9}{0.73} = 0.986$$

Here is a graph showing the PPV for different prevalences: • Ok. Is there some formula to get PPV using values in my table and Prevalence of 0.9? – rnso Jun 9 '20 at 11:20
• @mso Yes: Use the first formulas and put in the sensitivity and specificity from your table and a prevalence of 0.9, as shown. – COOLSerdash Jun 9 '20 at 11:22