R Under development (unstable) (2024-02-05 r85863 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ## this will render the output independent from the version of the package > suppressPackageStartupMessages(library(rrcov3way)) > set.seed(123456) > > ## unfold() ====================================================== > data(elind) > try(unfold(elind[,,1])) Error in unfold(elind[, , 1]) : 'X' is not a multyway array! > (a <- unfold(elind, mode="A")) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 1.4680 0.5426 1.3344 0.5077 0.6455 0.5936 1.3775 0.4948 1.4927 0.5202 [2,] 1.5247 0.2611 0.8925 0.6393 1.3847 1.2761 1.4694 0.2296 0.8640 0.6487 [3,] 0.6615 2.3867 1.0219 0.6695 0.2497 1.0108 0.6491 2.4714 1.0960 0.6373 [4,] 1.7889 0.3694 0.9587 0.7341 0.5481 0.3136 1.5090 0.1379 1.0360 1.1128 [5,] 0.0374 1.0345 0.7815 3.1177 0.7320 0.1374 0.0347 1.6092 0.9789 2.8328 [6,] 0.4301 1.8073 1.2979 1.0612 1.2767 0.7047 0.5788 2.8338 0.0179 1.5766 [7,] 0.7635 0.8077 1.6915 0.9869 1.9347 0.0986 0.7920 0.8349 1.7199 0.9442 [8,] 1.0532 0.2432 0.8174 1.5022 0.9270 1.2875 0.9704 0.2269 0.8909 1.5604 [9,] 0.8315 0.8856 0.8343 1.4975 1.4082 0.8857 0.8031 1.0069 0.8460 1.4759 [10,] 0.0135 0.0615 1.7737 2.6966 0.0455 0.3504 0.0132 0.1218 2.2961 2.3131 [11,] 2.2047 0.3149 0.3706 0.5598 0.1346 0.9805 1.8560 0.3726 0.4950 0.6480 [12,] 1.1459 0.4009 1.0486 1.1332 0.6744 1.1098 1.1936 0.4084 1.0355 1.1047 [13,] 0.8839 0.9504 1.1880 0.5786 2.0219 1.4675 0.8943 0.9757 1.2363 0.5764 [14,] 1.4038 0.2889 1.0723 0.9572 0.8151 0.7539 1.4489 0.2849 1.0332 0.8528 [15,] 0.2200 2.0134 0.5728 1.5901 0.6846 1.8229 0.2354 1.8855 0.5795 1.8668 [16,] 0.2019 3.1341 0.6360 1.5769 1.1391 0.1132 0.2657 3.2814 0.6713 1.6138 [17,] 0.8190 0.6867 1.8318 1.1179 0.4544 0.0341 0.9261 0.1060 2.0207 1.1660 [18,] 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.4779 2.6278 0.4519 1.1041 [19,] 1.2315 0.6912 1.0132 1.2964 0.6783 0.2278 1.1486 0.5373 1.1365 1.3533 [20,] 0.8717 0.5723 1.9181 0.8496 1.2241 0.1061 0.8759 0.5293 2.0648 0.7799 [21,] 0.5784 0.0909 0.8040 2.7930 0.7844 0.3904 0.4876 0.1154 0.9784 2.7340 [22,] 0.0012 4.7947 0.4004 0.7746 0.0000 1.0067 0.0000 3.3700 2.0587 0.4243 [23,] 0.2649 0.6927 1.2741 2.0883 0.9737 0.7857 0.2844 0.9407 1.1821 2.0449 [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [1,] 0.5018 0.5303 1.2779 0.3023 1.7798 0.5175 0.4594 0.3059 1.1215 0.4482 [2,] 1.4319 1.2239 1.5993 0.3103 0.8221 0.6900 1.5568 0.5310 1.3464 0.1818 [3,] 0.2782 1.1785 0.6551 2.7027 1.1442 0.7289 0.3702 0.6822 0.7196 2.5573 [4,] 0.6644 0.2670 1.0725 0.1057 1.1722 0.9715 0.5781 1.6107 0.8283 0.1379 [5,] 0.3075 0.0489 0.0134 0.0403 0.0214 0.0232 0.1325 0.0465 0.0517 0.0515 [6,] 1.7461 0.8558 0.4420 1.8992 1.5274 1.1032 1.2599 0.4539 0.7052 2.1768 [7,] 2.1640 0.0742 0.5545 0.6830 1.2354 0.8057 1.8563 2.4845 0.6266 1.3021 [8,] 0.8391 1.1506 0.9545 0.1904 0.9332 1.5432 0.7509 1.2364 0.9086 0.2603 [9,] 1.3647 0.8624 0.7591 0.9377 0.7977 1.4331 1.3624 1.3511 0.8051 1.0345 [10,] 0.0332 0.1936 0.0054 0.0305 1.7985 1.7672 0.0281 2.6340 0.3400 0.0496 [11,] 0.2516 1.0659 1.9554 0.2148 0.4639 0.5548 0.1139 0.9621 2.0267 0.1277 [12,] 0.6069 0.9409 1.1640 0.4087 0.6280 0.8411 0.4883 2.4175 1.1122 0.5277 [13,] 2.0072 1.3140 0.8604 0.6879 1.5208 0.6818 2.1379 0.9507 1.0456 0.5057 [14,] 0.6298 0.7881 1.4363 0.3253 0.9063 0.9811 0.5257 0.6750 1.2780 0.2483 [15,] 0.7844 1.5825 0.2797 1.8114 0.5481 1.8228 0.8090 1.9592 0.3186 3.0854 [16,] 1.0953 0.1628 0.3312 2.8377 0.8863 1.3978 1.1654 0.5901 0.3217 2.9136 [17,] 0.4368 0.0604 0.7436 0.1205 1.4653 0.9622 0.3797 2.1846 1.0074 0.1280 [18,] 0.0036 2.0078 0.5853 3.3505 0.6983 1.3149 0.0123 0.0981 0.8174 3.3685 [19,] 0.6826 0.2444 0.8395 0.3861 0.8027 1.1153 0.4869 2.6396 1.2499 0.4372 [20,] 1.2363 0.1062 0.8160 0.4071 1.7848 0.7083 1.2715 1.1063 0.7183 0.4806 [21,] 0.6778 0.3889 0.4515 0.1626 0.8466 2.7997 0.7362 0.6896 0.4662 0.1791 [22,] 0.0000 0.7157 0.0000 0.6840 0.8413 0.6646 0.0000 6.1894 0.0054 0.5738 [23,] 1.3135 0.7584 0.1341 0.6428 0.8923 1.4692 1.0628 3.6811 0.1284 1.1228 [,21] [,22] [,23] [,24] [,25] [,26] [,27] [,28] [,29] [,30] [1,] 1.8207 0.4848 0.4625 0.5561 1.0542 0.5775 1.8933 0.4251 0.4097 0.6154 [2,] 0.7234 0.5978 1.3362 1.5056 1.2904 0.1113 0.7146 0.5996 1.3338 1.4535 [3,] 1.1301 0.6882 0.4171 1.1264 0.7834 2.3620 1.1380 0.7028 0.4775 1.1496 [4,] 1.7916 1.5455 0.4026 0.1543 0.7108 0.1460 2.0333 1.4575 1.1176 0.2344 [5,] 2.0145 3.0001 0.1352 0.0315 0.1156 0.2095 2.1103 3.1455 0.2027 0.0206 [6,] 1.4677 1.2216 0.4355 0.1185 0.6824 2.3981 1.4873 1.3787 0.3753 0.1600 [7,] 1.5865 1.1953 2.9622 0.0579 0.5762 1.4041 1.6884 1.2302 3.5541 0.0874 [8,] 0.9657 1.6653 0.7787 0.9299 0.8915 0.2862 1.0642 1.7229 0.6486 0.8437 [9,] 0.8683 1.6380 1.5517 0.6880 0.8138 1.0473 0.8333 1.7236 1.7279 0.7139 [10,] 1.7547 2.6023 0.0840 0.2319 0.0502 0.2367 1.6987 3.6546 0.1931 0.1870 [11,] 0.4484 0.4065 0.6379 0.5786 1.9941 0.0818 0.3214 0.3810 0.2376 0.5985 [12,] 0.9870 1.2507 0.5129 0.8093 1.0204 0.5972 0.9916 1.3919 0.5631 0.8261 [13,] 1.0591 0.7454 2.4197 1.0673 1.1976 0.4841 0.9160 0.6987 2.1118 0.9202 [14,] 1.0103 0.9740 0.6696 0.8418 1.2707 0.2605 1.0072 0.9079 0.7563 0.8002 [15,] 0.7371 1.8305 0.5259 0.9017 0.3096 2.8285 0.8670 2.0339 0.6259 1.0272 [16,] 1.2593 1.7241 1.2901 0.0921 0.3675 3.2244 1.4922 1.6274 1.2702 0.0782 [17,] 1.7920 1.2657 0.4645 0.0402 1.0471 0.1414 1.7954 1.1805 0.6532 0.0758 [18,] 0.3836 0.8888 0.0066 1.3747 0.6944 4.2462 0.3535 1.0028 0.0110 1.2732 [19,] 0.9294 1.5815 0.3949 0.1565 0.8829 0.8136 0.9375 2.1570 0.5859 0.2807 [20,] 2.0701 1.1426 1.2136 0.1134 0.8757 0.4904 2.0617 0.9573 1.1760 0.1155 [21,] 0.9747 3.0044 0.6964 0.3436 0.4573 0.1613 0.9124 3.4497 0.8430 0.2906 [22,] 0.0239 5.1583 0.0606 0.0789 0.0047 1.0528 0.7316 4.5891 0.0000 0.2205 [23,] 1.7385 2.1898 0.9392 0.4710 0.1631 1.3311 1.8556 2.4171 0.4692 0.4262 [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [,39] [,40] [1,] 0.9238 0.5133 2.0933 0.4303 0.3118 0.8565 0.8522 0.5170 1.9600 0.5163 [2,] 1.2951 0.1604 0.6837 0.6110 1.3268 1.3025 1.2802 0.1447 0.7272 0.6490 [3,] 0.8032 2.2917 1.1990 0.5836 0.5493 1.1894 0.7697 2.3268 1.2362 0.7003 [4,] 1.0259 0.1052 1.2486 1.8464 0.8087 0.2589 1.0266 0.1055 1.2459 1.6020 [5,] 0.0815 0.2081 2.5313 3.0989 0.3325 0.0233 0.1236 0.3381 2.2685 3.3475 [6,] 0.7883 2.4750 1.3825 1.3785 0.3980 0.1883 0.6968 2.4830 1.3183 1.5140 [7,] 0.5232 1.3831 1.8189 1.3623 4.5263 0.1083 0.5751 1.0494 1.7588 1.4529 [8,] 0.6987 0.2113 0.8236 2.7655 0.4873 0.6849 0.8968 0.2699 1.0476 1.6478 [9,] 0.8065 0.9941 0.8550 1.7400 1.8206 0.7833 0.8565 0.8870 0.7176 1.9208 [10,] 0.0481 0.2528 1.9715 3.8411 0.0395 0.0504 0.0305 0.0159 2.0506 4.1872 [11,] 1.9677 0.0635 0.3059 0.3471 0.0605 0.5565 1.9191 0.0797 0.3001 0.3436 [12,] 1.0137 0.4675 1.2434 1.1667 0.5806 0.8414 1.1208 0.4325 1.0328 1.1203 [13,] 1.2366 0.4011 0.8662 0.6251 2.3721 0.9307 1.1980 0.4368 0.6802 0.7233 [14,] 1.3458 0.3176 0.8367 0.7915 0.6886 0.8718 1.2857 0.3099 0.7627 0.8392 [15,] 0.3597 2.4285 0.7371 2.0507 0.8733 1.2842 0.3377 2.2343 0.7178 2.1667 [16,] 0.3740 3.4295 1.5601 1.5661 2.2407 0.0910 0.5543 2.5190 1.5580 1.5966 [17,] 1.0747 0.1208 1.7625 1.2683 0.9107 0.0926 1.1412 0.1052 1.5393 1.2496 [18,] 0.6501 3.9376 0.2716 0.8225 0.0149 1.7603 0.4864 4.4313 0.3030 1.0125 [19,] 1.5478 0.6577 0.4719 1.2082 0.6213 0.2249 1.5736 0.4383 0.4835 1.1947 [20,] 0.7801 0.6540 2.3268 1.0617 1.1945 0.1141 0.7741 0.5205 2.3371 0.9948 [21,] 0.4495 0.1316 1.0122 3.4630 1.1550 0.3347 0.4299 0.1301 0.9623 3.8446 [22,] 0.0112 0.4550 3.4387 2.1087 0.0068 0.0928 0.0099 0.6644 3.3554 1.8259 [23,] 0.1790 1.6227 1.4483 2.8860 1.1866 0.4223 0.1283 1.6197 1.8151 2.8089 [,41] [,42] [1,] 0.1877 1.1105 [2,] 1.2976 1.2391 [3,] 0.6342 1.0786 [4,] 1.5293 0.3313 [5,] 0.8757 0.0215 [6,] 0.8094 0.2464 [7,] 4.0317 0.0993 [8,] 0.6330 1.0763 [9,] 1.6908 0.7882 [10,] 0.2423 0.0733 [11,] 0.0246 0.4766 [12,] 0.4882 0.8838 [13,] 2.4106 1.0629 [14,] 0.5632 1.0671 [15,] 0.9502 1.6019 [16,] 1.5611 0.0863 [17,] 0.9406 0.0789 [18,] 0.0113 1.9149 [19,] 0.5409 0.1265 [20,] 1.1955 0.1234 [21,] 1.0888 0.3804 [22,] 0.0028 0.4894 [23,] 1.0059 0.4451 > (b <- unfold(elind, mode="B")) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 1.4680 1.3775 1.2779 1.1215 1.0542 0.9238 0.8522 1.5247 1.4694 1.5993 [2,] 0.5426 0.4948 0.3023 0.4482 0.5775 0.5133 0.5170 0.2611 0.2296 0.3103 [3,] 1.3344 1.4927 1.7798 1.8207 1.8933 2.0933 1.9600 0.8925 0.8640 0.8221 [4,] 0.5077 0.5202 0.5175 0.4848 0.4251 0.4303 0.5163 0.6393 0.6487 0.6900 [5,] 0.6455 0.5018 0.4594 0.4625 0.4097 0.3118 0.1877 1.3847 1.4319 1.5568 [6,] 0.5936 0.5303 0.3059 0.5561 0.6154 0.8565 1.1105 1.2761 1.2239 0.5310 [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [1,] 1.3464 1.2904 1.2951 1.2802 0.6615 0.6491 0.6551 0.7196 0.7834 0.8032 [2,] 0.1818 0.1113 0.1604 0.1447 2.3867 2.4714 2.7027 2.5573 2.3620 2.2917 [3,] 0.7234 0.7146 0.6837 0.7272 1.0219 1.0960 1.1442 1.1301 1.1380 1.1990 [4,] 0.5978 0.5996 0.6110 0.6490 0.6695 0.6373 0.7289 0.6882 0.7028 0.5836 [5,] 1.3362 1.3338 1.3268 1.2976 0.2497 0.2782 0.3702 0.4171 0.4775 0.5493 [6,] 1.5056 1.4535 1.3025 1.2391 1.0108 1.1785 0.6822 1.1264 1.1496 1.1894 [,21] [,22] [,23] [,24] [,25] [,26] [,27] [,28] [,29] [,30] [1,] 0.7697 1.7889 1.5090 1.0725 0.8283 0.7108 1.0259 1.0266 0.0374 0.0347 [2,] 2.3268 0.3694 0.1379 0.1057 0.1379 0.1460 0.1052 0.1055 1.0345 1.6092 [3,] 1.2362 0.9587 1.0360 1.1722 1.7916 2.0333 1.2486 1.2459 0.7815 0.9789 [4,] 0.7003 0.7341 1.1128 0.9715 1.5455 1.4575 1.8464 1.6020 3.1177 2.8328 [5,] 0.6342 0.5481 0.6644 0.5781 0.4026 1.1176 0.8087 1.5293 0.7320 0.3075 [6,] 1.0786 0.3136 0.2670 1.6107 0.1543 0.2344 0.2589 0.3313 0.1374 0.0489 [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [,39] [,40] [1,] 0.0134 0.0517 0.1156 0.0815 0.1236 0.4301 0.5788 0.4420 0.7052 0.6824 [2,] 0.0403 0.0515 0.2095 0.2081 0.3381 1.8073 2.8338 1.8992 2.1768 2.3981 [3,] 0.0214 2.0145 2.1103 2.5313 2.2685 1.2979 0.0179 1.5274 1.4677 1.4873 [4,] 0.0232 3.0001 3.1455 3.0989 3.3475 1.0612 1.5766 1.1032 1.2216 1.3787 [5,] 0.1325 0.1352 0.2027 0.3325 0.8757 1.2767 1.7461 1.2599 0.4355 0.3753 [6,] 0.0465 0.0315 0.0206 0.0233 0.0215 0.7047 0.8558 0.4539 0.1185 0.1600 [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50] [1,] 0.7883 0.6968 0.7635 0.7920 0.5545 0.6266 0.5762 0.5232 0.5751 1.0532 [2,] 2.4750 2.4830 0.8077 0.8349 0.6830 1.3021 1.4041 1.3831 1.0494 0.2432 [3,] 1.3825 1.3183 1.6915 1.7199 1.2354 1.5865 1.6884 1.8189 1.7588 0.8174 [4,] 1.3785 1.5140 0.9869 0.9442 0.8057 1.1953 1.2302 1.3623 1.4529 1.5022 [5,] 0.3980 0.8094 1.9347 2.1640 1.8563 2.9622 3.5541 4.5263 4.0317 0.9270 [6,] 0.1883 0.2464 0.0986 0.0742 2.4845 0.0579 0.0874 0.1083 0.0993 1.2875 [,51] [,52] [,53] [,54] [,55] [,56] [,57] [,58] [,59] [,60] [1,] 0.9704 0.9545 0.9086 0.8915 0.6987 0.8968 0.8315 0.8031 0.7591 0.8051 [2,] 0.2269 0.1904 0.2603 0.2862 0.2113 0.2699 0.8856 1.0069 0.9377 1.0345 [3,] 0.8909 0.9332 0.9657 1.0642 0.8236 1.0476 0.8343 0.8460 0.7977 0.8683 [4,] 1.5604 1.5432 1.6653 1.7229 2.7655 1.6478 1.4975 1.4759 1.4331 1.6380 [5,] 0.8391 0.7509 0.7787 0.6486 0.4873 0.6330 1.4082 1.3647 1.3624 1.5517 [6,] 1.1506 1.2364 0.9299 0.8437 0.6849 1.0763 0.8857 0.8624 1.3511 0.6880 [,61] [,62] [,63] [,64] [,65] [,66] [,67] [,68] [,69] [,70] [1,] 0.8138 0.8065 0.8565 0.0135 0.0132 0.0054 0.3400 0.0502 0.0481 0.0305 [2,] 1.0473 0.9941 0.8870 0.0615 0.1218 0.0305 0.0496 0.2367 0.2528 0.0159 [3,] 0.8333 0.8550 0.7176 1.7737 2.2961 1.7985 1.7547 1.6987 1.9715 2.0506 [4,] 1.7236 1.7400 1.9208 2.6966 2.3131 1.7672 2.6023 3.6546 3.8411 4.1872 [5,] 1.7279 1.8206 1.6908 0.0455 0.0332 0.0281 0.0840 0.1931 0.0395 0.2423 [6,] 0.7139 0.7833 0.7882 0.3504 0.1936 2.6340 0.2319 0.1870 0.0504 0.0733 [,71] [,72] [,73] [,74] [,75] [,76] [,77] [,78] [,79] [,80] [1,] 2.2047 1.8560 1.9554 2.0267 1.9941 1.9677 1.9191 1.1459 1.1936 1.1640 [2,] 0.3149 0.3726 0.2148 0.1277 0.0818 0.0635 0.0797 0.4009 0.4084 0.4087 [3,] 0.3706 0.4950 0.4639 0.4484 0.3214 0.3059 0.3001 1.0486 1.0355 0.6280 [4,] 0.5598 0.6480 0.5548 0.4065 0.3810 0.3471 0.3436 1.1332 1.1047 0.8411 [5,] 0.1346 0.2516 0.1139 0.6379 0.2376 0.0605 0.0246 0.6744 0.6069 0.4883 [6,] 0.9805 1.0659 0.9621 0.5786 0.5985 0.5565 0.4766 1.1098 0.9409 2.4175 [,81] [,82] [,83] [,84] [,85] [,86] [,87] [,88] [,89] [,90] [1,] 1.1122 1.0204 1.0137 1.1208 0.8839 0.8943 0.8604 1.0456 1.1976 1.2366 [2,] 0.5277 0.5972 0.4675 0.4325 0.9504 0.9757 0.6879 0.5057 0.4841 0.4011 [3,] 0.9870 0.9916 1.2434 1.0328 1.1880 1.2363 1.5208 1.0591 0.9160 0.8662 [4,] 1.2507 1.3919 1.1667 1.1203 0.5786 0.5764 0.6818 0.7454 0.6987 0.6251 [5,] 0.5129 0.5631 0.5806 0.4882 2.0219 2.0072 2.1379 2.4197 2.1118 2.3721 [6,] 0.8093 0.8261 0.8414 0.8838 1.4675 1.3140 0.9507 1.0673 0.9202 0.9307 [,91] [,92] [,93] [,94] [,95] [,96] [,97] [,98] [,99] [,100] [1,] 1.1980 1.4038 1.4489 1.4363 1.2780 1.2707 1.3458 1.2857 0.2200 0.2354 [2,] 0.4368 0.2889 0.2849 0.3253 0.2483 0.2605 0.3176 0.3099 2.0134 1.8855 [3,] 0.6802 1.0723 1.0332 0.9063 1.0103 1.0072 0.8367 0.7627 0.5728 0.5795 [4,] 0.7233 0.9572 0.8528 0.9811 0.9740 0.9079 0.7915 0.8392 1.5901 1.8668 [5,] 2.4106 0.8151 0.6298 0.5257 0.6696 0.7563 0.6886 0.5632 0.6846 0.7844 [6,] 1.0629 0.7539 0.7881 0.6750 0.8418 0.8002 0.8718 1.0671 1.8229 1.5825 [,101] [,102] [,103] [,104] [,105] [,106] [,107] [,108] [,109] [,110] [1,] 0.2797 0.3186 0.3096 0.3597 0.3377 0.2019 0.2657 0.3312 0.3217 0.3675 [2,] 1.8114 3.0854 2.8285 2.4285 2.2343 3.1341 3.2814 2.8377 2.9136 3.2244 [3,] 0.5481 0.7371 0.8670 0.7371 0.7178 0.6360 0.6713 0.8863 1.2593 1.4922 [4,] 1.8228 1.8305 2.0339 2.0507 2.1667 1.5769 1.6138 1.3978 1.7241 1.6274 [5,] 0.8090 0.5259 0.6259 0.8733 0.9502 1.1391 1.0953 1.1654 1.2901 1.2702 [6,] 1.9592 0.9017 1.0272 1.2842 1.6019 0.1132 0.1628 0.5901 0.0921 0.0782 [,111] [,112] [,113] [,114] [,115] [,116] [,117] [,118] [,119] [,120] [1,] 0.3740 0.5543 0.8190 0.9261 0.7436 1.0074 1.0471 1.0747 1.1412 0 [2,] 3.4295 2.5190 0.6867 0.1060 0.1205 0.1280 0.1414 0.1208 0.1052 0 [3,] 1.5601 1.5580 1.8318 2.0207 1.4653 1.7920 1.7954 1.7625 1.5393 0 [4,] 1.5661 1.5966 1.1179 1.1660 0.9622 1.2657 1.1805 1.2683 1.2496 0 [5,] 2.2407 1.5611 0.4544 0.4368 0.3797 0.4645 0.6532 0.9107 0.9406 0 [6,] 0.0910 0.0863 0.0341 0.0604 2.1846 0.0402 0.0758 0.0926 0.0789 0 [,121] [,122] [,123] [,124] [,125] [,126] [,127] [,128] [,129] [,130] [1,] 0.4779 0.5853 0.8174 0.6944 0.6501 0.4864 1.2315 1.1486 0.8395 1.2499 [2,] 2.6278 3.3505 3.3685 4.2462 3.9376 4.4313 0.6912 0.5373 0.3861 0.4372 [3,] 0.4519 0.6983 0.3836 0.3535 0.2716 0.3030 1.0132 1.1365 0.8027 0.9294 [4,] 1.1041 1.3149 0.8888 1.0028 0.8225 1.0125 1.2964 1.3533 1.1153 1.5815 [5,] 0.0036 0.0123 0.0066 0.0110 0.0149 0.0113 0.6783 0.6826 0.4869 0.3949 [6,] 2.0078 0.0981 1.3747 1.2732 1.7603 1.9149 0.2278 0.2444 2.6396 0.1565 [,131] [,132] [,133] [,134] [,135] [,136] [,137] [,138] [,139] [,140] [1,] 0.8829 1.5478 1.5736 0.8717 0.8759 0.8160 0.7183 0.8757 0.7801 0.7741 [2,] 0.8136 0.6577 0.4383 0.5723 0.5293 0.4071 0.4806 0.4904 0.6540 0.5205 [3,] 0.9375 0.4719 0.4835 1.9181 2.0648 1.7848 2.0701 2.0617 2.3268 2.3371 [4,] 2.1570 1.2082 1.1947 0.8496 0.7799 0.7083 1.1426 0.9573 1.0617 0.9948 [5,] 0.5859 0.6213 0.5409 1.2241 1.2363 1.2715 1.2136 1.1760 1.1945 1.1955 [6,] 0.2807 0.2249 0.1265 0.1061 0.1062 1.1063 0.1134 0.1155 0.1141 0.1234 [,141] [,142] [,143] [,144] [,145] [,146] [,147] [,148] [,149] [,150] [1,] 0.5784 0.4876 0.4515 0.4662 0.4573 0.4495 0.4299 0.0012 0.0000 0.0000 [2,] 0.0909 0.1154 0.1626 0.1791 0.1613 0.1316 0.1301 4.7947 3.3700 0.6840 [3,] 0.8040 0.9784 0.8466 0.9747 0.9124 1.0122 0.9623 0.4004 2.0587 0.8413 [4,] 2.7930 2.7340 2.7997 3.0044 3.4497 3.4630 3.8446 0.7746 0.4243 0.6646 [5,] 0.7844 0.6778 0.7362 0.6964 0.8430 1.1550 1.0888 0.0000 0.0000 0.0000 [6,] 0.3904 0.3889 0.6896 0.3436 0.2906 0.3347 0.3804 1.0067 0.7157 6.1894 [,151] [,152] [,153] [,154] [,155] [,156] [,157] [,158] [,159] [,160] [1,] 0.0054 0.0047 0.0112 0.0099 0.2649 0.2844 0.1341 0.1284 0.1631 0.1790 [2,] 0.5738 1.0528 0.4550 0.6644 0.6927 0.9407 0.6428 1.1228 1.3311 1.6227 [3,] 0.0239 0.7316 3.4387 3.3554 1.2741 1.1821 0.8923 1.7385 1.8556 1.4483 [4,] 5.1583 4.5891 2.1087 1.8259 2.0883 2.0449 1.4692 2.1898 2.4171 2.8860 [5,] 0.0606 0.0000 0.0068 0.0028 0.9737 1.3135 1.0628 0.9392 0.4692 1.1866 [6,] 0.0789 0.2205 0.0928 0.4894 0.7857 0.7584 3.6811 0.4710 0.4262 0.4223 [,161] [1,] 0.1283 [2,] 1.6197 [3,] 1.8151 [4,] 2.8089 [5,] 1.0059 [6,] 0.4451 > (c <- unfold(elind, mode="C")) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,] 1.4680 1.5247 0.6615 1.7889 0.0374 0.4301 0.7635 1.0532 0.8315 0.0135 [2,] 1.3775 1.4694 0.6491 1.5090 0.0347 0.5788 0.7920 0.9704 0.8031 0.0132 [3,] 1.2779 1.5993 0.6551 1.0725 0.0134 0.4420 0.5545 0.9545 0.7591 0.0054 [4,] 1.1215 1.3464 0.7196 0.8283 0.0517 0.7052 0.6266 0.9086 0.8051 0.3400 [5,] 1.0542 1.2904 0.7834 0.7108 0.1156 0.6824 0.5762 0.8915 0.8138 0.0502 [6,] 0.9238 1.2951 0.8032 1.0259 0.0815 0.7883 0.5232 0.6987 0.8065 0.0481 [7,] 0.8522 1.2802 0.7697 1.0266 0.1236 0.6968 0.5751 0.8968 0.8565 0.0305 [,11] [,12] [,13] [,14] [,15] [,16] [,17] [,18] [,19] [,20] [1,] 2.2047 1.1459 0.8839 1.4038 0.2200 0.2019 0.8190 0.0000 1.2315 0.8717 [2,] 1.8560 1.1936 0.8943 1.4489 0.2354 0.2657 0.9261 0.4779 1.1486 0.8759 [3,] 1.9554 1.1640 0.8604 1.4363 0.2797 0.3312 0.7436 0.5853 0.8395 0.8160 [4,] 2.0267 1.1122 1.0456 1.2780 0.3186 0.3217 1.0074 0.8174 1.2499 0.7183 [5,] 1.9941 1.0204 1.1976 1.2707 0.3096 0.3675 1.0471 0.6944 0.8829 0.8757 [6,] 1.9677 1.0137 1.2366 1.3458 0.3597 0.3740 1.0747 0.6501 1.5478 0.7801 [7,] 1.9191 1.1208 1.1980 1.2857 0.3377 0.5543 1.1412 0.4864 1.5736 0.7741 [,21] [,22] [,23] [,24] [,25] [,26] [,27] [,28] [,29] [,30] [1,] 0.5784 0.0012 0.2649 0.5426 0.2611 2.3867 0.3694 1.0345 1.8073 0.8077 [2,] 0.4876 0.0000 0.2844 0.4948 0.2296 2.4714 0.1379 1.6092 2.8338 0.8349 [3,] 0.4515 0.0000 0.1341 0.3023 0.3103 2.7027 0.1057 0.0403 1.8992 0.6830 [4,] 0.4662 0.0054 0.1284 0.4482 0.1818 2.5573 0.1379 0.0515 2.1768 1.3021 [5,] 0.4573 0.0047 0.1631 0.5775 0.1113 2.3620 0.1460 0.2095 2.3981 1.4041 [6,] 0.4495 0.0112 0.1790 0.5133 0.1604 2.2917 0.1052 0.2081 2.4750 1.3831 [7,] 0.4299 0.0099 0.1283 0.5170 0.1447 2.3268 0.1055 0.3381 2.4830 1.0494 [,31] [,32] [,33] [,34] [,35] [,36] [,37] [,38] [,39] [,40] [1,] 0.2432 0.8856 0.0615 0.3149 0.4009 0.9504 0.2889 2.0134 3.1341 0.6867 [2,] 0.2269 1.0069 0.1218 0.3726 0.4084 0.9757 0.2849 1.8855 3.2814 0.1060 [3,] 0.1904 0.9377 0.0305 0.2148 0.4087 0.6879 0.3253 1.8114 2.8377 0.1205 [4,] 0.2603 1.0345 0.0496 0.1277 0.5277 0.5057 0.2483 3.0854 2.9136 0.1280 [5,] 0.2862 1.0473 0.2367 0.0818 0.5972 0.4841 0.2605 2.8285 3.2244 0.1414 [6,] 0.2113 0.9941 0.2528 0.0635 0.4675 0.4011 0.3176 2.4285 3.4295 0.1208 [7,] 0.2699 0.8870 0.0159 0.0797 0.4325 0.4368 0.3099 2.2343 2.5190 0.1052 [,41] [,42] [,43] [,44] [,45] [,46] [,47] [,48] [,49] [,50] [1,] 0.0000 0.6912 0.5723 0.0909 4.7947 0.6927 1.3344 0.8925 1.0219 0.9587 [2,] 2.6278 0.5373 0.5293 0.1154 3.3700 0.9407 1.4927 0.8640 1.0960 1.0360 [3,] 3.3505 0.3861 0.4071 0.1626 0.6840 0.6428 1.7798 0.8221 1.1442 1.1722 [4,] 3.3685 0.4372 0.4806 0.1791 0.5738 1.1228 1.8207 0.7234 1.1301 1.7916 [5,] 4.2462 0.8136 0.4904 0.1613 1.0528 1.3311 1.8933 0.7146 1.1380 2.0333 [6,] 3.9376 0.6577 0.6540 0.1316 0.4550 1.6227 2.0933 0.6837 1.1990 1.2486 [7,] 4.4313 0.4383 0.5205 0.1301 0.6644 1.6197 1.9600 0.7272 1.2362 1.2459 [,51] [,52] [,53] [,54] [,55] [,56] [,57] [,58] [,59] [,60] [1,] 0.7815 1.2979 1.6915 0.8174 0.8343 1.7737 0.3706 1.0486 1.1880 1.0723 [2,] 0.9789 0.0179 1.7199 0.8909 0.8460 2.2961 0.4950 1.0355 1.2363 1.0332 [3,] 0.0214 1.5274 1.2354 0.9332 0.7977 1.7985 0.4639 0.6280 1.5208 0.9063 [4,] 2.0145 1.4677 1.5865 0.9657 0.8683 1.7547 0.4484 0.9870 1.0591 1.0103 [5,] 2.1103 1.4873 1.6884 1.0642 0.8333 1.6987 0.3214 0.9916 0.9160 1.0072 [6,] 2.5313 1.3825 1.8189 0.8236 0.8550 1.9715 0.3059 1.2434 0.8662 0.8367 [7,] 2.2685 1.3183 1.7588 1.0476 0.7176 2.0506 0.3001 1.0328 0.6802 0.7627 [,61] [,62] [,63] [,64] [,65] [,66] [,67] [,68] [,69] [,70] [1,] 0.5728 0.6360 1.8318 0.0000 1.0132 1.9181 0.8040 0.4004 1.2741 0.5077 [2,] 0.5795 0.6713 2.0207 0.4519 1.1365 2.0648 0.9784 2.0587 1.1821 0.5202 [3,] 0.5481 0.8863 1.4653 0.6983 0.8027 1.7848 0.8466 0.8413 0.8923 0.5175 [4,] 0.7371 1.2593 1.7920 0.3836 0.9294 2.0701 0.9747 0.0239 1.7385 0.4848 [5,] 0.8670 1.4922 1.7954 0.3535 0.9375 2.0617 0.9124 0.7316 1.8556 0.4251 [6,] 0.7371 1.5601 1.7625 0.2716 0.4719 2.3268 1.0122 3.4387 1.4483 0.4303 [7,] 0.7178 1.5580 1.5393 0.3030 0.4835 2.3371 0.9623 3.3554 1.8151 0.5163 [,71] [,72] [,73] [,74] [,75] [,76] [,77] [,78] [,79] [,80] [1,] 0.6393 0.6695 0.7341 3.1177 1.0612 0.9869 1.5022 1.4975 2.6966 0.5598 [2,] 0.6487 0.6373 1.1128 2.8328 1.5766 0.9442 1.5604 1.4759 2.3131 0.6480 [3,] 0.6900 0.7289 0.9715 0.0232 1.1032 0.8057 1.5432 1.4331 1.7672 0.5548 [4,] 0.5978 0.6882 1.5455 3.0001 1.2216 1.1953 1.6653 1.6380 2.6023 0.4065 [5,] 0.5996 0.7028 1.4575 3.1455 1.3787 1.2302 1.7229 1.7236 3.6546 0.3810 [6,] 0.6110 0.5836 1.8464 3.0989 1.3785 1.3623 2.7655 1.7400 3.8411 0.3471 [7,] 0.6490 0.7003 1.6020 3.3475 1.5140 1.4529 1.6478 1.9208 4.1872 0.3436 [,81] [,82] [,83] [,84] [,85] [,86] [,87] [,88] [,89] [,90] [1,] 1.1332 0.5786 0.9572 1.5901 1.5769 1.1179 0.0000 1.2964 0.8496 2.7930 [2,] 1.1047 0.5764 0.8528 1.8668 1.6138 1.1660 1.1041 1.3533 0.7799 2.7340 [3,] 0.8411 0.6818 0.9811 1.8228 1.3978 0.9622 1.3149 1.1153 0.7083 2.7997 [4,] 1.2507 0.7454 0.9740 1.8305 1.7241 1.2657 0.8888 1.5815 1.1426 3.0044 [5,] 1.3919 0.6987 0.9079 2.0339 1.6274 1.1805 1.0028 2.1570 0.9573 3.4497 [6,] 1.1667 0.6251 0.7915 2.0507 1.5661 1.2683 0.8225 1.2082 1.0617 3.4630 [7,] 1.1203 0.7233 0.8392 2.1667 1.5966 1.2496 1.0125 1.1947 0.9948 3.8446 [,91] [,92] [,93] [,94] [,95] [,96] [,97] [,98] [,99] [,100] [1,] 0.7746 2.0883 0.6455 1.3847 0.2497 0.5481 0.7320 1.2767 1.9347 0.9270 [2,] 0.4243 2.0449 0.5018 1.4319 0.2782 0.6644 0.3075 1.7461 2.1640 0.8391 [3,] 0.6646 1.4692 0.4594 1.5568 0.3702 0.5781 0.1325 1.2599 1.8563 0.7509 [4,] 5.1583 2.1898 0.4625 1.3362 0.4171 0.4026 0.1352 0.4355 2.9622 0.7787 [5,] 4.5891 2.4171 0.4097 1.3338 0.4775 1.1176 0.2027 0.3753 3.5541 0.6486 [6,] 2.1087 2.8860 0.3118 1.3268 0.5493 0.8087 0.3325 0.3980 4.5263 0.4873 [7,] 1.8259 2.8089 0.1877 1.2976 0.6342 1.5293 0.8757 0.8094 4.0317 0.6330 [,101] [,102] [,103] [,104] [,105] [,106] [,107] [,108] [,109] [,110] [1,] 1.4082 0.0455 0.1346 0.6744 2.0219 0.8151 0.6846 1.1391 0.4544 0.0000 [2,] 1.3647 0.0332 0.2516 0.6069 2.0072 0.6298 0.7844 1.0953 0.4368 0.0036 [3,] 1.3624 0.0281 0.1139 0.4883 2.1379 0.5257 0.8090 1.1654 0.3797 0.0123 [4,] 1.5517 0.0840 0.6379 0.5129 2.4197 0.6696 0.5259 1.2901 0.4645 0.0066 [5,] 1.7279 0.1931 0.2376 0.5631 2.1118 0.7563 0.6259 1.2702 0.6532 0.0110 [6,] 1.8206 0.0395 0.0605 0.5806 2.3721 0.6886 0.8733 2.2407 0.9107 0.0149 [7,] 1.6908 0.2423 0.0246 0.4882 2.4106 0.5632 0.9502 1.5611 0.9406 0.0113 [,111] [,112] [,113] [,114] [,115] [,116] [,117] [,118] [,119] [,120] [1,] 0.6783 1.2241 0.7844 0.0000 0.9737 0.5936 1.2761 1.0108 0.3136 0.1374 [2,] 0.6826 1.2363 0.6778 0.0000 1.3135 0.5303 1.2239 1.1785 0.2670 0.0489 [3,] 0.4869 1.2715 0.7362 0.0000 1.0628 0.3059 0.5310 0.6822 1.6107 0.0465 [4,] 0.3949 1.2136 0.6964 0.0606 0.9392 0.5561 1.5056 1.1264 0.1543 0.0315 [5,] 0.5859 1.1760 0.8430 0.0000 0.4692 0.6154 1.4535 1.1496 0.2344 0.0206 [6,] 0.6213 1.1945 1.1550 0.0068 1.1866 0.8565 1.3025 1.1894 0.2589 0.0233 [7,] 0.5409 1.1955 1.0888 0.0028 1.0059 1.1105 1.2391 1.0786 0.3313 0.0215 [,121] [,122] [,123] [,124] [,125] [,126] [,127] [,128] [,129] [,130] [1,] 0.7047 0.0986 1.2875 0.8857 0.3504 0.9805 1.1098 1.4675 0.7539 1.8229 [2,] 0.8558 0.0742 1.1506 0.8624 0.1936 1.0659 0.9409 1.3140 0.7881 1.5825 [3,] 0.4539 2.4845 1.2364 1.3511 2.6340 0.9621 2.4175 0.9507 0.6750 1.9592 [4,] 0.1185 0.0579 0.9299 0.6880 0.2319 0.5786 0.8093 1.0673 0.8418 0.9017 [5,] 0.1600 0.0874 0.8437 0.7139 0.1870 0.5985 0.8261 0.9202 0.8002 1.0272 [6,] 0.1883 0.1083 0.6849 0.7833 0.0504 0.5565 0.8414 0.9307 0.8718 1.2842 [7,] 0.2464 0.0993 1.0763 0.7882 0.0733 0.4766 0.8838 1.0629 1.0671 1.6019 [,131] [,132] [,133] [,134] [,135] [,136] [,137] [,138] [1,] 0.1132 0.0341 0.0000 0.2278 0.1061 0.3904 1.0067 0.7857 [2,] 0.1628 0.0604 2.0078 0.2444 0.1062 0.3889 0.7157 0.7584 [3,] 0.5901 2.1846 0.0981 2.6396 1.1063 0.6896 6.1894 3.6811 [4,] 0.0921 0.0402 1.3747 0.1565 0.1134 0.3436 0.0789 0.4710 [5,] 0.0782 0.0758 1.2732 0.2807 0.1155 0.2906 0.2205 0.4262 [6,] 0.0910 0.0926 1.7603 0.2249 0.1141 0.3347 0.0928 0.4223 [7,] 0.0863 0.0789 1.9149 0.1265 0.1234 0.3804 0.4894 0.4451 > > ## tallArray(), wideArray() ====================================== > all.equal(elind[,,1], rrcov3way:::tallArray(elind)[1:23,], check.attributes=FALSE) [1] TRUE > all.equal(elind[,,7], rrcov3way:::tallArray(elind)[(6*23+1):(7*23),], check.attributes=FALSE) [1] TRUE > all.equal(a, rrcov3way:::wideArray(elind)) [1] TRUE > > ## ilr, clr, gm ================================================== > data(ulabor) > rrcov3way:::.ilrV(ulabor[,,1]) Z1 Z2 Z3 Z4 Pie 0.95914891 0.62918738 0.10312211 -0.95925959 VdA 1.83662829 6.97526483 -1.94171106 -2.82777714 Lom 1.11628561 1.13939561 -0.63496334 -0.73730427 Lig 0.75320752 0.80720120 -0.24178790 -0.44847915 Tno 0.59729103 0.31568245 0.31954542 -0.35473886 Bol 0.38894149 0.13445667 0.43977942 -0.37355532 Tre 0.82247183 0.52537539 0.20443702 -0.34441821 Ven 1.30519657 1.08461647 -0.33026915 -0.82392969 Fri 1.42788732 1.24147851 -0.40305960 -0.84919181 Emi 1.28096784 0.64703464 0.94216407 -1.11602614 Tos 0.78194169 0.62922472 -0.20094481 -0.62620315 Umb 0.51188792 0.54415301 -0.31914128 -0.50787265 Mar 0.96361957 0.65727639 -0.05183718 -0.78681867 Laz 0.55022835 1.05926449 -0.58008852 -0.05927308 Abr 0.64469394 0.99582553 -0.72686881 -0.23319785 Mol 0.06621037 0.16242206 -0.21542425 -0.10359822 Cam 0.29418981 0.43422161 -0.34274266 -0.09492918 Pug 0.27357164 0.51703357 -0.47761701 -0.02007928 Bas -0.09024374 0.00235103 -0.15765355 0.17007734 Cal -0.13609106 0.22275135 -0.39502078 0.24944385 Sic 0.01357252 0.30632584 -0.36904059 0.13860126 Sar 0.23721505 0.39697255 -0.26811889 -0.19388793 > is.data.frame(rrcov3way:::.ilrV(as.data.frame(ulabor[,,1]))) [1] TRUE > > set.seed(1234) > x <- rnorm(100) > x[100] <- 0 > rrcov3way:::.gm(x) [1] 0 > try(rrcov3way:::.gm(c(1, 5, 6, "a"))) Error in rrcov3way:::.gm(c(1, 5, 6, "a")) : x has to be a vector of class numeric > > ## orthogonal matrices =========================================== > v <- matrix(rnorm(3), 3) > v <- v / norm(v, 'F') > x <- diag(3) - 2 * (v %*% t(v)) > rrcov3way:::is.orthogonal(x) [1] TRUE > rrcov3way:::is.orthonormal(x) [1] TRUE > zapsmall(x %*% t(x)) [,1] [,2] [,3] [1,] 1 0 0 [2,] 0 1 0 [3,] 0 0 1 > > ## reorder, do3Postprocess, do3Scale ============================= > data(elind) > > cp <- Parafac(elind, const="orth") > cp_r1 <- reorder(cp) # order =TRUE (default) > cp_r2 <- reorder(cp, order=FALSE) # order = FALSE > cp_r3 <- reorder(cp, order=c(2,1)) # order is a vector > try(cp_r4 <- reorder(cp, order=c(1,1))) # order is wrong Error in reorder.parafac(cp, order = c(1, 1)) : Incorrect new order specified. Must have length equal to 2 and contain unique integers in the range 1 to 2. > cpx <- do3Postprocess(cp, -1, -1, -1, reorder=TRUE) > cpy_A <- do3Scale(cp, renorm.mode="A") > cpy_B <- do3Scale(cp, renorm.mode="B") > cpy_C <- do3Scale(cp, renorm.mode="C") > > t3 <- Tucker3(elind) > t3_r1 <- reorder(t3) # order =TRUE (default), mode=A > t3_r2 <- reorder(t3, order=FALSE) # order = FALSE > t3_r3 <- reorder(t3, order=c(2,1)) # order is a vector > try(t3_r4 <- reorder(t3, order=c(1,1))) # order is wrong Error in reorder.tucker3(t3, order = c(1, 1)) : Incorrect new order specified. Must have length equal to 2 and contain unique integers in the range 1 to 2. > t3_r5 <- reorder(t3, mode="B") # order =TRUE (default), mode=B > t3_r5 <- reorder(t3, mode="C") # order =TRUE (default), mode=C > t3x <- do3Postprocess(t3, -1, -1, -1, TRUE, TRUE, TRUE) > t3y_A <- do3Scale(t3, renorm.mode="A") > t3y_B <- do3Scale(t3, renorm.mode="B") > t3y_C <- do3Scale(t3, renorm.mode="C") > > ## coordinates(), weights() - for Parafac and Tucker 3 ========== > data(elind) > > cp <- Parafac(elind) > try(coordinates(cp)) Error in coordinates.parafac(cp) : Solution is not normalized for mode A > try(weights(cp)) F1 F2 0.8413538 0.2397734 Warning message: In weights.parafac(cp) : It is not possible to obtain a partitioning of the total variability by components since none of the modes has orthogonal components! > > cp_a <- Parafac(elind, const=c("orth", "none", "none")) > ## IGNORE_RDIFF_BEGIN > coordinates(cp_a, mode="A") F1 F2 CA 0.17069233 -0.023461375 US 0.18160264 -0.045990439 JP 0.10379951 0.371628698 AS 0.22232876 -0.123031110 NZ 0.26745758 -0.130540142 BL 0.15419852 0.292218274 DA 0.26273085 0.032269564 FR 0.22653088 -0.091142110 RF 0.21829243 0.044089268 GR 0.31053561 -0.207132394 IR 0.12155013 -0.036556382 IT 0.18456490 -0.018528017 PB 0.20596542 0.009092305 RU 0.17511484 -0.049117852 AU 0.16780567 0.325263338 FI 0.16134680 0.406284786 NO 0.21819170 -0.122431730 PO 0.03443073 0.585748881 SP 0.18564331 -0.023916509 SV 0.22593720 -0.066715089 CH 0.30255844 -0.189277876 TU 0.22602909 0.107088364 YU 0.25473462 0.044889640 > coordinates(cp_a, mode="A", type="unit") F1 F2 CA 0.8186116 -0.11251680 US 0.8709357 -0.22056240 JP 0.4978050 1.78226863 AS 1.0662513 -0.59003648 NZ 1.2826815 -0.62604853 BL 0.7395101 1.40142961 DA 1.2600129 0.15475939 FR 1.0864039 -0.43710221 RF 1.0468937 0.21144470 GR 1.4892765 -0.99337207 IR 0.5829339 -0.17531825 IT 0.8851422 -0.08885725 PB 0.9877754 0.04360516 RU 0.8398213 -0.23556094 AU 0.8047677 1.55990817 FI 0.7737921 1.94847339 NO 1.0464106 -0.58716195 PO 0.1651240 2.80915295 SP 0.8903141 -0.11469955 SV 1.0835568 -0.31995433 CH 1.4510193 -0.90774480 TU 1.0839974 0.51357775 YU 1.2216643 0.21528315 > coordinates(cp_a, mode="A", type="principal") F1 F2 CA 0.6372702 -0.04275709 US 0.6780032 -0.08381509 JP 0.3875296 0.67727320 AS 0.8300519 -0.22421754 NZ 0.9985378 -0.23790235 BL 0.5756915 0.53255200 DA 0.9808908 0.05880953 FR 0.8457403 -0.16610157 RF 0.8149825 0.08035031 GR 1.1593672 -0.37748759 IR 0.4538006 -0.06662203 IT 0.6890626 -0.03376631 PB 0.7689603 0.01657023 RU 0.6537814 -0.08951463 AU 0.6264930 0.59277484 FI 0.6023792 0.74043205 NO 0.8146064 -0.22312521 PO 0.1285452 1.06749566 SP 0.6930888 -0.04358655 SV 0.8435238 -0.12158464 CH 1.1295849 -0.34494869 TU 0.8438669 0.19516275 YU 0.9510374 0.08180894 > weights(cp_a, mode="A") F1 F2 0.6060262 0.1444047 > ## IGNORE_RDIFF_END > > cp_b <- Parafac(elind, const=c("none", "orth", "none")) > ## IGNORE_RDIFF_BEGIN > coordinates(cp_b, mode="B") F1 F2 INFO -0.2406480 0.09976494 RADI -0.6633373 -0.64084564 TELE -0.3519255 0.39847302 STRU -0.4098844 0.62692632 ELET -0.3201722 0.12456790 COMP -0.3281847 -0.10967817 > coordinates(cp_b, mode="B", type="unit") F1 F2 INFO -0.5894647 0.2443732 RADI -1.6248379 -1.5697448 TELE -0.8620378 0.9760556 STRU -1.0040076 1.5356496 ELET -0.7842586 0.3051278 COMP -0.8038850 -0.2686556 > coordinates(cp_b, mode="B", type="principal") F1 F2 INFO -0.4541652 0.09717767 RADI -1.2518897 -0.62422613 TELE -0.6641747 0.38813913 STRU -0.7735582 0.61066780 ELET -0.6042481 0.12133739 COMP -0.6193697 -0.10683381 > weights(cp_b, mode="B") F1 F2 0.5936248 0.1581342 > ## IGNORE_RDIFF_END > > cp_c <- Parafac(elind, const=c("none", "none", "orth")) > ## IGNORE_RDIFF_BEGIN > coordinates(cp_c, mode="C") F1 F2 78 -0.3418322 0.01048521 79 -0.3616639 -0.04115953 80 -0.3745816 0.90526859 82 -0.3701731 -0.22876975 83 -0.3920754 -0.22837022 84 -0.4007089 -0.21141363 85 -0.4008987 -0.17175696 > coordinates(cp_c, mode="C", type="unit") F1 F2 78 -0.9044030 0.02774127 79 -0.9568726 -0.10889787 80 -0.9910497 2.39511557 82 -0.9793861 -0.60526786 83 -1.0373341 -0.60421080 84 -1.0601760 -0.55934789 85 -1.0606782 -0.45442621 > coordinates(cp_c, mode="C", type="principal") F1 F2 78 -0.7305796 0.006012688 79 -0.7729647 -0.023602707 80 -0.8005731 0.519121342 82 -0.7911512 -0.131186764 83 -0.8379618 -0.130957656 84 -0.8564135 -0.121233994 85 -0.8568192 -0.098493094 > weights(cp_c, mode="C") F1 F2 0.65254597 0.04697695 > ## IGNORE_RDIFF_END > > t3 <- Tucker3(elind) > coordinates(t3, mode="A") F1 F2 CA -0.1556928 -0.039384999 US -0.1596023 -0.036977765 JP -0.2074926 0.333831535 AS -0.1774960 -0.170494706 NZ -0.2198732 -0.255566732 BL -0.2317486 0.223794570 DA -0.2592438 -0.008695301 FR -0.1898311 -0.141458684 RF -0.2210294 -0.004850266 GR -0.2369923 -0.340488908 IR -0.1056487 -0.024817329 IT -0.1708512 -0.047328231 PB -0.1999404 0.005689253 RU -0.1522773 -0.061885037 AU -0.2537717 0.256033417 FI -0.2727805 0.318228333 NO -0.1733777 -0.168826100 PO -0.1975292 0.540659823 SP -0.1704018 -0.066963960 SV -0.1962796 -0.111342369 CH -0.2336278 -0.301631604 TU -0.2578067 -0.022560196 YU -0.2557395 -0.049002327 > coordinates(t3, mode="A", type="unit") F1 F2 CA -0.7466763 -0.18888382 US -0.7654257 -0.17733913 JP -0.9950996 1.60099980 AS -0.8512411 -0.81766389 NZ -1.0544750 -1.22565499 BL -1.1114273 1.07328105 DA -1.2432895 -0.04170120 FR -0.9103979 -0.67841201 RF -1.0600197 -0.02326106 GR -1.1365753 -1.63292744 IR -0.5066736 -0.11901973 IT -0.8193735 -0.22697822 PB -0.9588807 0.02728470 RU -0.7302962 -0.29679021 AU -1.2170463 1.22789313 FI -1.3082095 1.52616947 NO -0.8314902 -0.80966153 PO -0.9473168 2.59291342 SP -0.8172185 -0.32114787 SV -0.9413240 -0.53397924 CH -1.1204396 -1.44657435 TU -1.2363975 -0.10819490 YU -1.2264834 -0.23500691 > coordinates(t3, mode="A", type="principal") F1 F2 CA -0.6046594 -0.058657424 US -0.6198426 -0.055072249 JP -0.8058328 0.497186711 AS -0.6893360 -0.253923591 NZ -0.8539151 -0.380624266 BL -0.9000351 0.333304899 DA -1.0068173 -0.012950208 FR -0.7372412 -0.210679250 RF -0.8584052 -0.007223667 GR -0.9204000 -0.507101763 IR -0.4103049 -0.036961297 IT -0.6635296 -0.070487552 PB -0.7765027 0.008473199 RU -0.5913947 -0.092167500 AU -0.9855655 0.381319316 FI -1.0593895 0.473948328 NO -0.6733417 -0.251438479 PO -0.7671383 0.805223146 SP -0.6617845 -0.099731714 SV -0.7622853 -0.165825994 CH -0.9073333 -0.449230253 TU -1.0012361 -0.033599670 YU -0.9932077 -0.072980841 > weights(t3, mode="A") F1 F2 0.65577790 0.09643984 > > coordinates(t3, mode="B") F1 F2 INFO -0.2606262 0.04648553 RADI -0.4177928 -0.84102391 TELE -0.4628275 0.26525135 STRU -0.5912361 0.43056143 ELET -0.3430730 0.03610088 COMP -0.2757802 -0.18295677 > coordinates(t3, mode="B", type="unit") F1 F2 INFO -0.6384012 0.11386584 RADI -1.0233793 -2.06007944 TELE -1.1336911 0.64973047 STRU -1.4482266 1.05465580 ELET -0.8403537 0.08842874 COMP -0.6755209 -0.44815073 > coordinates(t3, mode="B", type="principal") F1 F2 INFO -0.5169780 0.03536077 RADI -0.8287337 -0.63975281 TELE -0.9180644 0.20177226 STRU -1.1727756 0.32752087 ELET -0.6805194 0.02746134 COMP -0.5470376 -0.13917215 > weights(t3, mode="B") [1] 0.65315691 0.09906083 > > coordinates(t3, mode="C") F1 F2 78 -0.3279653 -0.5821066 79 -0.3598555 -0.3200773 80 -0.3380251 -0.4703146 82 -0.3810908 0.2738088 83 -0.4048029 0.2477407 84 -0.4127011 0.2898863 85 -0.4114171 0.3422365 > coordinates(t3, mode="C", type="unit") F1 F2 78 -0.8677147 -1.5401093 79 -0.9520883 -0.8468450 80 -0.8943303 -1.2443354 82 -1.0082716 0.7244300 83 -1.0710078 0.6554603 84 -1.0919044 0.7669670 85 -1.0885073 0.9054727 > coordinates(t3, mode="C", type="principal") F1 F2 78 -0.7026764 -0.4782773 79 -0.7710022 -0.2629857 80 -0.7242297 -0.3864254 82 -0.8164995 0.2249700 83 -0.8673034 0.2035516 84 -0.8842254 0.2381798 85 -0.8814744 0.2811924 > weights(t3, mode="C") [1] 0.747502095 0.004715646 > > ## mtrace() ====================================================== > (a <- matrix(c(5,2,3, 4,-3,7, 4,1,2), ncol=3)) [,1] [,2] [,3] [1,] 5 4 4 [2,] 2 -3 1 [3,] 3 7 2 > (b <- matrix(c(1,0,1, 0,1,2, 1,0,3), ncol=3)) [,1] [,2] [,3] [1,] 1 0 1 [2,] 0 1 0 [3,] 1 2 3 > > mtrace(a) [1] 4 > mtrace(b) [1] 5 > > ## tr(A+B)=tr(A)+tr(B) > all.equal(mtrace(a) + mtrace(b), mtrace(a+b)) [1] TRUE > > ## tr(A)=tr(A') > all.equal(mtrace(a), mtrace(t(a))) [1] TRUE > > ## tr(alphA)=alphatr(A) > alpha <- 0.5 > all.equal(mtrace(alpha*a), alpha*mtrace(a)) [1] TRUE > > ## tr(AB)=tr(BA) > all.equal(mtrace(a %*% b), mtrace(b %*% a)) [1] TRUE > > ## tr(A)=tr(BAB-1) > all.equal(mtrace(a), mtrace(b %*% a %*% solve(b))) [1] TRUE > > try(mtrace(c(1, 2, 3, 4))) # not a matrix Error in mtrace(c(1, 2, 3, 4)) : 'A' is not a square matrix. > try(mtrace(matrix(1:20, nrow=5))) # not a square matrix Error in mtrace(matrix(1:20, nrow = 5)) : 'A' is not a square matrix. > try(mtrace(matrix(rep("A", 25), nrow=5))) # not a numeric matrix Error in mtrace(matrix(rep("A", 25), nrow = 5)) : 'A' is not a numeric matrix. > > > ## krp() ========================================================= > a <- matrix(1:12, 3, 4) > b <- diag(1:4) > c <- diag(1:3) > krp(a, b) [,1] [,2] [,3] [,4] [1,] 1 0 0 0 [2,] 0 8 0 0 [3,] 0 0 21 0 [4,] 0 0 0 40 [5,] 2 0 0 0 [6,] 0 10 0 0 [7,] 0 0 24 0 [8,] 0 0 0 44 [9,] 3 0 0 0 [10,] 0 12 0 0 [11,] 0 0 27 0 [12,] 0 0 0 48 > krp(b, a) [,1] [,2] [,3] [,4] [1,] 1 0 0 0 [2,] 2 0 0 0 [3,] 3 0 0 0 [4,] 0 8 0 0 [5,] 0 10 0 0 [6,] 0 12 0 0 [7,] 0 0 21 0 [8,] 0 0 24 0 [9,] 0 0 27 0 [10,] 0 0 0 40 [11,] 0 0 0 44 [12,] 0 0 0 48 > try(krp(a, c)) Error in krp(a, c) : A and B must have same number of columns. > > ## congruence ==================================================== > ## Ignore warning messages of rrcov built version > ## IGNORE_RDIFF_BEGIN > require(rrcov) Loading required package: rrcov Loading required package: robustbase Scalable Robust Estimators with High Breakdown Point (version 1.7-5) > ## IGNORE_RDIFF_END > > data(delivery, package="robustbase") > X <- getLoadings(PcaClassic(delivery)) > Y <- getLoadings(PcaHubert(delivery, k=3)) > round(congruence(X,Y),3) PC1 PC2 PC3 PC1 -1.000 -0.028 -0.002 PC2 0.028 -0.999 -0.047 PC3 -0.001 -0.047 0.999 > try(congruence(X,Y[1:2,])) Error in congruence(X, Y[1:2, ]) : Both 'x' and 'y' must have the same length (number of rows) > > proc.time() user system elapsed 0.87 0.14 1.00