Correlated random variables from mixture distributions Let I have three random variables whose density is a mixture of two Normals with these parameters:


*

*$\mu_{1,1}=6.8$, $\mu_{1,2}=6.95$, $\sigma_{1,1}=0.065$, $\sigma_{1,2}=0.055$ and $\alpha_{1}=0.4$

*$\mu_{2,1}=5.7$, $\mu_{2,2}=5.92$, $\sigma_{2,1}=0.08$, $\sigma_{2,2}=0.09$ and $\alpha_{2}=0.3$

*$\mu_{3,1}=4.9$, $\mu_{3,2}=5.01$, $\sigma_{3,1}=0.04$, $\sigma_{3,2}=0.1$ and $\alpha_{3}=0.2$
$\alpha_{i}$ is the weight of the first density for variable $i$.
Moreover, I know that those random variables have this correlation matrix (I know it's positive semi-definite, you can change it for numerical examples purposes):
$$\textbf{P}=\begin{bmatrix} 1 & 0.3 & -0.4 \\ 0.3 & 1 & -0.1 \\ -0.4 & -0.1 & 1  \end{bmatrix}$$
I would like to generate correlated random numbers from those mixtures. If you could provide R code, this would be a strong plus.
 A: This answer applies to the case when the mixture weights are the same for all three coordinates. [I have no idea about a solution in the general case.]
You need to identify a three dimensional Normal mixture which global covariance matrix is Q. This means finding $\mathbf{Q}_1$ and $\mathbf{Q}_2$ such that
$$\alpha(\mathbf{Q}_1+\mu_{\cdot 1}\mu_{\cdot 1}^\text{T})+
(1-\alpha)(\mathbf{Q}_2+\mu_{\cdot 1}\mu_{\cdot 2}^\text{T})=
\mathbf{Q}+(\alpha\mu_{\cdot 1}+(1-\alpha)\mu_{\cdot 2})(\alpha\mu_{\cdot 1}+(1-\alpha)\mu_{\cdot 2})^\text{T})$$
The number of unknowns in this equation are 3 correlations in $\mathbf{Q}_1$ and 3 correlations in $\mathbf{Q}_2$, since the diagonal terms are given by the marginal Normals. Hence there is a range of choices, provided $\mathbf{P}$ is an achievable correlation matrix for a mixture.
Generating from a multivariate Normal mixture is straightforward: select the component with probability $\alpha$ versus $1-\alpha$ and generate the associated multivariate Normal.
