# Conditional expectation given event and random variable

Let $W$ be a random variable that only takes on the values $1$ or $0$. Let $X$ and $Y$ be two other random variables. I came across the following: $$\mathbb{E}(Y|W=1, X)$$ How is this 'conditional expectation' even defined? It doesn't seem to fit the usual definition of a conditional expectation because $W=1$ is an event while $X$ is a random variable.

I was hoping to find a definition similar to that of $\mathbb{E}(Y|X)$, which has the property that $$\int_{B} \mathbb{E}(Y|X) dP=\int_{B} Y dP$$ for all $B \in\sigma(X)$.

Additional context:

Suppose we have observations $Y_i=W_i Y_i(1)+(1-W_i)Y_i(0)$ where the random variable $W_i \in\{0,1\}$ and the two random variables $Y_i(0), Y_i(1)$ can each be described by a regression model, that is $$Y_i(w)=\beta_{w,0}+\beta_{w,1}X_i+\epsilon_{w,i}, \hspace{5mm} w\in\{0,1\}$$ When the author writes $E(Y_i|W_i=1, X_i)$, I am pretty sure he means that $$E(Y_i|W_i=1, X_i)=\beta_{1,0}+\beta_{1,1}X_i$$ but I am wondering if this conditional expectation is well defined or made up notation.

• $E(Y|W=1,X)$ may be shorthand notation for $g(X)$ where $g(x)=E(Y|W=1, X=x)$. So it's a function of the random variable $X$ and thus itself a random variable. – Jarle Tufto Jun 17 '18 at 12:55
• @JarleTufto does the tower law hold in that case, that is $\mathbb{E}(\mathbb{E}(Y|W=1, X))=\mathbb{E}(Y|W=1)?$ – Joogs Jun 17 '18 at 16:02
• Yes, all laws of probability also hold conditionally. – Jarle Tufto Jun 17 '18 at 16:40
• @JarleTufto , it appears I made a mistake in the above, it should be $$\mathbb{E}(\mathbb{E}(Y|W=1, X)|W=1)=\mathbb{E}(Y|W=1)$$ which looks very similar to the tower law $$\mathbb{E}(\mathbb{E}(Y|W, X)|W)=\mathbb{E}(Y|W)$$, but how do we know that the first expression is true as well? It seems that your general statement "all laws of probability also hold conditionally" plays a role here: namely, the tower law also holds conditionally on the event $W=1$. Do you have any reference explaining why this is the case? – Joogs Jun 17 '18 at 18:09
• @Joogs: Most introductory books in probability theory will establish that a conditional probability with a given condition is a probability measure (i.e., obeys the Kolmogorov axioms). Once that is established, all theorems applying to probability measures hold. – Ben Jun 28 '18 at 4:56

## 2 Answers

This is a fairly standard notation, $\mathbb{E}[Y|W,X]$ being the random variable derived from the pair $(W,X)$. When the realisation of $W$ is one (1) and the realisation of $X$ is $x$, this random variable has as realisation $\mathbb{E}[Y|1,x]$, or in a clearer representation $\mathbb{E}[Y|W=1,X=x]$. Since the only possible realisations of $W$ are $0$ and $1$, the random variable $\mathbb{E}[Y|W,X]$ can only take as values $\mathbb{E}[Y|W=0,X]$ and $\mathbb{E}[Y|W=1,X]$.

• So you are saying that $\mathbb{E}(Y|W=1,X)$ should be intepreted as $f(W=1, X)$ where $f$ is the function in $\mathbb{E}(Y|W, X)=f(W,X)$, which makes sense. Can you give a measure theoretic definition of this expression (similar to the usual conditional expectation $\mathbb{E}(Y|X)$ I gave above) ? Also, does it hold that $\mathbb{E}(\mathbb{E}(Y|W=1, X))=\mathbb{E}(Y|W=1)?$ – Joogs Jun 17 '18 at 15:57
• It should be $$\mathbb{E}(\mathbb{E}(Y|W=1, X)|W=1)=\mathbb{E}(Y|W=1)?$$ – Xi'an Jun 17 '18 at 16:39
• This looks very similar to the the tower property which says that $$\mathbb{E}(\mathbb{E}(Y|W,X)|W)=\mathbb{E}(Y|W)$$, but it is definitely not the same since the RHS in the usual tower property, $\mathbb{E}(Y|W)$, is a random variable while $\mathbb{E}(Y|W=1)$ is just a real number. How do we know $$\mathbb{E}(\mathbb{E}(Y|W=1, X)|W=1)=\mathbb{E}(Y|W=1)$$ is true? – Joogs Jun 17 '18 at 18:04

I will post this as an answer to my own question, but I am not entirely sure if it is correct.

$\mathbb{E}(Y|W=1, X)$ is the random variable defined by having the property:

$$\int_B \mathbb{E}(Y|W=1,X) dP=\int_B Y dP$$ for all $B$ in $\sigma(\{W=1\}\cap C: C \in\sigma(X))$.

From this property it immediately follows that the 'conditional' tower law holds since by definition of the property above $$\mathbb{E}(I_{\{W=1\}}E(Y|W=1,X))=E(I_{\{W=1\}}Y)$$ which implies that $$\mathbb{E}(\mathbb{E}(Y|W=1,X)|W=1)=\frac{\mathbb{E}(I_{\{W=1\}}E(Y|W=1,X))}{P(W=1)}\\=\frac{\mathbb{E}(I_{\{W=1\}}Y)}{P(W=1)}=E(Y|W=1)$$
{"ft_lang_label":"__label__en","ft_lang_prob":0.87497044,"math_prob":0.99994624,"size":1039,"snap":"2021-04-2021-17","text_gpt3_token_len":349,"char_repetition_ratio":0.12753624,"word_repetition_ratio":0.0,"special_character_ratio":0.33782482,"punctuation_ratio":0.100877196,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":1.0000052,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-04-11T04:41:08Z\",\"WARC-Record-ID\":\"<urn:uuid:ac4cec7b-8e86-4f4f-b02a-4b664f3cdf1a>\",\"Content-Length\":\"181521\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:a4eb8007-5b7c-463e-812b-547a216ba545>\",\"WARC-Concurrent-To\":\"<urn:uuid:c5e101ac-e2ba-45e6-ba11-272b035d64ca>\",\"WARC-IP-Address\":\"151.101.193.69\",\"WARC-Target-URI\":\"https://stats.stackexchange.com/questions/351764/conditional-expectation-given-event-and-random-variable\",\"WARC-Payload-Digest\":\"sha1:T4JCD4EKH4ZAZZTFUQQ4TK27A4KLA6ZL\",\"WARC-Block-Digest\":\"sha1:3TLP67AKUPUCVMUMA3LM5DSH54EYVZ2D\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-17/CC-MAIN-2021-17_segments_1618038060927.2_warc_CC-MAIN-20210411030031-20210411060031-00350.warc.gz\"}"}