2

For Bayes' rule, $P(a|x)=\frac{P(x|a)P(a)}{P(x)}=\frac{P(x|a)P(a)}{P(x|a)P(a)+P(x|a^c)P(a^c)}$, if we have $P(x|a)$ and $P(a)$ are discrete (e.g. both equal to 0.5), and $P(x|a^c)$ is continuous (e.g uniform(0,1)), could I just set $P(x|a^c)=1$? If not, how could calculate $P(a|x)$?

Alexis
  • 29,850
Jakoer
  • 115
  • 4

1 Answers1

2

Define $Y=I_A$ and let $f_{X\mid Y}$ denote be the conditional density of $X$ given $Y$. Then, $$ \Pr(A\mid X=x) = \Pr(Y=1\mid X=x) = \frac{f_{X\mid Y}(x\mid 1)\cdot\Pr(A)}{f_{X\mid Y}(x\mid 1)\cdot\Pr(A) + f_{X\mid Y}(x\mid 0)\cdot\Pr(A^c)}. $$

Zen
  • 24,121
  • I don't quite understand, here $f_{X|Y}(x|1)$ and $Pr(a)$ still equal to $0.5$ in my example, and $f_{X|Y}(x|0)$ still follows uniform (0, 1), it does not change anything. – Jakoer Apr 22 '17 at 21:32
  • $Y=1$ means that the event $A$ "happened", while $Y=0$ means that it didn't. You have to specifiy the conditional density of $X$ for the two possibilities. For intance, you may say that $X\mid Y=1\sim\mathrm{N}(0,1)$ and $X\mid Y=0\sim\mathrm{N}(2,1)$. If $X\mid Y=y\sim\mathrm{U}[0,1]$ always (meaning, for $y=0,1$), then the problem is trivial: $\Pr(A\mid X=x)=\Pr(A)$. Check if you're reading your problem statement correctly. – Zen Apr 22 '17 at 23:57