# Mapping CDF's to each other

Given two CDF's on a closed interval, $F_1(x), F_2(x)$, can we find a mapping $x\to g(x)$ such that the points $x$ formerly distributed with CDF $\ F_1(x)$, will now have distribution $F_2(x)$?

That is, given some data distributed in a certain manner, can we find a transformation that when applied to our data, will result in data distributed according to another (given) distribution?

• Do you assume the CDF to be continuous? Dec 4, 2013 at 6:07
• @user32240 - if that helps then yes. In practice, I'm given discrete data, but I can always assume that this is a sampling of a continuous one. Dec 4, 2013 at 6:12
• The result is false for discrete distributions. A simple example is given by two Bernoulli variables with parameters $p$ and $p'$ such that $p\ne p'$ and $p\ne 1-p'$. Dec 6, 2013 at 21:41
• Related and rather recent.
– Did
Dec 6, 2013 at 22:00

## 3 Answers

We are looking for a function $g()$:

$$Y = g(X),\;\; F_Y(g(x)) = F_2(y)$$

Inverting the second required relation we obtain

$$F_2^{-1}\left[F_Y(g(x))\right] = y,\;\; \forall y,x$$

By the probability integral transform theorem , the random variable $Z=F_Y(g(X))$ is a uniform random variable in $[0,1]$, whatever $F_Y()$ is (as long as it is a cdf), and whatever $g()$ is. But by the same theorem, the random variable $W = F_1(X)$ is also $U(0,1)$. So we require, equivalently,

$$Y = g(X) = F_2^{-1}\left(F_1(X)\right)$$

So $$g(\cdot) = F_2^{-1}\left(F_1(\cdot)\right)$$ and as a stepwise algorithm,
1) Take your data and use them as inputs in the function $F_1()$.
2) Take the new data obtained in step 1 and used them as inputs in the function $F_2^{-1}()$.
3) The result will be a set of data distributed according to $F_2$.

If the pdf is continuous and strictly positive, then the CDF is continuous and strictly increasing, and so is their inverse. Let us have X distributed following $F_1$ and $Y$ distributed following $F_2$, and $U$ a uniform variable on $[0,1]$.

Then:

$$F_2(y) = P[Y < y]$$ $$F_2(y) = P[U < F_2(y)]$$ $$F_2(y) = P[F_1^{-1}(U) < F_1^{-1}(F_2(y))]$$ $$F_2(y) = P[X < F_1^{-1}(F_2(y))]$$ $$F_2(y) = P[F_2( F_1^{-1} (X)) < y]$$

Therefore if $X$ is distributed following $F_1$ then $F_2( F_1^{-1} (X))$ is distributed following $F_2$.

I will rephrase your question because I find it a bit confusing to think about both $F_1$ and $F_2$ as functions of $x$. So let's say that we have random variables X and Y with distributions given by $F_X$ and $F_Y$; densities $f_X$ and $f_Y$. We will try to find some transformation of $X$ that will give us $Y$, $Y=\varphi(X)$.

Consider value of the distribution function of $X$ at some point $z$, $F_X(z)$: $$F_X(z)=\int_{-\infty}^z f_X(x)dx= \left| \begin{array}{c} substituting \mspace{5mu} x = \varphi^{-1}(y)\\ dx = (\varphi^{-1}(y))'dy \end{array} \right| = \int_{\varphi(-\infty)}^{\varphi(z)}f_X(\varphi^{-1}(y))(\varphi^{-1}(y))'dy.$$

Notice now, that if we managed to set the integrand $f_X(\varphi^{-1}(y))(\varphi^{-1}(y))'$ equal to $f_Y(y)$, we could arrive at something like:

$$\int_{\varphi(-\infty)}^{\varphi(z)}f_X(\varphi^{-1}(y))(\varphi^{-1}(y))'dy= \int_{\varphi(-\infty)}^{\varphi(z)}f_Y(y)dy=F_Y(\varphi(z))-F_Y(\varphi(-\infty)).$$

Thus solving differential equation $f_X(\varphi^{-1}(y))\frac{d\varphi^{-1}(y)}{dy}=f_Y(y)$ together with some regularity conditions ($F_Y(\varphi(-\infty))=0$) should solve the problem.

You can also consult page 11-5 in the http://www.cl.cam.ac.uk/teaching/2003/Probability/prob11.pdf for a nice example :)

• Solving a differential equation for arbitrary functions is not really a solution. Dec 8, 2013 at 6:04
• @nbubis, could you be a little bit more specific? Your question is about arbitrary functions. Notice that the solution doesn't have to be complicated, as a matter of fact, you can probably use separation of variables and then integrate both sides directly! Dec 8, 2013 at 14:16
• I need a solution that can be applied numerically on histograms of data which don't necessarily have a simple functional form. Dec 8, 2013 at 17:08