Re: [R] creating a multivariate set of variables with givenintercorrelations

From: Mendiburu, Felipe (CIP) <F.MENDIBURU_at_CGIAR.ORG>
Date: Sat, 19 May 2007 22:17:40 -0500

Dear Dimitri,  

if you wish single the correlations, can use the following script:  

a<-1:10
b<- rnorm(10)
c<- rbinom(10,8,0.3)
d<- rpois(10,8)

corr<-cor( cbind(a,b,c,d) )
round(as.dist(corr),2) # or only as.dist(corr)
      a      b      c
b  0.07            
c  0.19 -0.26      

d -0.16 -0.13 -0.41

regards,  

Felipe

Hi!
I was wondering if there is a package in R that allows one to create a multivariate data set with pre-specified intercorrelations among variables, e.g., a set of 4 variables (with a length of N each), such that the correlations between variables are:

     a     b     c     d
a   1     r1    r2    r3
b          1     r4    r5
c                 1     r6
d                         1

Thank you very much!
Dimitri Liakhovitski



R-help_at_stat.math.ethz.ch 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.

R-help_at_stat.math.ethz.ch 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. Received on Sun 20 May 2007 - 03:24:31 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 20 May 2007 - 09:31:30 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.