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
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
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,
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
4 matches
Mail list logo