2
$\begingroup$

I have three random variables: $X_1$, $X_2$ and $Y$ such that $X_1$ and $X_2$ are independent and $Y = X_1 \times X_2$. I think that either this question is trivial or I'm making a rookie error, but I'm not sure which.

I have samples of $X_1$ and $X_2$ as two vectors. If I multiply these vectors point-wise, does this give me a sample of $Y$? If not, how can I obtain such a sample?

I'm also interested in more general cases where $Y = f(X_1,X_2,\dots, X_n)$, for some function $f$ where samples of the $X_i$ are given.

$\endgroup$
2
$\begingroup$

The answer you have given yourself is correct, yes, this is trivial.

For the sake of completeness: Let $f$ be a function of two arguments, $X_1, X_2$ be two independent random variables. Define the random variable $Y$ by $Y=f(X_1, X_2)$. Then to simulate a sample of independent realization of $Y$, simulate first independent realizations of $X_1$, then independent from that, a sample of independent realizations from $X_2$ and then use $f$ to compute $Y$. A simple example in R:

N <- 1000
X_1 <- rnorm(N)
X_2 <- rexp(N)
f  <-  function(x_1,x_2) x_1 * x_2
Y  <-  f(X_1, X_2)
$\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.