# [R] Help : generating correlation matrix with a particular structure

Gabor Grothendieck ggrothendieck at myway.com
Sun Dec 12 16:30:32 CET 2004

```Siew Leng TENG <siewlengteng <at> yahoo.com> writes:

:
: Hi,
:
: I would like to generate a correlation matrix with a
: particular structure. For example, a 3n x 3n matrix :
: A_(nxn)   aI_(nxn)  bI_(nxn)
: aI_(nxn)  A_(nxn)   cI_(nxn)
: aI_(nxn)  cI_(nxn)  A_(nxn)
:
: where
: - A_(nxn) is a *specified* symmetric, positive
: definite nxn matrix.
: - I_(nxn) is an identity matrix of order n
: - a, b, c are (any) real numbers
:
: Many attempts have been unsuccessful because a
: resulting matrix with any a, b, c may not be a
: positive definite one, and hence cannot qualify as a
: correlation matrix. Trying to first generate a
: covariance matrix however, does not guarantee a
: corresponding correlation matrix with the above
: structure.
:
: My larger purpose is to use this correlation matrix to
: generate multivariate normal observations from the
: corresponding covariance matrix (derived via cholesky
: decomposition of the cor matrix).

This can be formulated a semidefinite programming problem.
I don't think R has any packages that do that but a google