Simulate random vector with given density

131 Views Asked by At

I have a density function $$f(x, y) = \begin{cases} 6x & if\ x \in [0,1], y \in [0, 1 - x]\\ 0 & otherwise \end{cases}$$ and I want to simulate a random vector with that density. It is possible generate samples from this distribution?

1

There are 1 best solutions below

1
On BEST ANSWER

To simulate $(X,Y)$ with that density, first simulate $X$ with the appropriate marginal distribution, then simulate $Y$ conditioned on $X=x$.

The marginal cdf for $X$ is, for $0\le t\le 1$, $$ F(t) = P(X\le t) = \int_0^t \int_0^{1-x} 6x\,dy\,dx = 3t^2 - 2t^3 $$ so you first need to simulate a random variable with that cdf. An easy way to do this is to use $F^{-1}(U)$, where $U\sim\text{Unif}(0,1)$.

Conditioned on $X=x$, $Y$ is uniformly distributed over the interval $[0,1-x]$, so once you have $X$, pick $Y$ in that fashion.