\[f_{U,V}(u,v) = f_{X,Y}(g^{-1}(u,v), h^{-1}(u,v)) |det(J)|,\]
where:
\[ \scriptsize J = \begin{bmatrix} \frac{\partial g^{-1}}{\partial u} & \frac{\partial g^{-1}}{\partial v} \\ \frac{\partial h^{-1}}{\partial u} & \frac{\partial h^{-1}}{\partial v} \end{bmatrix}\]
\[\scriptsize |det(J)| = \left|\frac{\partial g^{-1}}{\partial u}\frac{\partial h^{-1}}{\partial v} - \frac{\partial h^{-1}}{\partial u} \frac{\partial g^{-1}}{\partial v}\right|\]
One of the biggest challenges is defining the joint \((U,V)\) support.
Boundary of \((X,Y)\) support must stay boundary in \((U,V)\) space in one of these ways:
Another perspective: a point in the interior of \((X,Y)\) support cannot map outside the \((U,V)\) support.
Consider jointly continuous \((X,Y)\) with joint pdf given by:
\[f_{X,Y}(x,y) = \begin{cases} 2 & 0 < x < y < 1 \\ 0 & otherwise \end{cases}\]
Let \(U = g(X,Y) = \frac{X}{Y}\) and \(V =h(X,Y)= Y\). Find \(f_{U,V}(u,v)\).
\(X=0 \Rightarrow U=0\)
\(Y=1 \Rightarrow V=1\)
\(Y=X \Rightarrow U=1\). Travel from \(V=1\) to \(V=0\) by decreasing \(Y\) and \(X\) at same rate.
\((X,Y)\) support is “filled up” with lines of form \(Y=cX\) for \(c>1\); these lines form vertical \(U=1/c\) lines filling up the \((U,V)\) support
\[J = \begin{bmatrix} \frac{\partial g^{-1}}{\partial u} & \frac{\partial h^{-1}}{\partial u} \\ \frac{\partial g^{-1}}{\partial v} & \frac{\partial h^{-1}}{\partial v} \\ \end{bmatrix} = \begin{bmatrix} \frac{\partial x}{\partial u} & \frac{\partial y}{\partial u} \\ \frac{\partial x}{\partial v} & \frac{\partial y}{\partial v} \\ \end{bmatrix} = \begin{bmatrix} v & 0 \\ u & 1 \\ \end{bmatrix}\]
\[|det(J)| = |v\cdot 1 - u \cdot 0| = v\]
\[f_{U,V}(u,v) = f_{X,Y}(g^{-1}(u,v), h^{-1}(u,v)) |det(J)|\]
\[ = f_{X,Y}(uv, v) \cdot v\]
\[= \begin{cases} 2v & 0 < u < 1, 0 < v < 1\\ 0 & otherwise \end{cases}\]
\[f_X(t) = f_Y(t) = \begin{cases} \frac{1}{t^2} & t >1 \\ 0 & otherwise \end{cases}\]
\[\implies f_{X,Y}(x,y) = \begin{cases} \frac{1}{x^2y^2} & x >1, y > 1 \\ 0 & otherwise \end{cases}\]
\[J = \begin{bmatrix} \frac{\partial x}{\partial u} & \frac{\partial y}{\partial u} \\ \frac{\partial x}{\partial v} & \frac{\partial y}{\partial v} \\ \end{bmatrix} = \begin{bmatrix} v & -v \\ u & 1-u \\ \end{bmatrix}\]
\[|det(J)| = |v(1-u) + u v| = v\]
\[f_{U,V}(u,v) = f_{X,Y}(g^{-1}(u,v), h^{-1}(u,v)) |det(J)|\]
\[ = f_{X,Y}(uv, (1-u)v) \cdot v = \frac{1}{(uv)^2((1-u)v)^2}\cdot v\]
\[= \begin{cases} \frac{1}{u^2(1-u)^2 v^3} & \frac{1}{v} < u< \frac{v-1}{v}, v> 2\\ 0 & otherwise \end{cases}\]
\[ \Rightarrow f_{X,Y}(x,y) = \begin{cases} 1 & 0 < x < 1, 0 < y < 1 \\ 0 & otherwise \end{cases}\]
Let \(U = \sqrt{-2\ln(Y)}\cos(2\pi X)\), \(V = \sqrt{-2\ln(Y)}\sin(2\pi X)\)
Find \(f_{U,V}(u,v)\)
\(0 < X < 1\), \(0 < Y < 1\)
\(U = \sqrt{-2\ln(Y)}\cos(2\pi X)\), \(V = \sqrt{-2\ln(Y)}\sin(2\pi X)\)
First attempt:
\(0 < X < 1\), \(0 < Y < 1\)
\(U = \sqrt{-2\ln(Y)}\cos(2\pi X)\), \(V = \sqrt{-2\ln(Y)}\sin(2\pi X)\)
Consider instead the “rays” that fill up the \((X,Y)\) support:
Let \(r = \sqrt{-2\ln(Y)}\), then:
\[\therefore -\infty < U < \infty, -\infty < V< \infty\]
\[J = \begin{bmatrix} \frac{\partial x}{\partial u} & \frac{\partial y}{\partial u} \\ \frac{\partial x}{\partial v} & \frac{\partial y}{\partial v} \\ \end{bmatrix} = \begin{bmatrix} \frac{1}{2\pi}\frac{1}{1+(v/u)^2}\left(-\frac{v}{u^2}\right) & -u e^{-(u^2 + v^2)/2} \\ \frac{1}{2\pi}\frac{1}{1+(v/u)^2}\left(\frac{1}{u}\right) & -v e^{-(u^2 + v^2)/2} \\ \end{bmatrix} = \begin{bmatrix} -\frac{v}{2\pi(u^2+v^2)} & -u e^{-(u^2 + v^2)/2} \\ \frac{u}{2\pi(u^2+v^2)} & -v e^{-(u^2 + v^2)/2} \\ \end{bmatrix}\]
\[|det(J)| = \left|\frac{v^2e^{-(u^2+v^2)/2}}{2\pi(u^2+v^2)}+\frac{u^2e^{-(u^2+v^2)/2}}{2\pi (u^2+v^2)}\right| = \frac{1}{2\pi}e^{-(u^2+v^2)/2}\]
\[f_{U,V}(u,v) = f_{X,Y}\left(\frac{1}{2\pi}\tan^{-1}(v/u),e^{-(U^2 + V^2)/2}\right) \cdot \frac{1}{2\pi}e^{-(u^2+v^2)/2} = 1\cdot \frac{1}{2\pi}e^{-(u^2+v^2)/2}\]
\[ = \frac{1}{\sqrt{2\pi}}e^{-u^2/2}\frac{1}{\sqrt{2\pi}}e^{-v^2/2},-\infty < u < \infty, - \infty < v < \infty\]
\(\therefore U, V\) are standard \(BVN(\rho = 0)\), aka independent \(N(0,1)\) random variables!
N <- 10000
uniform_transform_sims <- (data.frame(X = runif(N), Y = runif(N))
%>% mutate( U = sqrt(-2*log(Y))*cos(2*pi*X),
V = sqrt(-2*log(Y))*sin(2*pi*X))
)
base <- ggplot(data=uniform_transform_sims) + theme_classic()
#Scatterplot:
scatterplot <- base + geom_point(aes(x=U,y=V), shape='.',alpha=.6)
#Density plots:
Uhist <- base + geom_histogram(aes(x = U, y=after_stat(density)),fill='goldenrod',
binwidth = .1) +
geom_function(fun = dnorm,col='cornflowerblue',size=1)
Vhist <- base + geom_histogram(aes(x = V, y=after_stat(density)), fill='goldenrod',
binwidth = .1) +
geom_function(fun = dnorm,col='cornflowerblue',size=1)
scatterplot + Uhist + Vhist