View source: R/random_cov_matrix.R
RandCovMtrx | R Documentation |
Generates a covariance matrix from Wishart distribution with given eigenvalues or with exponentially decreasing eigenvalues. Useful for examples and tests when an arbitrary covariance matrix is needed.
RandCovMtrx(p = 200, eigenvalues = 0.1 * exp(5 * seq_len(p)/p))
p |
dimension of the covariance matrix |
eigenvalues |
the vector of positive eigenvalues |
This function generates a symmetric positive definite covariance matrix with given eigenvalues. The eigenvalues can be specified explicitly. Or, by default, they are generated with exponential decay.
covariance matrix
p<-1e1
# A non-diagonal covariance matrix
Mtrx <- RandCovMtrx(p=p)
Mtrx
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.