Description Usage Arguments Value Examples
Generate a correlation matrix as R = LL' where the rows of L are of length
1, L is of rank r
and the matrix L is sparse (depending on
sparse.prop
. The loadings in L are sampled from a standard normal
distribution, after which sparse.prop
is used to set a randomly
chosen number of loadings in each row equal to zero. To ensure that a
correlation matrix results, the rows are normalized.
1 | rcormat(m, r = 3L, sparse.prop = 0.5)
|
m |
integer; the number of variables. |
r |
integer; the required rank. |
sparse.prop |
the proportion of zeros in the rows of the matrix. |
A list with the following components:
R |
The sampled correlation matrix |
L |
The loading matrix |
1 2 |
Loading required package: parallel
eigen() decomposition
$values
[1] 4.910931e+00 3.620887e+00 1.468182e+00 1.988983e-16 1.569538e-16
[6] 5.550830e-17 1.420566e-17 9.510624e-18 -6.189947e-16 -8.237576e-16
$vectors
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 0.43315820 -0.14363209 -0.05142073 0.00000000 0.000000000 0.00000000
[2,] -0.43266519 0.14676419 0.04276383 0.08538672 0.006620512 -0.11536890
[3,] -0.38465009 -0.27441051 -0.02249575 0.29783823 0.366400655 -0.03835341
[4,] -0.08174528 0.44739117 -0.40635371 -0.37681123 0.448485410 0.47167230
[5,] -0.01531906 0.05638251 -0.82005437 0.45414466 -0.226616375 -0.21240230
[6,] 0.35661127 -0.31957733 -0.06213944 0.16391617 0.722740298 -0.17093473
[7,] -0.43315820 0.14363209 0.05142073 0.09812825 0.254692307 -0.10066344
[8,] -0.35189784 -0.32558531 0.07397429 -0.14422450 -0.007553939 -0.15780107
[9,] -0.12611803 -0.44503842 -0.37343003 -0.67832344 -0.068164542 -0.23459528
[10,] -0.12556544 -0.50236071 -0.07733698 0.19582228 -0.145902049 0.77352544
[,7] [,8] [,9] [,10]
[1,] 0.68803580 0.00000000 0.00000000 -0.56187761
[2,] -0.34659700 -0.01221666 -0.09734081 -0.79939583
[3,] 0.20268600 0.25176015 0.66841195 0.02386959
[4,] 0.08530931 0.22886940 -0.03871909 -0.03573288
[5,] 0.01074149 0.04235402 -0.12501793 0.06197864
[6,] -0.32216135 -0.08409800 -0.27658529 -0.03220031
[7,] 0.42723308 -0.65537308 -0.26566776 0.14781040
[8,] 0.23944616 0.57485377 -0.56697433 0.09838580
[9,] -0.08589619 -0.28178778 0.19243608 -0.05446893
[10,] -0.08351003 -0.18932764 -0.14509053 -0.06356499
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.