Re: [R] Generate multivariate normal data with a random correlation matrix

2011-02-10 Thread rex.dwyer
011 11:30 AM To: r-help@r-project.org Cc: Rick DeShon Subject: Re: [R] Generate multivariate normal data with a random correlation matrix The knee jerk thought I had was to express the correlation matrix as a generic Choleski decomposition, then randomly populate the triangular decomposed ma

Re: [R] Generate multivariate normal data with a random correlation matrix

2011-02-10 Thread Rick DeShon
011 11:30 AM > To: r-help@r-project.org > Cc: Rick DeShon > Subject: Re: [R] Generate multivariate normal data with a random correlation > matrix > > The knee jerk thought I had was to express the correlation matrix as a > generic Choleski decomposition, then randomly populat

Re: [R] Generate multivariate normal data with a random correlation matrix

2011-02-09 Thread Szumiloski, John
The knee jerk thought I had was to express the correlation matrix as a generic Choleski decomposition, then randomly populate the triangular decomposed matrix. When you remultiply, you can simply rescale to 1s on the diagonals. Then rmnorm as usual. In R, see ?chol If you want to get fancy,

Re: [R] Generate multivariate normal data with a random correlation matrix

2011-02-09 Thread Eik Vettorazzi
Hi Rick, you can generate an arbitrary matrix X and calculate X'X, which is at least positive semi-definite (and definite, when X has full rank) X<-matrix(rnorm(16),4) covmat<-t(X)%*%X #check !any(eigen(covmat)$value<0) #corresponding correlation matrix cov2cor(covmat) Random multivariate can b