
Provides random covariance/correlation matrices for quick tests. Should not be used for statistics or hypothesis testing.
RandomMatrix(
num.traits,
num.matrices = 1,
min.var = 1,
max.var = 1,
variance = NULL,
ke = 10^-3,
LKJ = FALSE,
shape = 2
)
Returns either a single matrix, or a list of matrices of equal dimension
Number of traits in random matrix
Number of matrices to be generated. If greater than 1, a list is returned.
Lower value for random variance in covariance matrices
Upper value for random variance in covariance matrices
Variance vector. If present will be used in all matrices
Parameter for correlation matrix generation. Involves check for positive definiteness
logical. Use LKJ distribution for generating correlation matrices.
Shape parameter for the LKJ distribution. Values closer to zero leads to a more uniform distribution correlations. Higher values lead to correlations closer to zero.
Diogo Melo Edgar Zanella
# single 10x10 correlation matrix
RandomMatrix(10)
# single 5x5 covariance matrix, variances between 3 and 4
RandomMatrix(5, 1, 3, 4)
# two 3x3 covariance matrices, with shared variances
RandomMatrix(3, 2, variance= c(3, 4, 5))
# large 10x10 matrix list, with wide range of variances
RandomMatrix(10, 100, 1, 300)
Run the code above in your browser using DataLab