genPositiveDefMat {clusterGeneration} | R Documentation |
GENERATE A POSITIVE DEFINITE MATRIX/COVARIANCE MATRIX
Description
Generate a positive definite matrix/covariance matrix.
Usage
genPositiveDefMat(
dim,
covMethod = c("eigen", "onion", "c-vine", "unifcorrmat"),
eigenvalue = NULL,
alphad = 1,
eta = 1,
rangeVar = c(1, 10),
lambdaLow = 1,
ratioLambda = 10)
Arguments
dim |
Dimension of the matrix to be generated. |
covMethod |
Method to generate positive definite matrices/covariance matrices. Choices are “eigen”, “onion”, “c-vine”, or “unifcorrmat”; see details below. |
eigenvalue |
numeric. user-specified eigenvalues when |
alphad |
parameter for unifcorrmat method to generate random correlation matrix
|
eta |
parameter for “c-vine” and “onion” methods to generate random correlation matrix
|
rangeVar |
Range for variances of a covariance matrix (see details).
The default range is |
lambdaLow |
Lower bound on the eigenvalues of cluster covariance matrices.
If the argument |
ratioLambda |
The ratio of the upper bound of the eigenvalues to the lower bound of the
eigenvalues of cluster covariance matrices. See |
Details
The current version of the function genPositiveDefMat
implements four
methods to generate random covariance matrices. The first method, denoted by
“eigen”, first randomly generates eigenvalues
(\lambda_1,\ldots,\lambda_p
) for the covariance matrix
(\boldsymbol{\Sigma}
), then
uses columns of a randomly generated orthogonal matrix
(\boldsymbol{Q}=(\boldsymbol{\alpha}_1,\ldots,\boldsymbol{\alpha}_p)
)
as eigenvectors. The covariance matrix \boldsymbol{\Sigma}
is then
contructed as
\boldsymbol{Q}*diag(\lambda_1,\ldots,\lambda_p)*\boldsymbol{Q}^T
.
The remaining methods, denoted as “onion”, “c-vine”, and “unifcorrmat”
respectively, first generates a random
correlation matrix (\boldsymbol{R}
) via the method mentioned and proposed in Joe (2006),
then randomly generates variances (\sigma_1^2,\ldots,\sigma_p^2
) from
an interval specified by the argument rangeVar
. The covariance matrix
\boldsymbol{\Sigma}
is then constructed as
diag(\sigma_1,\ldots,\sigma_p)*\boldsymbol{R}*diag(\sigma_1,\ldots,\sigma_p)
.
Value
egvalues |
eigenvalues of Sigma |
Sigma |
positive definite matrix/covariance matrix |
Author(s)
Weiliang Qiu weiliang.qiu@gmail.com
Harry Joe harry@stat.ubc.ca
References
Joe, H. (2006) Generating Random Correlation Matrices Based on Partial Correlations. Journal of Multivariate Analysis, 97, 2177–2189.
Ghosh, S., Henderson, S. G. (2003). Behavior of the NORTA method for correlated random vector generation as the dimension increases. ACM Transactions on Modeling and Computer Simulation (TOMACS), 13(3), 276–294.
Kurowicka and Cooke, 2006. Uncertainty Analysis with High Dimensional Dependence Modelling, Wiley, 2006.
Examples
genPositiveDefMat(
dim = 4,
covMethod = "unifcorrmat")
aa <- genPositiveDefMat(
dim = 3,
covMethod = "eigen",
eigenvalue = c(3, 2, 1))
print(aa)
print(eigen(aa$Sigma))