You didn't say how you want these variables to be distributed, but in case you want a multivariate normal, then have a look at function mvrnorm() from package MASS, and especially at the 'empirical' argument, e.g.,
library(MASS) # assumed covariance matrix V <- cbind(c(2, 1), c(1, 1.2)) V x1 <- mvrnorm(1000, c(0,0), V, empirical = FALSE) var(x1) x2 <- mvrnorm(1000, c(0,0), V, empirical = TRUE) var(x2) I hope it helps. Best, Dimitris On 1/28/2013 7:11 AM, Simon Givoli wrote: > Hi! > > I want to create a random matrix with 15 variables, each variable having > 1000 observations. > Between each two variables, I want to define a specific (*not *random) > correlations between them, but still saving the "randomness" of each > variable (mean=zero, s.d=1). > How can I do this in R? > > thanks, > Simon > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Dimitris Rizopoulos Assistant Professor Department of Biostatistics Erasmus University Medical Center Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands Tel: +31/(0)10/7043478 Fax: +31/(0)10/7043014 Web: http://www.erasmusmc.nl/biostatistiek/ ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.