I am supposed to use rexp()
in R to draw from an exponential distribution with mean 1, and then use those draws to generate 1000 draws from each of the following:
- a $\chi^2$ distribution with 4 degrees of freedom
- a $\text{Beta}(2,3)$ distribution.
I assume once the theory is understood this is a trivial task, but I might be wrong. I have been looking at the "Related Distributions" section of Wikipedia for the chi-squared, gamma, exponential and beta distributions and there are some interesting tidbits there that make me think this is doable, but I'm not sure how to put the pieces together.
Edit:
I have added the self-study tag. Regarding Glen_b's comment:
Various connections that seem potentially promising:
If $X \sim \chi_2^2$, then $X \sim \text{Exp}(1/2)$. Seems close to being helpful, but the wrong parametrization. Could this be manipulated into something useful?
Related to the above, if $X \sim \text{Exp}(\lambda)$, then $kX \sim \text{Exp}(\lambda/k)$. So if I let $k = 1/2$ and then applied this above, I could get an $\text{Exp}(1)$ random variable. But how would this affect the $\chi_2^2$ part?
If $X \sim \text{Exp}(\lambda)$, then, then $e^{-X} \sim \text{Beta}(\lambda, 1)$. Again, something that looks like it could be handy, but wrong parametrization.
$\sum_{i = 1}^n \text{Exp}(\lambda) \sim \frac{1}{2\lambda} \chi_{2n}^2$. So if I understand this correctly, if I generated 2000 draws from $\text{Exp}(1)$ and then added the first and second, third and fourth and so on, and then multiplied all of those 1000 sums by 2, then I'd have 1000 $\chi_4^2$ draws?
If $X \sim \text{Gamma}(\alpha, \theta)$ and $Y \sim \text{Gamma}(\beta, \theta)$, and they're independent, then $\frac{X}{X + Y} \sim \text{Beta}(\alpha, \beta)$. Wrong parametrization again. Maybe if I drew 5000 times from $\text{Exp}(1)$ and added the first 2000 in pairs and the last 3000 in triples, and then computed 1000 quotients?
If $X \sim \chi^2 (\alpha)$ and $Y \sim \chi^2 (\beta)$ are independent, then $\frac{X}{X + Y} \sim \text{Beta}(\alpha/2, \beta/2)$. Seems like 5 above might be a better bet? Not sure.
Edit 2:
To try to clarify a couple things, I need to do what I wrote at the top of this post. I can't use another method, as far as I know. Second, regarding "wrong parametrization", I might be mistaken but I meant that, for example, point 1 in the list above relates the exponential and chi-squared distributions, but I need to somehow turn $\text{Exp}(1)$ into $\chi_4^2$ (and into $\text{Beta}(2, 3)$, so some of what I've written above looks like "close but no cigar".
My current thinking is that points 4 and 5 in the list make the most sense. For point 4, I could draw 2000 times from $\text{Exp}(1)$ and then add the 2000 numbers in pairs, which would give me 1000 numbers from $\frac{1}{2}\chi_4^2$, so I just have to scale all the 1000 numbers by 2 and then that should be done.
For point 5, $\text{Exp}(1) = \text{Gamma}(1, 1)$, and if the exponential random variables are independent, then $\sum_{i = 1}^n \text{Exp}(1) \sim \text{Gamma}(n, 1)$. This means that by drawing 5000 times from $\text{Exp}(1)$, and making 1000 sums of 2 and 1000 sums of 3, I can make 1000 $\text{Gamma}(2)$ and 1000 $\text{Gamma}(3)$ random variables, and then applying 5. I can turn those into 1000 $\text{Beta}(2,3)$ random variables.
So unless I've misunderstood something, I've (we've) figured it out. Thanks.