# Using Bayes Rule to make inference about conditional probability using sample proportions

Suppose your target is to estimate $P(A|B)$, but it is impossible to do so directly. However, you have reasonable estimates of

• $P(B|A)$
• $P(B)$
• $P(A)$

from separate sources. Generally these are estimated with error, but in my application, it's likely that the first two are measured with basically no error (e.g. using population census data). So, it seems reasonable to estimate the target probability as

$$\widehat{P}(A|B) = \frac{ \widehat{P}(B|A) \cdot \widehat{P}(A)}{\widehat{P}(B)}$$

I don't see how to formulate this as a Bayesian modeling problem, using the usual tricks. The idea I keep coming back to is this:

• Obtain a 95% confidence interval for $P(A)$
• Across a grid of values for that CI, calculate $\widehat{P}(A|B)$

My questions:

(1) Would that give a valid 95% CI for $P(A|B)$?

(2) In greater generality, is there a clever way to get a CI if all three probabilities on the right hand side are measured with error?

(3) What if, for example, I didn't know $P(A)$ and instead specified a prior probability. Does this change anything, relative to (1), or would this just be called "sensitivity analysis"?

• If the first two are measured w/o error, then you don't need a "grid of values" because the target CI is equal to the CI for $P(A)$ multiplied by the ratio of the first two quantities. – Nik Tuzov Jul 20 '16 at 19:15
• OK so just multiplying the CI by $\frac{ \widehat{P}(B|A)}{\widehat{P}(B)}$ and that gives you a valid CI for $P(A|B)$? Any hints about what to do if there is uncertainty in the other two probabilities would also be appreciated. – not_bonferroni Jul 21 '16 at 14:12
• If the three quantities in the RHS are estimated with error, you may try using simulation to get the CI for $P(A|B)$. However, the three quantities might be dependent, so in that case you'll have to get the variance-covariance matrix somewhere and use it to generate the 3-dim vector. – Nik Tuzov Jul 21 '16 at 15:43
• Thanks for the follow-up. I am fine assuming they are independent. Is there a particular simulation method you are proposing? Any link I can read maybe? Are would you suggest just moving across the 3D grid defined by the three CIs and calculate a range that way (not exactly simulation)? – not_bonferroni Jul 21 '16 at 19:05
• For instance, if you have a point estimate and standard error for the 3 quantities, you can assume they are Normal and simulate 3 independent normals. Do not restrict the simulated values to CIs. Then for each simulated 3d point, you'll get one estimate of target quantity, and after a number of trials you'll get the CI. Incidentally, if you assume normality then, as a random variable, the target quantity will have no expectation and higher moments, but I guess that doesn't mean you can't get the CI. – Nik Tuzov Jul 22 '16 at 16:48