random.pm: Random square definite positive matrix

View source: R/random_pm.r

random.pmR Documentation

Random square definite positive matrix

Description

Generate a random definite positive matrix with specified dimension

Usage

 random.pm(n, values) 

Arguments

n

Dimension of matrix

values

(Optional) A numeric vector of dimension n : the eigenvalues of the matrix

Details

If values isn't given, it is chosen (deterministically) so that the eigenvalues of the resulting matrix are similar to eigenvalues observed on Genetic Relationship Matrices.

The random matrix is generated as U diag( values ) U' with U a random orthogonal matrix.

Value

A named list with members:

K

A n x n symmetric positive matrix

eigen

The eigen decomposition of K as eigen(K) would output it

See Also

lmm.simu, eigen

Examples

# generate a random positive matrix 
set.seed(1)
R <- random.pm(500)
str(R)

gaston documentation built on May 29, 2024, 7:33 a.m.