1
$\begingroup$

I have a distribution who's moment generating function is the product of two exponentially distributed variables moment generating functions. If I wanted to generate samples from the distribution, would it be appropriate to generate a random sample from the exponential distribution and multiply it by two? For clarification the PDF is below:

$$f(x) = \lambda^2 x\cdot exp(-\lambda x), x \geq 0 $$

The MGF calculated for this PDF was:

$$M(t) = \lambda^2/(\lambda - t)^2$$

$\endgroup$
  • $\begingroup$ Could you please add the MGF's expression to the question ? $\endgroup$ – ippiki-ookami Aug 13 '18 at 8:00
1
$\begingroup$

The exponential distribution has the scaling property. If $X \sim exp(\lambda)$, then $k \cdot X \sim exp(\lambda/k)$ for any $k > 0$, in particular $k = 2$, and the pdf of $exp(\lambda/2)$ is not equal to the expression you are giving, so the answer to your question is no.

$\endgroup$
0
$\begingroup$

The moment generating function of the sum of two independent random variables is the product of their individual moment generating functions: $$E\left[e^{(X+Y)t}\right] =E\left[e^{Xt}e^{Yt}\right] =E\left[e^{Xt}\right]E\left[e^{Yt}\right]$$

so just generate two samples from an exponential random variable with parameter $\lambda$ and add them together

This is not the same as generating one sample and multiplying it by $2$

$\endgroup$
  • $\begingroup$ When i do this and calculate probabilities of the samples as they fall within equi-spaced intervals, i get the probabilities of all the intervals being equal. Albeit the intervals are 7.6801e-04 length, are you able to shed any insight into why this is? Cheers. $\endgroup$ – Matt_G Aug 13 '18 at 8:43
  • $\begingroup$ @Matt_G - the probability density function will have the same shape as the orange $(k=2)$ curve at en.wikipedia.org/wiki/Erlang_distribution#/media/… though the scale will depend on the reciprocal of $\lambda$ $\endgroup$ – Henry Aug 13 '18 at 9:33
0
$\begingroup$

Exponential distribution. If $X \sim \mathsf{Exp}(rate = \lambda),$ then its PDF is $f_X(x) = \lambda e^{-\lambda t},$ for $t,\lambda > 0.$ Its MGF is $m_X(t) = \frac{\lambda}{\lambda - t},$ for $t > 0.$ The CDF is $F_X(x) = 1 - e^{-\lambda t},$ for $t > 0.$

Gamma distribution. If $X_1$ and $X_2$ are independent random variables distributed as $\mathsf{Exp}(rate = \lambda),$ then $Y = X_1 + X_2 \sim \mathsf{Gamma}(shape = 1, rate = \lambda),$ with PDF $f_Y(y) = \lambda^2 y e^{-\lambda t},$ for $y, \lambda > 0.$ The MGF is the square of the exponential MFG $m_Y(t) = (\frac{\lambda}{\lambda - t})^2,$ for $t > 0.$

The quantile method of generating an exponential random variable. If $U^\prime \sim \mathsf{Unif}(0,1),$ then setting $U = F_X(X)$ and solving for $X$ in terms of $U^\prime,$ we have $X = -\log(1-U^\prime)/\lambda.$

Most pseudorandom number generators produce output that is (for practical purposes) indistinguishable from $U \sim \mathsf{Uniform}(0,1).$ So we can generate $X \sim \mathsf{Exp}(\lambda)$ as $X = -\log(U)/\lambda,$ because if $U^\prime \sim \mathsf{Unif}(0,1),$ then also $U = 1 - U^\prime \sim \mathsf{Unif}(0,1).$ This is called the 'inverse CDF' or 'quantile' method of generating an exponential random variable.

Generating gamma random variables. Then finally, you can generate a sample of size $n=2$ from an exponential distribution with rate $\lambda = .2,$ and then add them to generate a gamma random variable, according to the following statement in R statistical software:

u = runif(2);  y = sum(-log(u)/.2)

The object u is a vector of realizations of two standard uniform random variables. The object y is a sample of size 1 from a gamma distribution. Exponential and gamma distributions are programmed into R, so y could be generated as y = rgamma(1, 2, .2), but that shortcut wouldn't illustrate the method of your Question.

Simulating a gamma distribution. Replicating this $m = 10,000$ times, we can simulate the a random sample of $m$ random variables $Y \sim \mathsf{Gamma}(2, \lambda):$

n = 2;  m = 10^4;  lam = .2
y = replicate(m, sum(-log(runif(n))/lam)) 
hdr = "Simulated Dist'n of GAMMA(2, .2) with PDF"
hist(y, br=40, prob=T, col="skyblue2", main=hdr)
  curve(lam^2*x*exp(-lam*x), 0, 80, add=T, lwd=2, col="blue")
  abline(h=0, col="green3"); abline(v=0, col="green3")

enter image description here

Note: Most of the information about exponential and gamma PDF, MGF, and CDF (and some of the information about generating a gamma sample) can be found in Wikipedia articles about those distributions. Because you asked about generating gamma random variables, I suppose information on that is also contained in your textbook or class notes.

$\endgroup$

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.