Sample random variables X and Y from a joint distribution.

probabilityprobability distributionsrandom variablessamplingsimulation

I have the following joint distribution function $f(x,y)$:

$$f(x,y)=\begin{cases}
\frac{1}{30}xy+\frac{x}{y^2} & \text{ for } 1\le y\le 4,\ 1/2\le x\le 3/2\\
0 & \text{ otherwise.}
\end{cases}$$

The task is to simulate $N$ samples programatically, of $X$ and $Y$ to compute $E(X)$, $E(Y)$, $Var(X)$ and $Var(Y)$.

So far, I have tried the following steps:

  1. Calculate the joint CDF from the above PDF.
  2. Use some multi-variate Inverse transform sampling
  3. And then from the samples of X an Y, calculate sample mean and variance.

I need to know what inverse transform I can use for this PDF and how I can go about calculating sample mean and variance from the samples of X and Y. That is to say, if my approach is not entirely wrong.

Best Answer

Update: I just noticed that your $X$ and $Y$ are independent, so you may very well generate them separately.

Hint: In the general case, I would use conditional formula:

$$f_{X,Y}(x,y)=f_{X|Y}(x|y)\cdot f_Y(y)$$

So I would generate first a random variable distributed as one of the marginals, and then generate the other one with conditional distribution.

Related Question