# Change of Variable technique for two variables?

If,

$\theta_1 = \ln \frac p{1-p}$

$\theta_2 = \ln \frac q{1-q}$

$\theta_2|\theta_1 \sim N(\theta_1, \sigma^2)$ which means

$f(\theta_1,\theta_2) \propto e^{\frac{-(\theta_1-\theta_2)^2}{2\sigma^2}}$

How can I make a change of variable from $f(\theta_1,\theta_2)$ to $f(p,q)$ ?

Here is my attempt:

Noting that the Jacobian, $J$, is simply a $2\times 2$ matrix with items $(1,1)$ and $(2,2)$ the derivatives of $\theta_1$ and $\theta_2$ and all other entries equal to $0$, I got the determinant as follows:

$|\det(J)\,| = \frac { e^{(\theta_1 + \theta_2)} }{(1+e^{\theta_1})^2(1+e^{\theta_2})^2}$

Using this and the above function $f(\theta_1,\theta_2)$, I got the following expression:

$f(p,q) = \frac{ \frac{e^{ - (\,p - q )^2 }}{ (2\sigma^2) } (1 + e^{\,p})^2 ( 1 + e^q)^2}{ e^ { \,p + q }}$

• The problem is not correctly set as we miss $f(\theta_1)$: the joint is not what you give as $f(\theta_1,\theta_2)$. – Xi'an Dec 10 '15 at 19:12
• This was how it is given in my assignment: cs.hunter.cuny.edu/~saad/courses/bayes/hw/project2.pdf check 1c – Jenna Maiz Dec 10 '15 at 19:17
• @JennaMaiz "which means" is incorrect -- the conditional doesn't imply the joint, instead the density of the joint is assumed in the linked question. – Juho Kokkala Dec 11 '15 at 8:23

Using $f$ for both pairs is a good recipe for disaster: let us call $f$ the density of $(\theta_1,\theta_2)$ and $g$ the density of $(p,q)$.
Then as you correctly set, the Jacobian formula relates $g$ and $f$: \eqalign{g(p,q) &= f(\theta_1(p),\theta_2(q))\left|\dfrac{d\theta_1}{dp}\dfrac{d\theta_2}{dq}\right|\\ &= f(\ln(p/1-p),\ln(q/1-q))\left|\dfrac{1}{p(1-p)}\dfrac{1}{q(1-q)}\right|\\ &= f_{2|1}(\ln(q/1-q))|\ln(p/1-p))f_1(\ln(p/1-p))\dfrac{1}{p(1-p)q(1-q)}} where $f_{2|1}$ denotes the conditional density of $\theta_2$ given $\theta_1$, hence a normal pdf, and $f_1$ the marginal in $\theta_1$ missing from your question.
If we use the improper prior $$f(\theta_1,\theta_2) \propto e^{\frac{-(\theta_1-\theta_2)^2}{2\sigma^2}}$$ the formula applies, as it works for measures as well, hence $$g(p,q)=\exp\frac{-1}{2\sigma^2}\{\ln(q/1-q)-\ln(p/1-p)\}^2 \dfrac{1}{p(1-p)q(1-q)}$$
In your attempt, you (a) used the inverse transform and (b) forgot to use the transform in the pdf of $(\theta_1,\theta_2)$, i.e. switching the roles of $(\theta_1,\theta_2)$ and $(p,q)$.