Find $P(R=1 | X=x)$ where $X$ is continuous but $R$ is discrete 
$R$ is a Bernoulli random variable with $p=0.5$. $X$ is a normal random variable such that $f_X(x|R=0) = \mathcal{N}(0,1)$ and $f_X(x|R=1) = \mathcal{N}(0,\sigma^2)$. Find $P(R=1 | X=x)$.

I have attempted the following, but basically I'm not sure on how to find $f_X(s)$. I started with Bayes Theorem, which gives me
$$\frac{P(R=1|X=x) f_X(x)}{P(R=1)}=f_X(x|R=1)$$
, which implies that
$$P(R=1 | X=x) f_X(x) = 0.5 \mathcal{N}(0,\sigma^2)$$
(P.S. I have never seen a Bayes Theorem where $X$ is cts but $Y$ is discrete, so I am guessing here.)
But I am not sure how to find $f_X (x)$, since we are in a "mixture model". Is it just
$$f_X(x) = \mathcal{N}(0,1)P(R=0) + \mathcal{N}(0,\sigma^2)P(R=1)$$
?
 A: $\def\e{\varepsilon}$First of all, your formulation of Baye's theorem is correct. To justify it, first replace the zero-probability event $\{X=x\}$ with the nonzero event $\{X\in (x-\e,x+\e)\}$, for any $\e>0$:
$$
\frac{P\big(R=1|X\in (x-\e,x+\e)\big)\cdot{P(X\in (x-\e,x+\e))}}{P(R=1)}=P\big(X\in (x-\e,x+\e)|R=1\big)
$$
Then, divide both sides by $2\e$, and let $\e\to 0$ to recover your equation.

To find $f_X(x)$, first find the cumulative distribution function $F_X(x)=P(X\le x)$, then differentiate. To do this, write
$$
P(X\le x ) = P(X\le x|R=0)P(R=0)+P(X\le x|R=1)P(R=1)
$$
This will result in the answer you guessed.
A: Here is the a nice article on gaussian mixture models from University of Toronto.
What you require is $f(R=1/X=x) = \dfrac{\pi.f(X=x/R=1)}{(1-\pi).f(X=x/R=1+\pi.f(X=x/R=0}$.
This is the posterior probability and shall be gotten by the E-step of EM algorithm from this paper.
If you look closely the posterior probability distribution E step left panels (Figure 4 in the paper). gets a shape of a near sigmoid function - like distribution which can easily be derived as follows
$f(R=1/X=x) = \dfrac{0.5\frac{1}{\sqrt{2\pi}\sigma}.e^{-\frac{x^2}{2\sigma}}}{0.5\frac{1}{\sqrt{2\pi}}.e^{-\frac{x^2}{2}}+0.5\frac{1}{\sqrt{2\pi}\sigma}.e^{-\frac{x^2}{2\sigma}}}$
If you simplify this you get
$f(R=1/X=x) = \dfrac{1}{1+\sigma e^{-\frac{1-\sigma}{2\sigma}.x^2}}$
If you put $\frac{1-\sigma}{2\sigma} = k$
then $f(R=1/X=x) = \dfrac{1}{1+\sigma e^{-kx^2}}$
which is very close to a sigmoid function with steep gradient.
Enjoy the paper and hopefully this answers your question.
Mixture Models
