
Classical (metric) multidimensional scaling
Source:R/spatial_voting.R
morie_spatial_voting_classical_mds.RdTorgerson scaling via eigendecomposition of the double-centred matrix.
Examples
set.seed(1)
D <- as.matrix(dist(matrix(rnorm(40), 10)))
morie_spatial_voting_classical_mds(D, n_dims = 2)
#> $coordinates
#> [,1] [,2]
#> [1,] 1.979418648 -0.92650417
#> [2,] 0.596186447 0.42784593
#> [3,] -0.001047182 -0.41902581
#> [4,] -3.383827884 -0.31586046
#> [5,] 0.720001600 1.71989288
#> [6,] 0.165637607 0.39229188
#> [7,] -0.414873379 0.50475630
#> [8,] -0.640556965 0.03933409
#> [9,] 0.134002868 -0.90457015
#> [10,] 0.845058240 -0.51816048
#>
#> $eigenvalues
#> [1] 17.584180 5.771801
#>
#> $stress
#> [1] 0.2457221
#>
#> $fit
#> [1] 0.7816266
#>
#> $B_matrix
#> [,1] [,2] [,3] [,4] [,5] [,6]
#> [1,] 4.8111596 0.82636970 0.18505116 -6.3907206 -0.104262760 -0.22984620
#> [2,] 0.8263697 0.91119402 -0.04142596 -1.9325303 1.158520509 0.10033190
#> [3,] 0.1850512 -0.04142596 1.80836735 0.2944681 -1.196142503 1.05077817
#> [4,] -6.3907206 -1.93253030 0.29446808 11.6836556 -3.006439173 -0.72049034
#> [5,] -0.1042628 1.15852051 -1.19614250 -3.0064392 3.617590743 0.41549072
#> [6,] -0.2298462 0.10033190 1.05077817 -0.7204903 0.415490715 1.28690238
#> [7,] -1.2650732 0.07575998 -0.25528272 1.3035909 0.592617088 0.01364144
#> [8,] -1.2124708 -1.05509506 -1.51781774 1.6872745 -0.009357381 -0.78883774
#> [9,] 1.2360549 -0.43084321 -0.73764436 -0.2927678 -1.137370174 -1.14208135
#> [10,] 2.1437383 0.38771842 0.40964853 -2.6260409 -0.330647064 0.01411103
#> [,7] [,8] [,9] [,10]
#> [1,] -1.26507323 -1.212470837 1.2360549 2.14373828
#> [2,] 0.07575998 -1.055095064 -0.4308432 0.38771842
#> [3,] -0.25528272 -1.517817742 -0.7376444 0.40964853
#> [4,] 1.30359092 1.687274479 -0.2927678 -2.62604091
#> [5,] 0.59261709 -0.009357381 -1.1373702 -0.33064706
#> [6,] 0.01364144 -0.788837739 -1.1420813 0.01411103
#> [7,] 0.46216454 0.153418568 -0.4908652 -0.58997134
#> [8,] 0.15341857 2.670592941 0.9509361 -0.87864332
#> [9,] -0.49086525 0.950936091 1.6020598 0.44252129
#> [10,] -0.58997134 -0.878643316 0.4425213 1.02756508
#>