rspd_matrix {ROOPSD}R Documentation

rspd_matrix

Description

Generate a random symetric positive definite matrix. The generator just draw matrix of the form O * diag(positive values) * t(O), where O is an orthogonal matrix from ROOPSD::rorthogonal_group. Note that the parameter gen = stats::rexp draw positive eigen values, but the code do not control if eigen values are positive. So you can accept negative eigen values using another generators.

Usage

rspd_matrix(d, n = 1, sort_eigenvalues = TRUE, gen = stats::rexp)

Arguments

d

[integer] Dimension of the matrix

n

[integer] numbers of samples drawn

sort_eigenvalues

[bool] If eigen values (i.e. variance) are sorted

gen

[function] Eigenvalues generator

Value

[array or matrix], dim = d * d * n or d * d if n == 1

Examples

mean = stats::runif( n = 2 , min = -5 , max = 5 )
cov  = ROOPSD::rspd_matrix(2)
X    = ROOPSD::rmultivariate_normal( 10000 , mean , cov )


[Package ROOPSD version 0.3.9 Index]