Re: [R] how to generate a random correlation matrix with restrictions

2009-08-31 Thread Giovanni Petris
So, you want about 10% of the correlations to be greater than 0.9. And what about the others? It would be helpful to know why you need this kind of matrix and what you are going to do with it. Here is an attempt, based on generating a random variance matrix from a Wishart distribution and transf

Re: [R] how to generate a random correlation matrix with restrictions

2009-08-31 Thread Kornelius Rohmeyer
produce a valid correlation matrix is: > > > > > > R <- matrix(runif(36), ncol=6) > > > > > > RtR <- R %*% t(R) > > > > > > Q <- cov2cor(RtR) > > > > > > But this does not have the property that the correlations are > > unif

Re: [R] how to generate a random correlation matrix with restrictions

2009-08-29 Thread Ravi Varadhan
email: rvarad...@jhmi.edu - Original Message - From: Kingsford Jones Date: Saturday, August 29, 2009 7:43 pm Subject: Re: [R] how to generate a random correlation matrix with restrictions To: Ravi Varadhan Cc: Ning Ma , r-help@r-project.org > Thanks Ravi -- with my limited linear

Re: [R] how to generate a random correlation matrix with restrictions

2009-08-29 Thread Kingsford Jones
ations are uniformly > distributed. > > Hope this helps, > Ravi. > > > > Ravi Varadhan, Ph.D. > Assistant Professor, > Division of Geriatric Medicine and Gerontology > School of Medicine > Johns Hopki

Re: [R] how to generate a random correlation matrix with restrictions

2009-08-28 Thread Ravi Varadhan
edicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: Kingsford Jones Date: Friday, August 28, 2009 10:12 pm Subject: Re: [R] how to generate a random correlation matrix with restrictions To: Ning Ma Cc:

Re: [R] how to generate a random correlation matrix with restrictions

2009-08-28 Thread Kingsford Jones
Ahh -- Mark Leeds just pointed out off-list that it was supposed to be a correlation matrix. Perhaps R <- matrix(runif(1), ncol=100) R <- (R * lower.tri(R)) + t(R * lower.tri(R)) diag(R) <- 1 These are of course uniformly distributed positive correlations. Kingsford On Fri, Aug 28, 2009 a

Re: [R] how to generate a random correlation matrix with restrictions

2009-08-28 Thread Kingsford Jones
R <- matrix(runif(1), ncol=100) hth, Kingsford Jones On Fri, Aug 28, 2009 at 7:26 PM, Ning Ma wrote: > Hi, > > How can I generate a random 100x100 correlation matrix, R={r_ij}, > where about 10% of r_ij are greater than 0.9 > > Thanks in advance. > >

[R] how to generate a random correlation matrix with restrictions

2009-08-28 Thread Ning Ma
Hi, How can I generate a random 100x100 correlation matrix, R={r_ij}, where about 10% of r_ij are greater than 0.9 Thanks in advance. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide htt