In R, I like to create a set of variables that are correlated with a given variable.I scanned related questions but failed to find the same issue i have.
Here is instance.
x<-rnorm(100, mean=3,sd=1.2)
x<-rnorm(100, mean=3,sd=1.2)
Assuming x$x$ is an exiting variable, I like to generate z, y, t$z, y, t$ correlated variables with 4$4$ by 4$4$ correlation matrix.
So, variables y, t, z$y, t, z$ would correlate x$x$ according to predefined correlation matrix iI will use as an input. It would be grateful if you leave a comment on me with a specific code.