This function can generate correlation matrices randomly or deterministically,
depending on the combination of arguments provided. A single matrix will be
generated when nclusters == 1
(the default), and a list of matrices of matrices will be generated when
nclusters > 1
.
If the vector `cors` is specified with length `nvars - 1` then `corstr` must be "structured". If
`cors` is specified with length `choose(nvars, 2)` then `corstr` should not be specified as
"structured". In this case the `cors` vector should be interpreted as the lower triangle of the correlation
matrix, and is specified by reading down the columns. For example, if CM is the correlation matrix and
nvars = 3
, then CM[2,1] = CM[1,2] = cors[1]
, CM[3,1] = CM[1,3] = cors[2]
,
and CM[3,2] = CM[2,3] = cors[3]
.
If the vector cors
and rho
are not specified, random correlation matrices are generated
based on the specified corstr
. If the structure is "arx", then a random vector of
length nvars - 1
is randomly generated and sorted in descending order; the correlation matrix
will be generated base on this set of structured correlations. If the structure is not specified
as "arx" then a random positive definite of dimensions nvars x nvars with no structural
assumptions is generated.
If cors
is not specified but rho
is specified, then a matrix with either a "cs" or "ar1"
structure is generated.
If nclusters > 1
, nvars
can be of length 1 or nclusters
. If it is of length 1,
each cluster will have correlation matrices with the same dimension. Likewise, if nclusters > 1
,
rho
can be of length 1 or nclusters
. If length of rho
is 1,
each cluster will have correlation matrices with the same autocorrelation.