View source: R/gen.rspd_matrix.R
rspd_matrix | R Documentation |
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.
rspd_matrix(d, n = 1, sort_eigenvalues = TRUE, gen = stats::rexp)
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 |
[array or matrix], dim = d * d * n or d * d if n == 1
mean = stats::runif( n = 2 , min = -5 , max = 5 )
cov = ROOPSD::rspd_matrix(2)
X = ROOPSD::rmultivariate_normal( 10000 , mean , cov )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.