# Can I use Bayes Theorem to find a conditional distribution rather than conditional probability?

I might be going about this the wrong way, but I'm trying to develop an understanding of a particular conditional value, say $P(CustomerBuysFries | CustomerBuysHamburger) = P(F|H)$. Ultimately, I want to create a distribution on which I can apply a strong prior.

To frame the problem, it seems pretty straightforward, $\frac{P(H|F)P(F)}{P(H)}$.

Because $P(H)$ and $P(F)$ are evaluating yes/no values from a series of trials, it seems natural for them to be Binomial, and I think that suggests that $P(H|F)$ is hypergeometric. So now my Bayes Theorem calculation looks like

$P(F|H) \sim \frac{HypGeo() Bin()} {Bin()}$. If I express this in terms of the PMFs, it becomes

$P(F|H) \sim \frac{\left[ \frac{{L \choose l}{{M-L} \choose {m-l}}}{{M \choose m}}\right]\left[{n \choose k}p^k{(1-p)}^{n-k}\right]}{{q \choose r}s^r(1-s)^{q-r}}$

Here's where I get stuck - the binomial coefficients don't combine cleanly, and so trying to compose it into some simple distribution doesn't seem feasible.

One possibility I considered is replacing the binomial distributions with gaussian approximations, however then I have a ratio of gaussians that aren't independent, which is even messier.

Is it crazy to attempt this theoretically? Should I just stuff it into STAN and call it a day?

Edit 2: After some more thought, I realized that I can share some terms:

$n$: Number of all customers

$k$: Number of customers buying hamburgers

$r$: Number of customers buying fries

$L$: Number of customers in the conditional population (hamburger buyers) who bought fries

$l$: Observed number of fries buyers in the conditional population

Now I can write it as

$P(F|H) \sim \frac{\left[ \frac{{L \choose l}{{k-L} \choose {k-l}}}{{k \choose k}}\right]\left[{n \choose k}p^k{(1-p)}^{n-k}\right]}{{n \choose r}s^r(1-s)^{n-r}}$

• What do you mean "the combinatoric terms don't combine cleanly"? – ocramz Jul 26 '15 at 14:22
• use \sim for ~. – Hemant Rupani Jul 26 '15 at 14:46
• I mean that I'd love to arrive at P(F|H) distributed as some recognizable distribution. There are nCk terms in each Bin() and the HypGeo is made of three sets of them, but I'm not aware of an elegant way to re-express, say, nCk * mCj, no less what amounts to five such terms. I'll update the question to be clearer on what I mean. – Patrick McCarthy Jul 26 '15 at 15:32
• Beta-Binomial is a conjugate prior for Hypergeometric distribution, so you may be interested in learning more bout this relation. – Tim Jul 26 '15 at 17:42
• That's extremely interesting. So if I were to select a beta prior (as I wanted a strong prior anyway) then I would have a resultant BetaBinHypGeo / Bin, and I'd just have to find a way to fold in the denominator Bin. – Patrick McCarthy Jul 26 '15 at 19:35