0
$\begingroup$

Suppose $X, Y_i$ for $i=1...n$ are standard normal variable but are also correlated so collectively they come from a multivariate normal distribution.

Now the complication is what if I want to generate the values of $Y_i$ given $X$? For case where $n=1$ it can be shown that $Y_1|X \sim \mathcal{N}(\rho X,1-\rho^2)$ where $\rho = \text{cov}(X,Y)$.

For large $n$ it's quite tricky to derive $Y_i|X$.

Is there a package in R that can do this simulation (via copula, multivariate normal or any other mean) already?

$\endgroup$
  • 2
    $\begingroup$ The statement "the marginals are normal and the variables are correlated" doesn't imply you have multivariate normal, so the conclusion in the statement "$X,Y_i$ for $i=1,...,n$ are standard normal variable but are also correlated so collectively they come from a multivariate normal distribution." is not correct. You can state/assume multivariate normality but it doesn't follow from those conditions. $\endgroup$ – Glen_b -Reinstate Monica Aug 12 '15 at 6:56
2
$\begingroup$

The conditional distribution is normal.

Let $$(X, Y_1, \dots, Y_n) \sim \mathcal N\left( \begin{bmatrix}\mu_X\\\mu_Y\end{bmatrix}, \begin{bmatrix}\Sigma_X & \Sigma_{XY} \\ \Sigma_{XY}^T & \Sigma_Y\end{bmatrix} \right) .$$ Then $$ (Y_1, \dots, Y_n \mid X = x) \sim \mathcal N\left( \mu_Y + \Sigma_{XY}^T \Sigma_X^{-1} (x - \mu_X), \Sigma_Y - \Sigma_{XY}^T \Sigma_X^{-1} \Sigma_{XY} \right) .$$

$\endgroup$
  • $\begingroup$ What Dougal has written is correct. However, actually computing this in a numerically stable manner if $$\ \Sigma_X^{-1} \,$$ is ill-conditioned is extremely tricky business. $\endgroup$ – Mark L. Stone Aug 12 '15 at 14:49
  • $\begingroup$ @MarkL.Stone In this particular case, $\Sigma_X$ is $1 \times 1$, so it's not an issue; but yes, in general some care is necessary. $\endgroup$ – Dougal Aug 12 '15 at 22:48
  • $\begingroup$ It's not obvious to me that the OP is only interested in the 1 dimensional X case. Believe me, going from a textbook formula to actual computing can be anything but routine with these Schur Complement thingies. If you have a 1 dimensional Y and greater than 1 dimensional X, the numerical issues can be brutal. Could be time to break out the octuple precision. $\endgroup$ – Mark L. Stone Aug 13 '15 at 1: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.