"Troels Ring" <tring at mail1.stofanet.dk> writes:
> I've forgotten how to simulate data with a known correlation,
> e.g. only two columns. I'd be most pleased to be told.
Assuming that you want data from a multivariate normal distribution
with a given correlation, install the MASS package and use mvrnorm.
> library(MASS)
> example(mvrnorm)
mvrnrm> Sigma <- matrix(c(10, 3, 3, 2), 2, 2)
mvrnrm> Sigma
[,1] [,2]
[1,] 10 3
[2,] 3 2
mvrnrm> var(mvrnorm(n = 1000, rep(0, 2), Sigma))
[,1] [,2]
[1,] 9.870587 2.764234
[2,] 2.764234 1.840870
Note that as of version 0.90.1 you can get the MASS, nnet, spatial,
and class libraries in a single bundle with
install.packages("VR") # packages from the Venables and Ripley
bundle
You do need to set the CRAN option to a legitimate CRAN archive site,
have access to the Internet, and have either the wget or lynx programs
on your search path.
The default for options("CRAN") is cran.r-project.org. You may want
to use cran.dk.r-project.org, the Danish mirror, instead.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._