Why Posterior is the New Prior?

So far, we have been accepting the notion that the posterior probability from the Bayes’ equation becomes the prior when you repeat a test or collect more data. Today, we verify that argument. What is the chance of having the disease if two independent tests turned positive? Let’s write down the equation.

\\ P(D|++) = \frac{P(++|D)*P(D)}{P(++|D)*P(D) + P(++|nD)*(1-P(D))}

Since the two tests are independent, and the marginal probability of the two positive tests is similar, we can write P(++|D) as the joint probability, P(+|D)*P(+|D). The same is true for the false positives, P(++|nD). Substituting all of them, we get

\\ P(D|++) = \frac{P(+|D)*P(+|D)*P(D)}{P(+|D)*P(+|D)*P(D) + P(+|nD)*P(+|nD)*(1-P(D))}

P(+|D) is your sensitivity, P(+|nD) is 1 – specificity and P(D) is the assumed prior.

Now, we will go to the original proposition of the posterior becoming the next prior. The probability of having the disease given the second test is also positive is given by

\\ P(D|2nd +) = \frac{P(2nd +|D)*P(D|1st+)}{P(2nd +|D)*P(D|1st+) + P(2nd+|nD)*(1-P(D|1st+))} \\ \\ \text{where, } \\ \\ P(D|1st+) = \frac{P(+|D)*P(D)}{P(+|D)*P(D) + P(+|nD)*(1-P(D))}  \\ \\ \text{since these tests are independent}, P(2nd +|D) = P(+|D) \text{. Substituting, } \\ \\ P(D|2nd +) = \frac{P(+|D)*P(D|1st+)}{P(+|D)*P(D|1st+) + P(+|nD)*(1-P(D|1st+))} \\ \\ =   \frac{P(+|D)* [ \frac{P(+|D)*P(D)}{P(+|D)*P(D) + P(+|nD)*(1-P(D))} ] }{P(+|D)* [ \frac{P(+|D)*P(D)}{P(+|D)*P(D) + P(+|nD)*(1-P(D))} ] ) + P(+|nD)*(1- [ \frac{P(+|D)*P(D)}{P(+|D)*P(D) + P(+|nD)*(1-P(D))} ] )} \\ \\ \text{expanding and cancelling similar terms,} \\ \\  P(D|2nd +) =  \frac{P(+|D)*P(+|D)*P(D)} {P(+|D)*P(+|D)*P(D) + P(+|nD)*(1-P(D))} = P(D|++)

Yes, posterior is the new prior! If you generalise the equation for n number of independent tests,

\\ P(D|+n) = \frac{P(+|D)^n*P(D)}{P(+|D)^n*P(D) + P(+|nD)^n*(1-P(D))}