If $X$ and $Y$ have joint density function

$ f_{X, Y}(x, y)= \begin{cases} 1/y, &\text{if } 0<y<1, &0<x<y \\ 0, &\text{otherwise} \end{cases} $

find the probability density function of $X$, i.e., $f_X(x)$ and the probability density function of $Y$, i.e., $f_Y(y)$.

My attempt:

The formulas for $f_X(x)$ and $f_Y(y)$ are:

$$f_X(x)=\int_{-\infty}^\infty f_{X, Y}(x, y)\ dy$$

$$f_Y(y)=\int_{-\infty}^\infty f_{X, Y}(x, y)\ dx$$

I can substitute $1/y$ for $f_{X, Y}(x, y)$ but I'm unsure what the new limits of integration would be. Any suggestions?


Here's an attempt.

We have the upper triangular region of the $[0,1] \times [0,1]$ as our domain of integration, so we just need to figure out how to write these bounds.

We have $\int_0^1 \int_0^y 1/y \text{ } dx \text{ } dy = \int_0^1 \int_x^1 1/y \text{ } dy \text{ } dx = 1$, so the marginal $f_Y(y)$ can be found as $$ \int_0^y f_{X,Y}(x,y) dx = 1 $$ and similarly the marginal $f_X(x)$ can be found as $$ \int_x^1 f_{X,Y}(x,y) dy = -\log(x) $$

I also wrote a small Metropolis-Hastings MCMC program to simulate from this distribution as a sanity check and have included my R code below.

fxy <- function(x,y){
  1/y * (x<y) * (y<1) * (x>0) * (y>0)

mh <- function(niter,xstart,ystart,propsd){
  res = list(x=x,y=y)
  res$x[1] = xstart
  res$y[1] = ystart
  for(i in 2:niter){
    xold <- res$x[i-1]
    yold <- res$y[i-1]
    xnew <- xold + rnorm(1,0,propsd)
    ynew <- yold + rnorm(1,0,propsd)
    A <- min(1,fxy(xnew,ynew)/fxy(xold,yold))
    if(runif(1) < A){
      res$x[i] <- xnew
      res$y[i] <- ynew
    } else {
      res$x[i] <- xold
      res$y[i] <- yold

niter <- 1e4
res <- mh(niter=niter,xstart=0.25,ystart=0.5,propsd=0.5)
xx <- seq(0.01,1,by=0.01)

Plotting the histograms we see $f_Y(y) \propto 1$ and $f_X(x) \propto -\log(x)$enter image description here enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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