rcov: Generate a random covariance matrix

Description Usage Arguments Value Examples

View source: R/stats.R

Description

Generate a random covariance matrix

Usage

1
2
rcov(n, size, regularization = 1, concentration = 1, tau_shape = 1,
  tau_scale = 1, trace = size)

Arguments

n

Number of random matrices to generate

size

Number of columns/variances in a covariance matrix.

regularization

Positive scalar. Controls correlation strength. 1 is uniform over correlation matrices. Greater than 1 has weaker correlations.

concentration

Positive scalar. Controls the spread of proportions of the total variance. 1 is uniform, less than 1 creates heterogeneity, greater than 1 makes variances homogeneous.

tau_shape

Positive scalar. Controls total variance. Shape of a gamma distribution, defaults to exponential. Influences dispersion around mean variance.

tau_scale

Positive scalar. Controls total variance. Scale of a gamma distribution, defaults to exponential. sqrt(sum(diagonal)) if tau_shape=1 and trace=1.

trace

Positive scalar. Total variance or the sum of variances on the diagonal

Value

A covariance matrix or a three-dimensional array of matrices if n>1

Examples

1
rcov(n=5, size=4, trace=10)

iamamutt/mejr documentation built on May 18, 2019, 1:27 a.m.