Random.Start.Rd
Random orthogonal rotation to use as Tmat matrix to start GPFRSorth
,
GPFRSoblq
, GPForth
, or GPFoblq
.
Random.Start(k)
An orthogonal matrix.
The random start function produces an orthogonal matrix with columns of length one based on the QR decompostion. This randomization procedures follows the logic of Stewart(1980) and Mezzari(2007), as of GPArotation version 2024.2-1.
Stewart, G. W. (1980). The Efficient Generation of Random Orthogonal Matrices with an Application to Condition Estimators. SIAM Journal on Numerical Analysis, 17(3), 403–409. http://www.jstor.org/stable/2156882
Mezzadri, F. (2007). How to generate random matrices from the classical compact groups. Notices of the American Mathematical Society, 54(5), 592–604. https://arxiv.org/abs/math-ph/0609050
# Generate a random ortogonal matrix of dimension 5 x 5
Random.Start(5)
#> [,1] [,2] [,3] [,4] [,5]
#> [1,] 0.291873147 0.4599826 -0.6250381 -0.5573705 0.04349278
#> [2,] -0.009882808 0.1737289 0.2889081 -0.2564661 -0.90580231
#> [3,] -0.521768924 0.3663339 0.4794939 -0.4801426 0.36483604
#> [4,] -0.669366426 -0.4937466 -0.4690465 -0.2450842 -0.16760655
#> [5,] -0.440928763 0.6166425 -0.2755731 0.5770269 -0.12819228
# function for generating orthogonal or oblique random matrix
Random.Start <- function(k = 2L,orthogonal=TRUE){
mat <- matrix(rnorm(k*k),k)
if (orthogonal){
qr.out <- qr(matrix(rnorm(k * k), nrow = k, ncol = k))
Q <- qr.Q(qr.out)
R <- qr.R(qr.out)
R.diag <- diag(R)
R.diag2 <- R.diag/abs(R.diag)
ans <- t(t(Q) * R.diag2)
ans
}
else{
ans <- mat %*% diag(1/sqrt(diag(crossprod(mat))))
}
ans
}
data("Thurstone", package="GPArotation")
simplimax(box26,Tmat = Random.Start(3, orthogonal = TRUE))
#> Oblique rotation method Simplimax converged.
#> Loadings:
#> [,1] [,2] [,3]
#> [1,] 0.5476 0.61404 0.6050
#> [2,] 0.9557 -0.41705 0.4286
#> [3,] 0.6429 0.46055 -0.5037
#> [4,] 0.9644 0.05953 0.6824
#> [5,] 0.7346 0.69550 0.0101
#> [6,] 0.9578 0.00206 -0.0963
#> [7,] 0.8442 0.32325 0.6763
#> [8,] 1.0100 -0.15839 0.5779
#> [9,] 0.6853 0.70889 0.2426
#> [10,] 0.8007 0.69723 -0.1878
#> [11,] 0.9896 -0.16992 0.0807
#> [12,] 0.8780 0.15814 -0.2518
#> [13,] -0.3533 0.88540 0.0825
#> [14,] 0.3533 -0.88540 -0.0825
#> [15,] -0.0283 0.07871 0.9548
#> [16,] 0.0283 -0.07871 -0.9548
#> [17,] 0.3141 -0.84313 0.8107
#> [18,] -0.3141 0.84313 -0.8107
#> [19,] 0.9740 -0.03312 0.6619
#> [20,] 0.7139 0.70580 -0.0490
#> [21,] 0.9653 0.00434 -0.0758
#> [22,] 0.9659 -0.02844 0.6440
#> [23,] 0.7047 0.67563 -0.0579
#> [24,] 0.9580 0.00171 -0.0449
#> [25,] 0.9948 0.27370 0.2328
#> [26,] 0.9902 0.19007 0.1751
#>
#> [,1] [,2] [,3]
#> SS loadings 14.398 6.193 4.818
#> Proportion Var 0.554 0.238 0.185
#> Cumulative Var 0.554 0.792 0.977
#>
#> Phi:
#> [,1] [,2] [,3]
#> [1,] 1.0000 -0.0335 -0.332
#> [2,] -0.0335 1.0000 0.235
#> [3,] -0.3318 0.2346 1.000
simplimax(box26,Tmat = Random.Start(3, orthogonal = FALSE))
#> Oblique rotation method Simplimax converged.
#> Loadings:
#> [,1] [,2] [,3]
#> [1,] 1.57514 -0.9431 0.4518
#> [2,] 0.08969 0.7244 0.4755
#> [3,] 0.01536 0.8355 -0.6414
#> [4,] 1.00743 -0.0995 0.6288
#> [5,] 0.95750 -0.0266 -0.1770
#> [6,] -0.03096 1.0298 -0.1460
#> [7,] 1.32245 -0.4700 0.5717
#> [8,] 0.60661 0.3077 0.5680
#> [9,] 1.25817 -0.4080 0.0578
#> [10,] 0.72026 0.3076 -0.3809
#> [11,] -0.02605 0.9882 0.0686
#> [12,] -0.03361 1.0127 -0.3331
#> [13,] 1.18978 -1.3391 -0.0900
#> [14,] -1.18978 1.3391 0.0900
#> [15,] 1.28044 -1.4273 0.9502
#> [16,] -1.28044 1.4273 -0.9502
#> [17,] -0.03268 0.0236 0.9864
#> [18,] 0.03268 -0.0236 -0.9864
#> [19,] 0.86576 0.0314 0.6276
#> [20,] 0.89536 0.0255 -0.2380
#> [21,] -0.00199 1.0062 -0.1262
#> [22,] 0.84878 0.0438 0.6089
#> [23,] 0.84531 0.0596 -0.2400
#> [24,] 0.03237 0.9592 -0.0939
#> [25,] 0.72366 0.3350 0.1263
#> [26,] 0.54597 0.4950 0.0862
#>
#> [,1] [,2] [,3]
#> SS loadings 11.280 8.941 5.188
#> Proportion Var 0.434 0.344 0.200
#> Cumulative Var 0.434 0.778 0.977
#>
#> Phi:
#> [,1] [,2] [,3]
#> [1,] 1.000 0.725 -0.219
#> [2,] 0.725 1.000 0.156
#> [3,] -0.219 0.156 1.000
# covariance matrix is Phi = t(Th) %*% Th
rms <- Random.Start(3, FALSE)
t(rms) %*% rms # covariance matrix because oblique rms
#> [,1] [,2] [,3]
#> [1,] 1.0000000 -0.3536657 -0.7437442
#> [2,] -0.3536657 1.0000000 -0.3038396
#> [3,] -0.7437442 -0.3038396 1.0000000
rms <- Random.Start(3, TRUE)
t(rms) %*% rms # identity matrix because orthogonal rms
#> [,1] [,2] [,3]
#> [1,] 1.000000e+00 -6.490753e-17 1.488914e-16
#> [2,] -6.490753e-17 1.000000e+00 5.523178e-17
#> [3,] 1.488914e-16 5.523178e-17 1.000000e+00