Learn R Programming

gaston (version 1.2)

random.pm: Random square definite positive matrix

Description

Generate a random definite positive matrix with specified dimension

Usage

random.pm(n, values = n*diff(seq(0,1,length=n+1)**0.75))

Arguments

Value

A named list with members:KA n x n symmetric positive matrixeigenThe eigen decomposition of K as eigen(K) would output it

Details

The default for values is chosen so that the eigenvalues of the resulting matrix are roughly similar to the eigenvalues typically observed on Genetic Relationship Matrices.

See Also

lmm.simu, eigen

Examples

Run this code
# generate a random positive matrix 
set.seed(1)
R <- random.pm(503)
str(R)

Run the code above in your browser using DataLab