RandomMatrix {evolqg}R Documentation

Random matrices for tests

Description

Provides random covariance/correlation matrices for quick tests. Should not be used for statistics or hypothesis testing.

Usage

RandomMatrix(
  num.traits,
  num.matrices = 1,
  min.var = 1,
  max.var = 1,
  variance = NULL,
  ke = 10^-3,
  LKJ = FALSE,
  shape = 2
)

Arguments

num.traits

Number of traits in random matrix

num.matrices

Number of matrices to be generated. If greater than 1, a list is returned.

min.var

Lower value for random variance in covariance matrices

max.var

Upper value for random variance in covariance matrices

variance

Variance vector. If present will be used in all matrices

ke

Parameter for correlation matrix generation. Involves check for positive definiteness

LKJ

logical. Use LKJ distribution for generating correlation matrices.

shape

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.

Value

Returns either a single matrix, or a list of matrices of equal dimension

Author(s)

Diogo Melo Edgar Zanella

Examples

# 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)

[Package evolqg version 0.3-4 Index]