1
$\begingroup$

I am trying to make this bivariate density function as posterior

 f(x,y) = k x^2 exp( - x y^2 - y^2 + 2y - 4x)

and try jags instead of implementing in R as in the link below.

https://darrenjw.wordpress.com/2011/07/16/gibbs-sampler-in-various-languages-revisited/

the problem is it doesn't look like any standard distribution offered by BUGS.

My initial plan was to make likelihood as unif(0,1) or something and

one observed variable is 1/2 or something and let f(x,y) be f(x)*f(y)

(f(x) and f(y) be priors) or let f(x,y) be multivariate priors

Any idea on what the distribution is called and how to make it posterior?

$\endgroup$
1
  • 1
    $\begingroup$ It would be helpful to understand how you came with the density. $\endgroup$
    – Xi'an
    May 10, 2015 at 18:59

1 Answer 1

4
$\begingroup$

This is a joint density: from $$f(x,y) \propto x^2 \exp\left( - x y^2 - y^2 + 2y - 4x\right)$$you can derive that \begin{align*}f(y|x)&\propto\exp\left( - x y^2 - y^2 + 2y\right)\\ &\propto\exp\left(-(1+x)[y^2-2y/(1+x)]\right)\\ &\propto\exp\left(-(1+x)[y-1/(1+x)]^2\right)\end{align*} Therefore you can deduce that$$Y|X=x\sim\mathcal{N}\left(\frac{1}{1+x},\frac{1}{2(1+x)}\right)$$ The marginal distribution of $X$ is given by \begin{align*}f(x) &\propto x^2\exp\{-4x\}\int_{-\infty}^{\infty} e^{-(1+x)y^2+2y}\,\text{d}y\\ &\propto x^2\exp\{-4x\}\int_{-\infty}^{\infty}e^{-(1+x)[y-1/(1+x)]^2+1/(1+x)}\,\text{d}y\\ &\propto x^2\exp\{-4x+1/(1+x)\}\,\frac{1}{\sqrt{1+x}}\end{align*} which does not look like a standard distribution.

However, the conditional distribution of $X$ given $Y$ is also standard: \begin{align*}f(x|y) &\propto x^2\exp\{-4x -xy^2\}\\ &\propto x^{3-1} \exp\{-(4+y^2)x\}\\\end{align*}which implies that $$X|Y=y\sim Ga(3,(4+y^2))$$ This implies you can use Gibbs sampling.

$\endgroup$
3
  • $\begingroup$ Thank you for the answer. But I think you misunderstood the question. My whole purpose was to implement it via jags. So I have to make f(x,y) somehow posterior distribution like f(x,y | X). here X is data. f(x,y|X)=f(X|x,y)p(x,y)/f(X). given f(X) is constant, I need to find a way to represent f(x,y|X) = f(X|x,y)p(x,y)...p(x,y) : priors for x,y. X can be any constants satisfying f(x,y |X)=f(x,y) $\endgroup$
    – KH Kim
    May 11, 2015 at 5:30
  • $\begingroup$ Sorry, your comment makes no sense... $\endgroup$
    – Xi'an
    May 11, 2015 at 6:21
  • $\begingroup$ okay.. let f(x,y) be itself and think of some model with prior g(x,y) and likelihood L(X|x,y). BUGS samples from posterior g(x,y|X) right? in doing so BUGS(JAGS) samples like g(x|y,X) and (y|x,X). So I want to sample from f(x,y) via JAGS(BUGS). How would you do that? $\endgroup$
    – KH Kim
    May 11, 2015 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.