rspd_matrix: rspd_matrix

Description Usage Arguments Value Examples

View source: R/gen.rspd_matrix.R

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

1
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

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

ROOPSD documentation built on Aug. 26, 2020, 5:15 p.m.

Related to rspd_matrix in ROOPSD...