Skip to contents

Extract a PCA/varimax loadings matrix

Usage

loadings(x, ...)

# Default S3 method
loadings(x, ...)

Arguments

x

Object to dispatch on

...

Passed to methods

Examples

# \donttest{
set.seed(42)
theta  = rdirichlet(50, 1, k = 3)
phi    = rdirichlet(3, 0.1, k = 20)
corpus = draw_corpus(rep(50L, 50), theta, phi)
model  = tmfast(corpus, n = 3)
loadings(model, k = 3)
#>             [,1]          [,2]          [,3]
#> 2  -1.543494e+00 -1.519224e+00 -1.7283648049
#> 5   6.571852e-02 -8.608355e-02 -0.0143080031
#> 8   6.641125e+00 -3.139326e+00  5.3903500385
#> 11 -6.242402e-01  6.643635e+00  1.3328232630
#> 12 -4.667281e-02  1.561741e+00  0.3179324781
#> 17 -3.419079e+00 -1.534457e+00 -0.5708738590
#> 20 -1.171382e+00 -1.409401e+00 -3.6377716827
#> 1   6.910355e-01 -3.868725e-01  0.2261162142
#> 10 -6.086037e-01 -5.046854e-01 -1.2253537497
#> 4   6.937302e-02  3.988841e-01  0.1265788554
#> 16 -5.848587e-02  1.575057e-02 -0.0071641039
#> 18 -3.881459e-03 -3.016794e-05 -0.1320655380
#> 7  -5.553028e-03 -3.379211e-02 -0.0389026695
#> 15  1.612053e-06 -9.270514e-03 -0.0397392701
#> 6   1.413891e-02  3.131571e-03  0.0007428317
# }
v = stats::varimax(matrix(runif(20), nrow = 5))
loadings(v)
#> 
#> Loadings:
#>      [,1]   [,2]   [,3]   [,4]  
#> [1,]  0.441  0.984         0.563
#> [2,]  0.103  0.384         1.092
#> [3,] -0.118  1.131  0.179  0.830
#> [4,]         0.946         0.333
#> [5,]  0.157  0.907 -0.127  1.206
#> 
#>                 [,1]  [,2]  [,3]  [,4]
#> SS loadings    0.248 4.115 0.052 3.764
#> Proportion Var 0.050 0.823 0.010 0.753
#> Cumulative Var 0.050 0.873 0.883 1.636