# Bayes' Theorem and Law of total propability for CDF

The calculation of conditional probability is the same for conditional PDF and CDF(according to a number of questionable sources: first, second) (I will use rough notation, with just $x$ and $y$):

$$F(x \ | \ y) = \frac{F(x,y)}{F(y)}, \ \ f(x \ | \ y) = \frac{f(x,y)}{f(y)}$$

The Bayes' Theorem for probability density functions looks like

$$f(x \ | \ y) = \frac{f(y \ | \ x)f(x)}{f(y)}$$

and can be derived using second definition above. Looks like the same can be postulated for cumulative distribution function:

$$F(x \ | \ y) = \frac{F(y \ | \ x)F(x)}{F(y)}$$

Really:

$$\frac{F(x,y)}{F(y)} = F(x \ | \ y) = \frac{F(y \ | \ x)F(x)}{F(y)},$$

$$\frac{F(x , y)}{F(x)} = F(y \ | \ x).$$

Now the question - "law of total probability" for PDFs:

$$f(x \ | \ y) = \frac{f(y \ | \ x)f(x)}{\int_{\Omega}f(y \ | \ x)f(x)dx}$$

Can it be expressed in terms of CDFs somehow (I don't have $F(y)$)?

EDIT: maybe some computational approach. I know that I can set in joint CDF some very big $x$: $\lim_{x \rightarrow \infty} F(x,y) = F(y), \ F(x,y)=F(y\ | \ x)F(x)$, but I can't obtain joint CDF from my data. I know also that I can find find "derivative": $f(x) \approx \frac{F(x+\Delta)-F(x-\Delta)}{\Delta}$, but it will be poor estimate.

I have: $F(y \ | \ x)$ and $F(x)$ estimated - both functions of $x$ ($y$ is actual observation data).

• @GrahamKemp Wow. Please, can you check this? May 27, 2016 at 1:41
• Make sure the term $F(y|x)$ you have is really mean $\Pr\{Y \leq y|X \leq x\}$, or instead $\Pr\{Y \leq y|X = x\}$ as GrahamKemp doubts. $f(y|x)$ is the derivative of the latter, not the former. Theoretically you have to do differentiation anyway to obtain the pdf from CDF. For pdf estimation, there are e.g. kernel density estimation, and other method as well (I am not familiar with those). It depends on whether you got the raw data, or forced to start with the estimated CDFs.
– BGM
May 27, 2016 at 3:34
• @BGM Thanks for the answer! My data is elements with probabilities: $<x_i,p_i>$. I can easily generate CDF from them (just interpolate a step-function), but I don't know how to make density from such data (with importance factors). Authors use estimation through density trees, but I can't implement it. So I search for the way to replace this step, somehow using CDFs I have. May 27, 2016 at 3:45
• I don't think that $F_{X\mid Y}(x\mid y)$ equals $\displaystyle\frac{F_{X,Y}(x,y)}{F_Y(y)}$ as you claim it does. From $\displaystyle f_{X\mid Y}(x\mid y)=\frac{f_{X,Y}(x,y)}{f_Y(y)}$, we have that \begin{align}F_{X\mid Y}(x\mid y)&=\int_{-\infty}^x f_{X\mid Y}(t\mid y)\,\mathrm dt\\&=\int_{-\infty}^x \frac{f_{X,Y}(t,y)}{f_Y(y)}\,\mathrm dt\\&=\frac{1}{f_Y(y)}\int_{-\infty}^x f_{X,Y}(t,y)\,\mathrm dt\end{align} May 27, 2016 at 5:14
• The custom of using $F$ for CDF and $f$ for pdf assumes some consistency of notation. If one defines $F_{X\mid Y}(x\mid y)$ to mean $\displaystyle\frac{F_{X,Y}(x,y)}{F_Y(y)}$, then the corresponding definition of $f_{X\mid Y}(x\mid y)$ is the derivative w.r.t. $x$ of $F_{X\mid Y}(x\mid y)$, namely, $\displaystyle\frac{\frac{\partial F_{X,Y}(x,y)}{\partial x}}{F_Y(y)}$, and not what you have used (which is the standard definition of the conditional pdf of $X$ given that $Y$ equals $y$). May 30, 2016 at 15:03