6.4 - Bivariate (2 → 2) transformations

Introduction

  • This method is also known as the Jacobian method
  • Extension of the pdf method, but for \(2\rightarrow 2\) transformations
  • Let \((X,Y)\) be jointly continuous with joint pdf \(f_{X,Y}(x,y)\)
  • Define \(2 \rightarrow 2\) transformation: \(U = g(X,Y), V = h(X,Y)\)
  • Then:

\[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|\]

Other use

  • Really care about distribution of \(U = g(X,Y)\)
  • Do \(2\rightarrow 2\) transformation \((X,Y) \rightarrow (U,V)\) for conveniently-chosen \(V\) to find \(f_{U,V}(u,v)\)
  • Integrate out \(V\) to find \(f_U(u)\)

Joint \((U,V)\) support

  • 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:

    1. Edge mapping to edge
    2. Edge collapsing to boundary point
    3. Boundary point mapping to edge
  • Another perspective: a point in the interior of \((X,Y)\) support cannot map outside the \((U,V)\) support.

Example: uniform over unit triangle

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)\).

Identifying the joint support

  • \(U = X/Y\); \(V = Y\)
Joint supports of (X,Y) and (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

Inverses and Jacobian

  • \(U = g(X,Y) = \frac{X}{Y}\), \(V =h(X,Y)= Y\)
  • \(X = g^{-1}(U,V) = UV\); \(Y = h^{-1}(U,V) = V\)

\[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\]

Putting it all together

\[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}\]

Example: independent Paretos

  • Suppose \(X\) and \(Y\) are independent, each with pdf:

\[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}\]

  • Let \(U = \frac{X}{X+Y}\) and \(V = X+Y\). Find \(f_{U,V}(u,v)\).

Joint support

  • \(X>1\), \(Y>1\)
  • \(U = \frac{X}{X+Y}\), \(V = X+Y\)
Joint supports of (X,Y) and (U,V)
  • \(X = 1 \Rightarrow U = \frac{1}{1+Y}, V = 1+Y \Rightarrow V = \frac{1}{U}\), or \(U = \frac{1}{V}\)
  • \(Y = 1 \Rightarrow U = \frac{X}{X+1}, V = X+1 \Rightarrow V = \frac{1}{1-U}\), or \(U = \frac{V-1}{V}\)
  • Joint \((U,V)\) support: \(\frac{1}{V} < U < \frac{V-1}{V}\), \(V > 2\)

Inverses and Jacobian

  • \(U = g(X,Y) = \frac{X}{X+Y}\), \(V =h(X,Y)= X+Y\)
  • \(X = g^{-1}(U,V) = UV\); \(Y = h^{-1}(U,V) = (1-U)V\)

\[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\]

Putting it all together

\[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}\]

Example: logs and trigs on uniforms

  • Let \(X\) and \(Y\) be independent \(UNIF(0,1)\) random variables

\[ \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)\)

Joint support - 1st 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)\)

  • First attempt:

  • \(Y=1\) edge collapses to \((U,V) = (0,0)\)
  • \(X=0\) edge maps to \(V=0\) axis
  • \(X=1\) edge maps to…\(V=0\) axis as well?

Joint support - 2nd 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:

Joint supports of (X,Y) and (U,V)

Let \(r = \sqrt{-2\ln(Y)}\), then:

  • \(\small X=0 \Rightarrow U = r\cos(0), V = r\sin(0)\)
  • \(\small X=1/8 \Rightarrow U = r\cos(\pi/4), V = r\sin(\pi/4)\)
  • \(\small X=1/4 \Rightarrow U = r\cos(\pi/2), V = r\sin(\pi/2)\) \[\vdots\]

\[\therefore -\infty < U < \infty, -\infty < V< \infty\]

Inverses and Jacobian

  • \(U = \sqrt{-2\ln(Y)}\cos(2\pi X)\), \(V = \sqrt{-2\ln(Y)}\sin(2\pi X)\)
  • \(U^2 + V^2 = -2\ln(Y)[\cos^2(2\pi X) + \sin^2(2\pi X)] = -2\ln(Y)\Rightarrow Y = e^{-(U^2 + V^2)/2}\)
  • \(V/U = \sin(2\pi X)/\cos(2\pi X) = \tan(2\pi X)\Rightarrow X = \frac{1}{2\pi}\tan^{-1}\left(\frac{V}{U}\right)\)

\[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}\]

Putting it all together

\[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!

Verifying via simulation

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
Simulated densities of U and V