# How to implement conditional probability distribution on set-valued Random Variables

I'm trying to implement conditional probability distribution when the events of two RVs are sets. If I try to extrapolate concepts from real or categorical variables to sets things become confusing for me. In the usual scenario, for some pair of discrete RVs, $$X,Y$$, we can compute the conditional probability of two "punctual" events by using the Bayes theorem: $$P(Y=y|X=x)=\frac{P(X=x|Y=y)P(Y=y)}{\sum_{y'\in\mathcal{Y}}P(X=x|Y=y')P(Y=y')}=\frac{f(x,y)}{\sum_{y'\in\mathcal{Y}}f(x,y')},$$ where $$f(x,y)=\sum_{(x',y')\in (\mathcal{X},\mathcal{Y})}\chi(x'=x,y'=y)$$ is an accumulator function giving the total number of times the specific joint event $$x,y$$ is observed in the sample space (i.e. the indicator function $$\chi(x'=x,y'=y)$$ equals one when $$x'=x,y'=y$$ holds). I'd like to compute such probability when events drawn by $$X,Y$$ are sets $$\boldsymbol{x},\boldsymbol{y}$$, respectively. So, how to define the corresponding $$f(\boldsymbol{x},\boldsymbol{y})$$?

I've tried with two main options: $$(1)\hspace{10mm}f(\boldsymbol{x},\boldsymbol{y})=\sum_{(\boldsymbol{x}',\boldsymbol{y}')\in(\mathcal{X},\mathcal{Y})}|(\boldsymbol{x}\cap\boldsymbol{y})\cap(\boldsymbol{x}'\cap\boldsymbol{y}')|,$$ and $$(2)\hspace{10mm}f(\boldsymbol{x},\boldsymbol{y})=\sum_{(\boldsymbol{x}',\boldsymbol{y}')\in(\mathcal{X},\mathcal{Y})}|(\boldsymbol{x}\cap\boldsymbol{y})\cap \boldsymbol{x}'\cup(\boldsymbol{x}\cap\boldsymbol{y})\cap \boldsymbol{y}'|,$$

On the one hand, the motivation behind $$(1)$$ is that $$\boldsymbol{x}\cap\boldsymbol{y}$$ provides a measure of how the attributes of both sets should be observed jointly (such as any intersection event). In turn intersecting this intersection event against other intersection events $$\boldsymbol{x}'\cap\boldsymbol{y}'$$ should provide the measure of how much the joint attributes are observed through the sample space. On the other hand, the motivation behind $$(2)$$ is that in order to compute $$f(\boldsymbol{x},\boldsymbol{y})$$ we need to look for $$\boldsymbol{x}\cap\boldsymbol{y}$$'s attributes in each event of the sample space, without building new events.

However, I'm not sure which one of these analogies is correct (or none at all) with respect to the usual notion of observing the joint event in a sample space. Please, some one can help me to clarify/fix/prove this?

Thank you in advance

## 1 Answer

Your understanding of the basic situation (without sets) has some caveats. It seems that you are defining

$$f(x,y) = \Pr[X=x \land Y=y] \times |\mathcal{X}| \times |\mathcal{Y}|.$$

You seems to be assuming that $$X,Y$$ are independently and uniformly distributed over the sample space $$\mathcal{X} \times \mathcal{Y}$$. Note that this is a big assumption -- it typically won't hold, and if it doesn't hold, your formula is not correct.

You don't need a fancy accumulator function. There is a simpler expression for $$f$$, namely, $$f(x,y) = 1$$ if $$x \in \mathcal{X},y \in \mathcal{Y}$$ (and $$f(x,y) = 0$$ otherwise, if you allow that to happen). Again, this is only valid if $$X,Y$$ are uniformly distributed on $$\mathcal{X} \times \mathcal{Y}$$.

When $$X,Y$$ are sets, the exact same formula holds... under the same assumptions. No changes needed at all.

Your proposed formulas (1), (2) are not correct.

In practice, usually $$X,Y$$ are typically not independently and uniformly distributed. Therefore, these formulas are usually not useful in practice. Instead, you need to work directly with the probabilities; counts and $$f$$ probably won't be useful in that case.