2
$\begingroup$

I'm reviewing simulation methods, and I've come across a problem on simulating a joint distribution, where I'm unsure of on how to proceed.

Problem: Let $X$ and $Y$ be random variables with $f(x) = \frac{1}{x^2 - x}$, $x = 2,3,4,5, \dots$ and $Y \sim \text{Exponential}(\lambda = x)$. Create an algorithm to simulate the vector (X,Y).

So far: A hint was to use the inverse transform method (ITM) on $X$ first. To find $F(x)$:

$$F(x) = \sum\limits_{i=2}^n \frac{1}{i^2 - i} = \frac{n-1}{n}.$$

Let $U \sim \text{Uniform}(0,1)$. Then $F^{-1}(U) = n = \frac{1}{1-U}$. So, we can simulate $X$ with

  1. Generate $U \sim \text{Uniform}(0,1)$.
  2. Set $X = \frac{1}{1-U}$.

However, I'm not entirely sure how this helps. Don't we need to find the joint cdf? I know how to simulate $Y$ using the ITM separately too...

$\endgroup$
  • 1
    $\begingroup$ Once you simulate $X$, draw a random value $Y$ from the Exponential distribution with parameter $\lambda = X$. $\endgroup$ – awkward Sep 15 '17 at 14:30
  • 1
    $\begingroup$ Should it be $f(x) = \frac{1}{x^2-x},$ for $x = 2, 3, 4...?$. Also if $U^\prime \sim \mathsf{Unif}(0,1),$ then $U = 1-U^\prime \sim \mathsf{Unif}(0,1),$ so you can use $Y = -\ln U.$ to get $Y \sim \mathsf{Exp}(1).$ $\endgroup$ – BruceET Sep 16 '17 at 0:49
1
$\begingroup$

Your procedure won't give a valid sample of $X$ ($\frac{1}{1-U}$ will not be an integer with probability 1).

In order to generate a sample from $X$, let $F(x) = P(X \leq x)$ be the CDF of $X$. Generate a sample from the (continuous) uniform distribution $U$ on the interval [0,1]. Then, generate your sample of $X$, $x$, to be the smallest value in $2, 3, 4, \ldots$ such that $U \leq F(x)$. You can calculate this value of $x$ easily from the closed form of CDF you have, along with appropriate rounding.

In other words, we re-define the inverse CDF a bit to be $F^{-1}(u) = \min \{x: F(x) \geq u\}$. Then, we see that $F^{-1}(U)$ where $U$ is Uniform[0,1] is distributed as $X$, even if $X$ is discrete valued (you can see this definition of $F^{-1}$; for a continuous distribution given by $F$, this agrees with the usual definition of inverse).

Then, take your sample of $X$, $x$, and generate an exponential random variable $Y$. By inverse transform sampling, you can do this by generating a Uniform[0,1] random variable $V$, and outputing a sample of $Y$ an $-\frac{\log V}{x}$.

$\endgroup$
  • $\begingroup$ For your method for simulating $X$ first, is this still the ITM in a traditional sense though? Seems that we cannot simply let $X = F^{-1}(U)$ for this case. Instead, we use the method as you have presented, which works perfect. $\endgroup$ – user334916 Sep 16 '17 at 6:30
  • 1
    $\begingroup$ @user334916 - Well, you normally say inverse transform for continuous distributions. The "in other words" paragraph gives you a generalized inverse CDF, which works for both continuous and discrete random variables. It handles places where the CDF is flat. So it agrees with inverse transform method. $\endgroup$ – Batman Sep 16 '17 at 6:38

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.