genPositiveDefMat: GENERATE A POSITIVE DEFINITE MATRIX/COVARIANCE MATRIX

Description Usage Arguments Details Value Author(s) References Examples

Description

Generate a positive definite matrix/covariance matrix.

Usage

1
2
genPositiveDefMat(dim, covMethod=c("eigen", "onion", "c-vine", "unifcorrmat"), 
                  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.

alphad

parameter for unifcorrmat method to generate random correlation matrix alphad=1 for uniform. alphad should be positive.

eta

parameter for “c-vine” and “onion” methods to generate random correlation matrix eta=1 for uniform. eta should be positive.

rangeVar

Range for variances of a covariance matrix (see details). The default range is [1, 10] which can generate reasonable variability of variances.

lambdaLow

Lower bound on the eigenvalues of cluster covariance matrices. If the argument covMethod="eigen", eigenvalues are generated for cluster covariance matrices. The eigenvalues are randomly generated from the interval [lambdaLow, lambdaLow*ratioLambda]. In our experience, lambdaLow=1 and ratioLambda=10 can give reasonable variability of the diameters of clusters. lambdaLow should be positive.

ratioLambda

The ratio of the upper bound of the eigenvalues to the lower bound of the eigenvalues of cluster covariance matrices. See lambdaLow.

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 (λ_1,…,λ_p) for the covariance matrix (\boldsymbol{Σ}), then uses columns of a randomly generated orthogonal matrix (\boldsymbol{Q}=(\boldsymbol{α}_1,…,\boldsymbol{α}_p)) as eigenvectors. The covariance matrix \boldsymbol{Σ} is then contructed as \boldsymbol{Q}*diag(λ_1,…,λ_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 (σ_1^2,…,σ_p^2) from an interval specified by the argument rangeVar. The covariance matrix \boldsymbol{Σ} is then constructed as diag(σ_1,…,σ_p)*\boldsymbol{R}*diag(σ_1,…,σ_p).

Value

egvalues

eigenvalues of Sigma

Sigma

positive definite matrix/covariance matrix

Author(s)

Weiliang Qiu [email protected]
Harry Joe [email protected]

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

1
2
genPositiveDefMat("unifcorrmat",dim=4)
genPositiveDefMat("eigen",dim=5)

Example output

Loading required package: MASS
$egvalues
[1] 10.746987  6.232604  4.129706  2.293110

$Sigma
           [,1]       [,2]       [,3]       [,4]
[1,]  9.4274269  0.3092297 -2.3441972  0.7250117
[2,]  0.3092297  5.7850808 -1.1825272 -0.1196206
[3,] -2.3441972 -1.1825272  5.7831827  0.0907594
[4,]  0.7250117 -0.1196206  0.0907594  2.4067163

$egvalues
[1] 4.322530 9.494386 4.939277 9.667542 2.354737

$Sigma
           [,1]       [,2]       [,3]       [,4]       [,5]
[1,]  6.6407929 -1.2679238  0.2059297 -2.2202423  2.3259832
[2,] -1.2679238  8.4464392 -0.1978651 -1.7783606 -0.2486767
[3,]  0.2059297 -0.1978651  4.9533973 -0.3437042  0.2567109
[4,] -2.2202423 -1.7783606 -0.3437042  6.6508938 -0.4687683
[5,]  2.3259832 -0.2486767  0.2567109 -0.4687683  4.0869479

clusterGeneration documentation built on May 2, 2019, 6:53 a.m.