I have a function which outputs samples and the density of a random variable on $(-\infty, \infty)$. On the samples, I apply the Gaussian CDF to get samples on [0,1]. Now, I would like to transform the density accordingly.
My idea was to use the Change of Variables theorem. If $G(y)$ is the Gaussian CDF and $f(x)$ my function, I think it should look like this:
$g(x) = f(G^{-1}(x)|\det(\dfrac{\partial G^{-1}(x)}{\partial x})|$
- Is this correct?
- If so, how do I find the determinant of the inverse Gaussian CDF? I believe another form to express this is
$g(x) = f(z)|\det(\dfrac{\partial G(z)}{\partial z})|^{-1}$, for $z=G^{-1}(x)$
but then I'm still not sure how to find the determinant term.
OK, I think I figured it out:
Let's say $x$ is the random variable on $(- \infty, \infty)$ and $f(x)$ it's PDF. Lets call the Gaussian CDF $H(x)$, and $z:=H(x)$. I am interested in the PDF of z, called g(z).
Given the Change of Variables Formula, we get
$g(z) = f(H^{-1}(z))|\det \dfrac{\partial H^{-1}(z)}{\partial z}|$
and with $z=H(x)$
$g(z) = f(x) | \det \dfrac{\partial H(x)}{\partial x}|^{-1}$
and since the derivative of the Gaussian CDF is the Gaussian PDF, I think $\dfrac{\partial H(x)}{\partial x}$ just becomes a matrix with $h_1(x), ..., h_n(x)$ on the diagonal. The determinant of that is $\prod_{i=1}^n h_i(x)$. We can then take the log:
$\log g(z) = \log f(x) - \log \prod_{i=1}^n h_i(x)$
which I can calculate using my original function and the Gaussian PDF.