# How to properly represent a conditional expectation $E(Y\mid X,Z)$ if there are values of $X$ and $Z$ that cannot simultaneously exist?

Suppose $$Y, X, Z$$ are all discrete random variables. Then the conditional mean of $$Y$$ on levels of $$X=x$$ and $$Z=Z$$ is represented by

$$E(Y\mid X=x,Z=z)$$

now suppose that there are values of $$x_1 \in X$$ and $$z_1 \in Z$$ such that both cannot simultaneously exist. An example might be if $$Y, X, Z$$ were vectors of observations corresponding to people, and so such person had $$x_1, z_1$$ simultaneously. In such a case,

$$E(Y\mid X=x_1,Z=z_1)$$

is undefined. Is there a way define the conditional expectation in a notationally correct way? One thought is using the indicator function

$$\mathbb{1}(X=x_1,Z=z_1)E(Y\mid X=x_1,Z=z_1)$$

but $$E(Y\mid X=x_1,Z=z_1)$$ is still undefined and multiplying by zero seems to be a hacky fix.

Example:

For an example, consider $$Y$$ to be mortality, where $$Y=1$$ is death, $$Y=0$$ is living. Then, suppose $$X$$ is gender, such that $$X=1$$ is female, $$X=0$$ male and that $$Z$$ is whether one had ovarian cancer before ($$Z=1$$).

Then,

$$E(Y\mid X=0, Z=1)$$

can't be computed because to have ovarian cancer implies one is female, therefore we cannot compute it since $$X=0$$ is male (making the assumption only females can get ovarian cancer).

Further Motivation:

I am also motivated by how the law of total probability might work under such cases. For example, suppose we wanted to find $$E(Y\mid X) but only had information at the level of$$X$$and$$Z$. We can therefore use the law of total probability to have: $$E(Y\mid X) = \sum_z E(Y\mid X,Z=z)P(Z=z\mid X)$$ However, in such cases, sometimes, like the example above, $$E(Y\mid X,Z=z)$$ is undefined at certain values. How might the law of total probability work in this case? I would appreciate any insights. Thanks! •$\mathbb{E}(W|A)$can be defined as long as$A$is an event in the sample space. If$P(A) \neq 0$then the usual way works, otherwise one has to resort to more sophisticated theory. If$A$is an impossible event, meaning$A$is not a subset of$\Omega$then everything is meaningless. How does one condition on an event that isn’t in the experiment? Nevermind notations—*the event cannot happen*, so how can we condition on it? A less rhetorical question—what led you to wish for this? – Nap D. Lover May 10 at 1:47 • I have updated my question with a concrete example. Thank you for response! – user321627 May 10 at 2:38 • One way to resolve this is to take$Z$to be binary on$\{0,1\}$conditional on$X=1$and$Z=0$a.s. conditional on$X=0$(i.e. deterministic!). Then$\{X=0, Z=1\}$is in the sample space but has probability zero. In words, conditional on selecting a female from the study, there is a probability$p_Z=\mathbb{P}(Z=1|X=1)$of them having ovarian cancer, and probability$q_Z=1-p_Z=\mathbb{P}(Z=0|X=1)$of not having cancer, and conditional on selecting a male, almost surely the male does not have ovarian cancer:$P(Z=0| X=0)=1\$. You should be able to see through applying LTE now. What do ya think? – Nap D. Lover May 10 at 23:18