# Joint density with continuous and binary random variable

Assume $X\in\mathbb{R}$, $Y\in\{0,1\}$ are two random variables. What allows us to claim that $$f_{X}(x) = f_{XY}(x,1) + f_{XY}(x,0)$$ where $f_X(x)$ and $f_{XY}(x,y)$ are densities.

-
The definition, perhaps? –  Did Mar 3 '13 at 16:11
What is $f_{XY}$ and how does it differ from plain vanilla $f$ which you say is a density? –  Dilip Sarwate Mar 3 '13 at 16:11
My initially posted answer missed something, but I've edited to take that into account, and the answer is still just as simple. –  Michael Hardy Mar 3 '13 at 18:38
@ Michael Hardy. Thank you. I upwoted your answer originally, but someone downvoted it after that. –  arkadiy Mar 3 '13 at 18:50
add comment

## 2 Answers

\begin{align} \int_A f_{X,Y}(x,1)+f_{X,Y}(x,0)\,dx & = \int_A f_{X,Y}(x,1)\,dx+\int_A f_{X,Y}(x,0)\,dx \\[8pt] & = \Pr(X\in A\ \&\ Y=1) + \Pr(X\in A\ \&\ Y=0) \\[8pt] & = \Pr((X\in A\ \&\ Y=1)\text{ or }(X\in A\ \&\ Y=0)) \\[8pt] & = \Pr(X\in A) \\[8pt] & = \int_A f_X(x) \, dx. \end{align}

-
Hi Hardy... He says $X\in \mathbb{R}$, so I thought he was referring to a mixture of discrete and cont. distributions. In that case, $P(X=x,Y=1)$ would become zero. –  Bravo Mar 3 '13 at 17:01
Oh, I see. I'll edit my answer accordingly. –  Michael Hardy Mar 3 '13 at 18:35
Done. ${{{{{}}}}}$ –  Michael Hardy Mar 3 '13 at 18:37
add comment

$$P(X\le x)=P(X\le x\mid Y=1)P(Y=1)+P(X\le x\mid Y=0)P(Y=0)\\ =P(X\le x, Y=1)+P(X\le x,Y=0)\\ f_X(x)=\frac{dP(X\le x)}{dx}=f_{XY}(x,1)+f_{XY}(x,0)$$

-
My initial comment here was mistaken; I had missed something. Now I've adjusted my own answer accordingly. You've done the derivative version; I've done the integral version. BTW, I notice I'm the only person who's up-voted the question itself; you might consider doing that. –  Michael Hardy Mar 3 '13 at 18:40
add comment