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)) > > ## VT::14.01.2020 - added ## IGNORE_RDIFF_BEGIN/END > ## when printing the A, B and C matrices - because this could cause > ## differences on some platform, e.g. see for example sign indeterminacy > ## > > ## Example with the UNIDO Manufacturing value added data > data(va3way) > dim(va3way) [1] 49 5 14 > > ## Treat quickly and dirty the zeros in the data set (if any) > va3way[va3way==0] <- 0.001 > > (res <- Parafac(va3way)) Call: Parafac(X = va3way) PARAFAC analysis with 2 components. Fit value: 1.975174e+23 Fit percentage: 94.18 % > print(res$fit) [1] 1.975174e+23 > ## IGNORE_RDIFF_BEGIN > print(res$A) F1 F2 ALB -902018571 -482040759 AUT 98493949125 1843116667 BEL 120131489068 6021626063 BRA 110723351715 -128731150956 BGR -1725424351 -3038300858 CAN 110358962978 -58000053813 TWN 191307490443 14538814942 COL -29137395627 -24411767514 CRI -5250286694 -3505188657 CYP -2205671769 -1402806712 CZE 64651432568 2376871721 DNK 74661471982 6837998962 ECU -15216882298 -8467267503 EST -1361076185 -1597419767 FIN 45716081016 -2433135394 FRA 479085145468 20981683652 GEO -1008836124 -574825749 PSE -2104516510 -1085575307 DEU 1967262545398 310462217202 HUN 54919306659 5898973896 IND 103753178408 -36486104268 IDN -15237038603 -44492524975 IRN 71304108103 -2685525581 ISR 25506415325 -1541927367 ITA 372972323463 -18908016725 JOR -2473795308 -2823354664 KOR 699167196711 63129387980 LVA -2576100740 -1748677555 LTU -2399229232 -2293735330 MUS -3600697742 -1709252471 OMN 2171465511 -2232465857 NLD 132065387126 4059709231 NOR 30328276815 -3416689572 PER -33222057490 -19655063344 POL 41650905927 -19080231237 PRT -4914374675 -12625510723 QAT 15519539977 -542197110 ROU 3489406966 -6546289048 RUS -77524419811 -114428281021 SEN -610558600 -507013174 SGP 125741893009 24835042296 SVK 12904388462 -829183806 SVN 16969810438 1215470659 ESP 141163893653 -29795191608 SWE 148841617606 15483416876 CHE 248060161299 36636089080 TUR 7206450504 -29911604682 GBR 430353262910 18248399707 YEM -6508548624 -2984102864 > print(res$B) F1 F2 LAGRO -0.4458674 -1.4948276 LNAGR -0.1221742 -0.2721038 MLOW -0.5615876 -1.6153421 MHIGH -0.7302255 -1.1785792 HIGH -0.2180701 -0.4054139 > print(res$C) F1 F2 2000 -0.1700552 0.1912501 2001 -0.1640811 0.1807036 2002 -0.1694006 0.1845830 2003 -0.2026439 0.2186408 2004 -0.2354564 0.2604919 2005 -0.2524717 0.3031857 2006 -0.2797046 0.3487763 2007 -0.3218819 0.4121495 2008 -0.3380029 0.4601496 2009 -0.2727302 0.3689553 2010 -0.3302270 0.4674803 2011 -0.3708474 0.5320381 2012 -0.3472206 0.5069454 2013 -0.3574029 0.5143714 > ## IGNORE_RDIFF_END > print(res$rd) ALB AUT BEL BRA BGR CAN 234428399 12732118552 21655277184 123072567049 2010716375 80115809466 TWN COL CRI CYP CZE DNK 155262018442 11910450190 3410140165 1315472375 12388880639 14542575648 ECU EST FIN FRA GEO PSE 4827796189 1199330744 23999444169 83054759665 408704360 557770059 DEU HUN IND IDN IRN ISR 119801928598 5954414508 73627967904 72553282520 41476983926 24019872754 ITA JOR KOR LVA LTU MUS 88263427690 1878308024 255618874585 1849309242 2320082131 1929405788 OMN NLD NOR PER POL PRT 7882398714 25182999436 13267114738 8408715259 21923548230 13962501719 QAT ROU RUS SEN SGP SVK 17397133577 7733273689 121409943981 276894699 45092204922 5571313235 SVN ESP SWE CHE TUR GBR 2907156883 74925072362 20025651256 40898685638 21316691503 125437081055 YEM 1610642742 > print(res$cutoff.rd) [1] 141136856101 > > ## IGNORE_RDIFF_BEGIN > (res.r <- Parafac(va3way, robust=TRUE, center=TRUE, scale=TRUE, trace=TRUE)) Step 1. Perform robust PCA on the unfolded matrix. Applying the projection method of Hubert: skew= FALSE Eigenvalues of S0: 810.6531 179.2591 46.65612 27.2674 6.567302 3.158557 2.254428 1.622986 0.4777452 0.3685458 0.2603778 0.1868374 0.1638754 0.1493551 0.115993 0.1025762 0.06928851 0.04001834 0.03484661 0.03108238 0.02687282 0.0171684 0.01601002 0.0136659 0.009830492 0.007668458 0.007497556 0.005700837 0.005273998 0.003578925 0.002509835 0.002080959 0.001619895 0.001036512 0.0007941593 0.0004706881 0.0002431724 0.0002164335 0.000103942 7.447594e-05 4.972661e-05 3.301644e-05 2.673773e-05 1.789167e-05 1.238335e-05 6.694486e-06 3.020284e-06 1.26007e-06 Total variance: 1079.562 Explained variance: 0.7509092 0.9169572 0.9601748 0.9854326 0.9915159 0.9944417 0.99653 0.9980334 0.9984759 0.9988173 0.9990585 0.9992315 0.9993833 0.9995217 0.9996291 0.9997241 0.9997883 0.9998254 0.9998577 0.9998865 0.9999114 0.9999273 0.9999421 0.9999547 0.9999639 0.999971 0.9999779 0.9999832 0.9999881 0.9999914 0.9999937 0.9999956 0.9999971 0.9999981 0.9999988 0.9999993 0.9999995 0.9999997 0.9999998 0.9999999 0.9999999 0.9999999 1 1 1 1 1 1 The number of principal components is set by the algorithm. It is set to 2. Xsvd$rank, Xh.svd$rank, k and kmax: 48 48 2 48 Perform extra reweighting step (k != rank) 2 Cutoff for the orthogonal distances: .........: 19.79509 umcd.....: 19.79509 medmad...: 4.60457 The default of 'doScale' is FALSE now for stability; set options(mc_doScale_quiet=TRUE) to suppress this (once per session) message skewed...: 30.44867 classic..: 19.79509 Perform extra reweighting step (k != rank) 2 ...Ready. Iter= 1 h= 49 k= 2 obj= 60697.25 Iter= 2 h= 49 k= 2 obj= 139992.9 Iter= 3 h= 49 k= 2 obj= 139992.9 MCD crit= 4.644589 and C-Step obj function= 139992.9 Abs difference= 139988.3 Final step - PC of MCD cov used. Eigenvalues of X2: [1] 46.691223 1.584786 Candecomp/Parafac function value at Start is 6393.62804653566 f= 235.163056855737 after 50 iters; diff.= 0.00250072376849175 Candecomp/Parafac function value is 235.127228132407 after 90 iterations Fit percentage is 96.23 % --- ALS 1 Fit, Fitprev, changeFit, iter 231.8375 0 1.000001 90 Candecomp/Parafac function value at Start is 5911.45975358161 Candecomp/Parafac function value is 217.775356654239 after 36 iterations Fit percentage is 96.22 % --- ALS 2 Fit, Fitprev, changeFit, iter 217.7753 231.8375 0.06065564 36 Candecomp/Parafac function value at Start is 5911.45975358161 Candecomp/Parafac function value is 217.775356654239 after 36 iterations Fit percentage is 96.22 % --- ALS 3 Fit, Fitprev, changeFit, iter 217.7753 217.7753 0 36 --- --- Candecomp/Parafac function value at Start is 5911.45975358161 Candecomp/Parafac function value is 217.775356654239 after 36 iterations Fit percentage is 96.22 % Call: Parafac(X = va3way, center = TRUE, scale = TRUE, robust = TRUE, trace = TRUE) PARAFAC analysis with 2 components. Fit value: 217.7753 Fit percentage: 99.64 % Robust > ## IGNORE_RDIFF_END > > print(res.r$fit) [1] 217.7753 > ## IGNORE_RDIFF_BEGIN > print(res.r$A) F1 F2 ALB -5.6133302 -0.11981990 AUT 8.4122897 -0.75585399 BEL 8.7341889 -2.22085241 BRA 58.9493483 -11.04129243 BGR -4.4928789 -0.39535814 CAN 38.7275921 -2.67923571 TWN 3.2290749 55.55310347 COL 1.6468931 -3.14720028 CRI -4.7180911 -0.41470502 CYP -5.2339191 -0.27715307 CZE 1.7694269 -0.66849090 DNK 3.2991971 -0.16490531 ECU -3.9316164 -0.99063560 EST -5.0071348 -0.19536336 FIN 2.4097651 3.67826797 FRA 54.1192743 12.22551450 GEO -5.5931622 -0.10423295 PSE -5.4320243 -0.20256193 DEU 113.2999366 16.34577406 HUN -1.5961738 1.15470790 IND 18.5731053 -2.72690826 IDN 8.7957157 0.32915489 IRN 2.4628096 -2.42854475 ISR -2.4850031 7.62191142 ITA 63.3085467 -6.56775016 JOR -4.7492580 -0.47303360 KOR 29.0336111 101.65036260 LVA -5.1219964 -0.24498897 LTU -4.6758033 -0.29492569 MUS -5.3381874 -0.25784159 OMN -4.6435979 -0.51986518 NLD 13.6078869 -0.03812636 NOR 0.9347939 2.84776813 PER -0.7316754 -2.10352302 POL 10.6366583 -2.99224766 PRT 0.8668781 -1.92465483 QAT -3.9578946 -0.74269233 ROU -1.9141585 -0.54222602 RUS 33.3940576 -11.00902658 SEN -5.5733638 -0.13928151 SGP -3.6956520 18.14334186 SVK -3.8707215 0.01057545 SVN -3.7785055 -0.42075889 ESP 34.6119116 -8.66007334 SWE 7.8799689 3.20653128 CHE 8.6920341 16.89938031 TUR 8.7895492 -4.18100240 GBR 64.8955196 10.50391635 YEM -5.2163477 -0.34186027 > print(res.r$B) F1 F2 LAGRO -0.4023307 -0.06375484 LNAGR -0.5712400 0.17933171 MLOW -0.4534795 -0.01308755 MHIGH -0.3687927 0.18446432 HIGH -0.4125084 0.96414578 > print(res.r$C) F1 F2 2000 -0.2009230 0.1730709 2001 -0.1922098 0.1327147 2002 -0.2041326 0.1625033 2003 -0.2425606 0.1752115 2004 -0.2770085 0.2014411 2005 -0.2802203 0.2295734 2006 -0.2983354 0.2525171 2007 -0.3402638 0.2837547 2008 -0.3421757 0.2841423 2009 -0.2519694 0.2610088 2010 -0.2647340 0.3281350 2011 -0.2834956 0.3610032 2012 -0.2529873 0.3654333 2013 -0.2590555 0.3706252 > ## IGNORE_RDIFF_END > print(res.r$rd) ALB AUT BEL BRA BGR CAN TWN COL 1.380733 2.117198 2.232085 32.042701 1.125596 13.916163 13.911609 2.498593 CRI CYP CZE DNK ECU EST FIN FRA 1.224290 1.421948 1.868921 3.223176 1.234625 1.386309 5.304359 9.431010 GEO PSE DEU HUN IND IDN IRN ISR 1.359619 1.378508 40.747110 1.244472 15.349949 11.587095 6.313337 2.645013 ITA JOR KOR LVA LTU MUS OMN NLD 5.137785 1.092373 36.933779 1.388099 1.441188 1.335564 1.405466 4.352509 NOR PER POL PRT QAT ROU RUS SEN 2.664414 2.276140 2.939087 1.919542 1.951443 1.148447 23.066739 1.364999 SGP SVK SVN ESP SWE CHE TUR GBR 2.138500 1.028358 1.426231 6.495694 3.408052 3.653037 4.197601 26.721047 YEM 1.216950 > print(res$cutoff.rd) [1] 141136856101 > print(res.r$Hset) [1] 1 2 3 5 8 9 10 11 12 13 14 15 17 18 20 24 25 26 28 29 30 31 32 33 34 [26] 35 36 37 38 40 41 42 43 45 46 47 49 > print(res.r$flag) ALB AUT BEL BRA BGR CAN TWN COL CRI CYP CZE DNK ECU TRUE TRUE TRUE FALSE TRUE FALSE FALSE TRUE TRUE TRUE TRUE TRUE TRUE EST FIN FRA GEO PSE DEU HUN IND IDN IRN ISR ITA JOR TRUE TRUE FALSE TRUE TRUE FALSE TRUE FALSE FALSE FALSE FALSE FALSE TRUE KOR LVA LTU MUS OMN NLD NOR PER POL PRT QAT ROU RUS FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE SEN SGP SVK SVN ESP SWE CHE TUR GBR YEM TRUE FALSE TRUE TRUE FALSE FALSE FALSE TRUE FALSE TRUE > > (res.c <- Parafac(va3way, coda.transform="ilr")) Call: Parafac(X = va3way, coda.transform = "ilr") PARAFAC analysis with 2 components. Fit value: 489.8643 Fit percentage: 89.53 % ilr-transformed > print(res.c$fit) [1] 489.8643 > ## IGNORE_RDIFF_BEGIN > print(res.c$A) F1 F2 ALB -8.2134927 1.1651621 AUT -2.5352759 1.6283758 BEL -3.4533002 2.0614272 BRA -3.9772523 2.2664792 BGR -5.5747298 1.6429969 CAN -2.5526012 1.9122985 TWN 4.9632956 1.7387796 COL -10.3666112 1.8792481 CRI -17.9229349 1.5254605 CYP -11.8545968 0.5476735 CZE -2.9295691 2.1189461 DNK -2.2693830 1.2245954 ECU -17.6102795 2.1617249 EST -5.2371931 0.5475275 FIN 0.1151226 1.5394131 FRA -0.8124392 1.6875968 GEO -5.1675790 1.1542888 PSE -19.9047928 0.4012025 DEU -0.5389454 2.1589983 HUN -0.1840305 2.3314912 IND -2.7324755 3.0119559 IDN -2.2908433 2.1832157 IRN -3.8008813 4.3372256 ISR 2.8725699 1.0837907 ITA -3.1449576 1.6210235 JOR -12.1496250 1.9341977 KOR 3.8403158 2.7802273 LVA -6.0916144 0.5374683 LTU -5.1774505 0.3737229 MUS -13.1518398 -0.3978580 OMN -12.2199015 2.9531598 NLD -2.1967632 1.4081314 NOR -0.2046504 1.0616825 PER -12.2095707 1.2320182 POL -4.3492907 1.5165066 PRT -6.0785421 1.1682153 QAT -19.5314128 3.5545576 ROU -4.1629902 1.4327684 RUS -5.5702053 2.2760590 SEN -9.1074980 2.5827669 SGP 7.8785629 1.7584709 SVK -2.5770559 2.1749274 SVN -3.8037152 1.8891558 ESP -4.7265671 1.5892454 SWE -0.9077992 1.7752583 CHE 2.1222967 1.5617470 TUR -5.8546826 2.0732667 GBR -0.9576233 1.0289954 YEM -19.4635409 0.2865485 > print(res.c$B) F1 F2 Z1 0.21488734 0.7373969 Z2 -0.01922373 -0.7590357 Z3 0.28791828 -0.8298999 Z4 0.83161168 0.2865615 > print(res.c$Bclr) F1 F2 LAGRO 0.41316911 0.03604894 LNAGR 0.10927252 -1.00678777 MLOW 0.28476498 0.44425572 MHIGH -0.06339052 0.78279150 HIGH -0.74381610 -0.25630839 > print(res.c$C) F1 F2 2000 -0.2728098 0.4436053 2001 -0.2633594 0.4347128 2002 -0.2696630 0.4328468 2003 -0.2765852 0.4449207 2004 -0.2828670 0.4446104 2005 -0.2790460 0.4649566 2006 -0.2800852 0.4818639 2007 -0.2796731 0.5038971 2008 -0.2658551 0.5326178 2009 -0.2677522 0.5495487 2010 -0.2584331 0.5634937 2011 -0.2797404 0.5777698 2012 -0.2434560 0.5962351 2013 -0.2101968 0.5861743 > ## IGNORE_RDIFF_END > print(res.c$rd) ALB AUT BEL BRA BGR CAN TWN 5.2169331 1.1322475 1.2809309 1.4930119 1.9736834 2.4198888 3.0838030 COL CRI CYP CZE DNK ECU EST 1.5584228 6.0699707 2.7012636 1.0643003 2.2483467 2.5410864 2.2613763 FIN FRA GEO PSE DEU HUN IND 2.8365152 0.9264914 4.4572039 4.6560974 2.0097015 1.1585585 1.6885484 IDN IRN ISR ITA JOR KOR LVA 4.4494551 1.8410158 3.1289733 0.6775974 2.4276945 3.0129855 3.6413124 LTU MUS OMN NLD NOR PER POL 3.2024080 5.2982264 5.6783288 1.4969126 1.9988882 2.1096980 1.2517961 PRT QAT ROU RUS SEN SGP SVK 2.1420993 10.2384085 2.2447575 2.0565824 2.8451469 2.1396369 1.3239266 SVN ESP SWE CHE TUR GBR YEM 2.2982483 0.8186082 2.0483339 1.4336866 1.7595056 1.2938921 4.5443328 > print(res$cutoff.rd) [1] 141136856101 > > (res.rc <- Parafac(va3way, robust=TRUE, coda.transform="ilr", center=TRUE, + scale=TRUE)) Call: Parafac(X = va3way, center = TRUE, scale = TRUE, robust = TRUE, coda.transform = "ilr") PARAFAC analysis with 2 components. Fit value: 388.9267 Fit percentage: 93.17 % Robust, ilr-transformed > print(res.rc$fit) [1] 388.9267 > ## IGNORE_RDIFF_BEGIN > print(res.rc$A) F1 F2 ALB -9.2401203 2.988609116 AUT 2.6658533 -1.121033362 BEL 2.0926645 1.144461380 BRA -0.2143791 3.286473914 BGR -2.8550334 0.605487491 CAN 0.6293789 0.394045753 TWN 8.9338834 -1.514557131 COL -7.1593092 4.973381458 CRI -14.0523288 4.913315543 CYP -11.0180741 0.001792321 CZE 3.0044667 2.025654773 DNK 2.8097171 -4.940274635 ECU -14.7048740 13.822287126 EST -3.9925283 -5.162424122 FIN 2.8112533 -3.100473797 FRA 3.5257293 -2.127460104 GEO -5.1175352 -0.330800808 PSE -17.6108013 4.801168408 DEU 6.6598995 -0.419278487 HUN 5.1467611 0.717454836 IND 2.3966577 7.946639048 IDN -1.3218841 -0.197935309 IRN 3.3796422 15.839664588 ISR 5.4079984 -5.283782983 ITA 1.3906070 -0.666535701 JOR -7.7810070 5.751151861 KOR 8.2363583 2.549051540 LVA -6.4817892 -5.484001102 LTU -4.6147068 -5.907375930 MUS -17.4590134 -4.359967346 OMN -3.8539338 16.505526924 NLD 2.1484968 -3.672205420 NOR 2.6302984 -5.766967411 PER -10.2117814 3.416012740 POL -0.3547780 -0.260881402 PRT -3.7776231 -1.474832890 QAT -5.0288660 21.332408749 ROU -1.8921571 -1.468659781 RUS -1.0177615 7.031592113 SEN -6.6506533 8.171982633 SGP 15.4495964 -6.548803029 SVK 3.1005029 2.762123856 SVN 2.4242704 0.460043499 ESP -0.2789826 0.347151485 SWE 4.1574773 -2.504238768 CHE 7.6617808 -5.357670239 TUR -2.5608179 3.264200807 GBR 3.0759667 -5.950758856 YEM -21.9297834 7.145154450 > print(res.rc$B) F1 F2 Z1 0.2879257 0.3554850 Z2 0.4073617 -0.8259547 Z3 0.6988995 -0.2989294 Z4 0.5125376 0.3194847 > print(res.rc$Bclr) F1 F2 LAGRO 0.68626070 -0.1006833 LNAGR 0.27907229 -0.6034150 MLOW -0.01624762 0.6595347 MHIGH -0.49065783 0.3303194 HIGH -0.45842755 -0.2857558 > print(res.rc$C) F1 F2 2000 -0.2596094 0.3102358 2001 -0.2644092 0.2850079 2002 -0.2674298 0.2669159 2003 -0.2761062 0.2687576 2004 -0.2896239 0.2586457 2005 -0.2882257 0.2651719 2006 -0.2886960 0.2678373 2007 -0.2948126 0.2831190 2008 -0.2706634 0.2773684 2009 -0.2612527 0.2618790 2010 -0.2620241 0.2391157 2011 -0.2324859 0.2201325 2012 -0.2455026 0.2590368 2013 -0.2307206 0.2677574 > ## IGNORE_RDIFF_END > print(res.rc$rd) ALB AUT BEL BRA BGR CAN TWN COL 7.429693 2.110481 1.768319 2.466280 2.359288 4.682996 7.271647 2.525149 CRI CYP CZE DNK ECU EST FIN FRA 10.701746 4.559559 2.055042 3.798550 4.987594 2.554691 3.701281 1.368996 GEO PSE DEU HUN IND IDN IRN ISR 6.184612 10.341456 2.669938 2.178145 3.615771 7.807650 3.584800 6.555243 ITA JOR KOR LVA LTU MUS OMN NLD 1.340983 4.481407 7.290398 3.451039 3.391881 4.799101 11.523281 2.018496 NOR PER POL PRT QAT ROU RUS SEN 2.943798 3.686298 2.610409 1.877249 18.671197 2.381860 4.253388 4.851418 SGP SVK SVN ESP SWE CHE TUR GBR 4.610711 2.422572 3.702791 2.189470 2.407500 1.790170 2.533719 1.956241 YEM 7.618569 > print(res$cutoff.rd) [1] 141136856101 > print(res.rc$Hset) [1] 2 3 4 5 6 8 10 11 12 13 14 15 16 19 20 21 23 25 26 28 29 30 32 33 34 [26] 35 36 38 39 40 42 43 44 45 46 47 48 > print(res.rc$flag) ALB AUT BEL BRA BGR CAN TWN COL CRI CYP CZE DNK ECU FALSE TRUE TRUE TRUE TRUE TRUE FALSE TRUE FALSE TRUE TRUE TRUE FALSE EST FIN FRA GEO PSE DEU HUN IND IDN IRN ISR ITA JOR TRUE TRUE TRUE FALSE FALSE TRUE TRUE TRUE FALSE FALSE FALSE TRUE TRUE KOR LVA LTU MUS OMN NLD NOR PER POL PRT QAT ROU RUS FALSE TRUE TRUE FALSE FALSE TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE SEN SGP SVK SVN ESP SWE CHE TUR GBR YEM TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE > > ##================================================================ > ## > ## Example with the TV data from ThreeWay: ratings of 15 American television > ## shows on 16 bipolar scales made by 30 students: 15x16x30 array > ## in A-mode, i.e. 15x450. > data(TV, package="ThreeWay") > > ## Transform to 3-way array, to pass to Parafac() and set the dimnames > tv <- toArray(TV[[1]], 30, 16, 15, mode="B") > dimnames(tv)[[1]] <- TV[[4]] > dimnames(tv)[[2]] <- TV[[2]] > dimnames(tv)[[3]] <- TV[[3]] > > (tvcp <- Parafac(tv, 2)) Call: Parafac(X = tv, ncomp = 2) PARAFAC analysis with 2 components. Fit value: 60448.91 Fit percentage: 40.32 % > > ## IGNORE_RDIFF_BEGIN > tvcp$A; tvcp$B; tvcp$C; tvcp$GA F1 F2 Student 1 28.20179 16.075038 Student 2 33.62310 24.665986 Student 3 36.02469 19.422640 Student 4 17.72004 8.513186 Student 5 17.65531 5.481218 Student 6 25.15715 18.808693 Student 7 15.57876 10.879655 Student 8 20.80833 17.297011 Student 9 39.62199 23.489936 Student 10 40.26835 22.855892 Student 11 21.10459 9.692475 Student 12 39.51864 21.340683 Student 13 35.82538 28.978071 Student 14 27.20539 11.612080 Student 15 29.31589 11.230165 Student 16 19.24097 10.251974 Student 17 24.12598 20.122332 Student 18 37.29077 20.584110 Student 19 39.79069 12.020866 Student 20 26.08499 13.028095 Student 21 32.32501 18.785949 Student 22 31.38384 20.606630 Student 23 34.95060 19.752821 Student 24 34.14619 15.500143 Student 25 26.70510 21.260521 Student 26 29.28465 9.846746 Student 27 30.86823 16.839343 Student 28 33.72179 13.509113 Student 29 22.87919 16.539564 Student 30 29.31201 10.555516 F1 F2 Thrilling-Boring -0.24372796 -0.34177895 Intelligent-Idiotic -0.48504243 -0.44726983 Erotic-Not Erotic 0.20475922 -0.01764648 Sensitive-Insensitive -0.27652097 -0.19454338 Interesting-Uninteresting -0.43456999 -0.47375375 Fast-Slow -0.20635791 -0.28348333 Intellectually Stimulating-Intellectually Dull -0.47021551 -0.45397363 Violent-Peaceful -0.02541951 -0.09289508 Caring-Callous -0.25027738 -0.14852877 Satirical-Not Satirical 0.10621346 -0.23174996 Informative-Uninformative -0.51352985 -0.46008818 Touching-Leave Me Cold -0.22928028 -0.21761982 Deep-Shallow -0.34899775 -0.31471397 Tasteful-Crude -0.38234281 -0.23046305 Real-Fantasy -0.54823475 -0.39002381 Funny-Not Funny -0.02350831 -0.26805945 F1 F2 Mash -0.083803864 0.67796152 Charlie's angels -0.031493045 -0.42426424 All in the family -0.146155171 0.43688540 60 minutes 0.332239949 0.01793272 The tonight show -0.161969681 0.54858636 Let's make a deal -0.003376494 -0.51648387 The waltons 0.453192804 -0.90618164 Saturday night live -0.420584108 0.66494467 News 0.354523892 -0.17297345 Kojak 0.007055016 -0.15733666 Mork and mindy -0.206809625 0.32176462 Jacques Cousteau 0.523994066 -0.42478997 Football 0.087498731 -0.10367947 Little house on the prairie 0.442896570 -0.98151740 Wild kingdom 0.482519464 -0.57806392 F1 F2 266.8060 246.5506 > ## IGNORE_RDIFF_END > > tvcp$cutoff.rd [1] 62.08767 > sort(tvcp$rd) Student 5 Student 4 Student 16 Student 14 Student 7 Student 20 Student 26 25.00979 30.84055 32.06377 33.30293 33.57243 36.07897 38.06328 Student 15 Student 24 Student 29 Student 11 Student 19 Student 12 Student 2 39.49078 39.57787 40.25878 41.03119 41.22830 43.56221 44.08275 Student 3 Student 8 Student 28 Student 9 Student 1 Student 17 Student 10 45.11740 45.18889 45.80252 45.83685 46.13295 46.80926 46.97476 Student 27 Student 13 Student 23 Student 22 Student 30 Student 18 Student 25 47.73336 48.21781 48.58578 49.70027 50.63419 54.02359 54.62486 Student 6 Student 21 63.80763 64.12674 > tvcp$cutoff.sd [1] 2.716203 > sort(tvcp$sd) Student 1 Student 27 Student 21 Student 20 Student 23 Student 22 Student 14 0.1692217 0.2195167 0.4774541 0.5979556 0.7981549 0.8010742 0.8866742 Student 3 Student 24 Student 18 Student 15 Student 29 Student 6 Student 28 0.9291269 0.9727256 1.1093464 1.1512997 1.1647774 1.1676362 1.2678371 Student 11 Student 30 Student 12 Student 16 Student 25 Student 26 Student 9 1.2933323 1.3036625 1.4137042 1.4263961 1.4487756 1.4612221 1.5161494 Student 2 Student 10 Student 17 Student 8 Student 4 Student 7 Student 5 1.5451531 1.5460186 1.5957083 1.6430385 1.6885259 1.9226619 2.0096600 Student 13 Student 19 2.3441506 2.5566191 > > (rtvcp <- Parafac(tv, 2, robust=TRUE)) Call: Parafac(X = tv, ncomp = 2, robust = TRUE) PARAFAC analysis with 2 components. Fit value: 51923.43 Fit percentage: 48.74 % Robust > ## IGNORE_RDIFF_BEGIN > rtvcp$A; rtvcp$B; rtvcp$C; rtvcp$GA F1 F2 Student 1 -46.84802 42.89640 Student 2 -56.42061 67.98367 Student 3 -59.80159 53.10888 Student 4 -30.00484 23.83426 Student 5 -29.06700 14.89055 Student 6 -37.39741 41.70353 Student 7 -26.28416 29.91106 Student 8 -33.95092 43.95949 Student 9 -64.27747 60.50079 Student 10 -65.83294 59.68509 Student 11 -34.61253 25.17244 Student 12 -65.53037 57.88567 Student 13 -59.56152 77.38860 Student 14 -44.58896 31.13668 Student 15 -48.33613 30.64320 Student 16 -32.15910 28.21699 Student 17 -37.31297 48.45842 Student 18 -58.88227 49.90525 Student 19 -63.98412 30.68405 Student 20 -43.64888 36.18670 Student 21 -48.09545 40.58983 Student 22 -51.53073 54.83762 Student 23 -56.54323 50.71547 Student 24 -56.20098 42.85436 Student 25 -44.72421 57.56234 Student 26 -47.59041 26.27620 Student 27 -49.98963 42.44759 Student 28 -54.58411 34.34173 Student 29 -38.40799 44.95037 Student 30 -47.78716 29.07781 F1 F2 Thrilling-Boring 0.19082201 -0.287776452 Intelligent-Idiotic 0.35944898 -0.347321139 Erotic-Not Erotic -0.15632434 0.001522933 Sensitive-Insensitive 0.18875096 -0.128336084 Interesting-Uninteresting 0.32996281 -0.392339913 Fast-Slow 0.15823208 -0.237307022 Intellectually Stimulating-Intellectually Dull 0.34893495 -0.351146608 Violent-Peaceful 0.02859044 -0.086748475 Caring-Callous 0.17405227 -0.103663176 Satirical-Not Satirical -0.08073304 -0.188653110 Informative-Uninformative 0.38490133 -0.365057383 Touching-Leave Me Cold 0.16063761 -0.158676198 Deep-Shallow 0.25006231 -0.230891436 Tasteful-Crude 0.27634395 -0.180999842 Real-Fantasy 0.40946526 -0.312820128 Funny-Not Funny 0.02255823 -0.224268795 F1 F2 Mash -0.062396541 0.316511307 Charlie's angels -0.051565807 -0.156465570 All in the family -0.124950397 0.203122978 60 minutes 0.285085534 -0.004080375 The tonight show -0.144376644 0.304613537 Let's make a deal -0.020612200 -0.215276035 The waltons 0.373871652 -0.437100364 Saturday night live -0.380747907 0.383754525 News 0.293718313 -0.093807619 Kojak -0.009097994 -0.041581269 Mork and mindy -0.188223269 0.188449624 Jacques Cousteau 0.432021171 -0.204828052 Football 0.053292980 0.013641138 Little house on the prairie 0.361801882 -0.460991281 Wild kingdom 0.385199377 -0.236453754 F1 F2 269.2412 246.0556 > ## IGNORE_RDIFF_END > rtvcp$cutoff.rd [1] 56.84462 > sort(rtvcp$rd) Student 5 Student 4 Student 16 Student 7 Student 14 Student 20 Student 26 24.80523 30.25759 31.57001 33.04188 33.07041 35.25865 38.08297 Student 24 Student 15 Student 29 Student 11 Student 19 Student 2 Student 12 39.04821 39.12462 39.49666 40.91797 41.42007 41.92968 42.49760 Student 3 Student 1 Student 28 Student 8 Student 9 Student 10 Student 13 44.14112 45.70593 45.80770 45.88353 46.38804 46.98671 47.32748 Student 27 Student 23 Student 17 Student 22 Student 30 Student 25 Student 18 48.12516 49.01526 49.05052 49.40510 50.67454 53.81805 55.47309 Student 6 Student 21 66.24523 66.56113 > rtvcp$cutoff.sd [1] 2.716203 > sort(rtvcp$sd) Student 1 Student 21 Student 27 Student 20 Student 23 Student 14 Student 22 0.1230590 0.1991180 0.2491942 0.4526665 0.7580839 0.8375296 0.8844773 Student 24 Student 18 Student 3 Student 15 Student 6 Student 29 Student 30 0.9095919 0.9569802 1.0335430 1.0938373 1.0960513 1.1742498 1.1933478 Student 11 Student 28 Student 16 Student 26 Student 9 Student 12 Student 17 1.2939525 1.3303593 1.3538524 1.4274292 1.4810002 1.5248663 1.5317879 Student 25 Student 10 Student 4 Student 8 Student 2 Student 7 Student 5 1.5567850 1.5682777 1.5845329 1.6009467 1.8071195 1.8786461 1.9785792 Student 13 Student 19 2.4779838 2.5731329 > > ## =============================================================== > ## > ## Compositional data and robustness > > data(ulabor) > > (res0 <- Parafac(ulabor)) Call: Parafac(X = ulabor) PARAFAC analysis with 2 components. Fit value: 3094.461 Fit percentage: 97.68 % > > ## IGNORE_RDIFF_BEGIN > res0$A; res0$B; res0$C; res0$GA F1 F2 Pie 38.95683 7.3171572 VdA 39.41582 10.6925141 Lom 48.66291 9.2428751 Lig 56.63443 8.5564525 Tno 38.73119 4.7519814 Bol 35.78668 4.3107081 Tre 42.75059 5.4758829 Ven 44.52300 9.7463912 Fri 52.49969 11.8615250 Emi 35.63438 8.8574464 Tos 38.13003 5.9479300 Umb 55.34899 7.1009096 Mar 44.43006 9.0846232 Laz 75.29310 8.3238769 Abr 68.47878 6.9113553 Mol 93.33735 0.4577208 Cam 97.34571 7.7260059 Pug 88.10102 3.9851227 Bas 108.83055 -1.2300930 Cal 161.71321 -2.6585784 Sic 115.95199 1.5059349 Sar 87.28745 4.6455548 F1 F2 Agri -0.4186317 1.2978717 Man -0.4372669 -0.6672464 Ind -0.3711266 -0.6134723 Con -0.5189685 -0.6039138 Serv -0.3818639 0.4514516 F1 F2 2001 -0.4833987 0.8236546 2003 -0.4219873 0.8309858 2005 -0.4532562 1.0569151 2007 -0.4496442 1.1807793 2009 -0.4715091 1.2086574 F1 F2 340.5799 134.7309 > ## IGNORE_RDIFF_END > > res0$cutoff.rd [1] 20.32832 > sort(res0$rd) Lig VdA Fri Tos Ven Umb Mar Tno 5.004894 6.148439 6.639801 7.004848 7.205583 7.923234 8.373065 8.693511 Pie Emi Sar Bol Tre Pug Mol Sic 8.710359 8.737517 9.028275 9.759871 9.998747 11.455565 12.360752 13.105318 Cal Lom Abr Cam Laz Bas 13.189134 13.248666 15.091237 16.105366 18.353882 24.897291 > res0$cutoff.sd [1] 2.716203 > sort(res0$sd) Umb Abr Sar Pug Lig Mar Lom Pie 0.3445949 0.4072854 0.6357073 0.6491598 0.7193043 0.8088524 0.8509300 0.9356166 Emi Ven Laz VdA Tre Tos Sic Mol 0.9381274 0.9775195 1.2106371 1.2285038 1.2445778 1.3068667 1.4870226 1.5184683 Tno Fri Bas Cam Bol Cal 1.6604968 1.8559615 1.9133046 1.9195695 1.9395451 2.8679666 > > (res <- Parafac(ulabor, robust=TRUE, coda.transform="ilr")) Call: Parafac(X = ulabor, robust = TRUE, coda.transform = "ilr") PARAFAC analysis with 2 components. Fit value: 2.762842 Fit percentage: 99.5 % Robust, ilr-transformed > > ## IGNORE_RDIFF_BEGIN > res$A; res$B; res$C; res$GA F1 F2 Pie -3.72720229 1.85186567 VdA -8.01160297 14.94756434 Lom -2.94754555 4.47629488 Lig -2.38612649 2.25909277 Tno -2.37761082 0.42109144 Bol -2.62628736 -0.09465471 Tre -2.25570657 0.94681676 Ven -3.97534454 4.20404509 Fri -4.03164680 4.23334797 Emi -5.51554769 1.53691173 Tos -2.85155164 2.76651503 Umb -2.15187068 1.81632222 Mar -4.27753394 2.02879000 Laz -1.14414212 2.27096172 Abr -1.26976164 3.00885515 Mol 0.07156785 0.26284129 Cam -1.10657923 1.19048983 Pug -0.53401024 1.16945733 Bas 0.27164673 -0.48518369 Cal 0.77038965 0.44634127 Sic 0.17418037 0.71757493 Sar -0.74833305 0.93352617 F1 F2 Z1 0.5884550 0.34214588 Z2 0.1489703 0.62891030 Z3 0.6005218 -0.69715815 Z4 -0.5204826 -0.03712866 F1 F2 2001 -0.3144027 0.4046315 2003 -0.4493563 0.4573583 2005 -0.4900969 0.4737227 2007 -0.4939720 0.4516856 2009 -0.4637096 0.4457169 F1 F2 14.46824 18.02759 > ## IGNORE_RDIFF_END > > res$cutoff.rd [1] 0.6337104 > sort(res$rd) Sar Cal Lig Fri Umb Sic Mar Pie 0.2928425 0.3218708 0.3392706 0.3450439 0.3718724 0.3830069 0.3922288 0.4053166 Mol Ven Pug Bol Abr Tos Lom Bas 0.4302996 0.4477137 0.4479510 0.4603592 0.4611033 0.4674324 0.4868503 0.5195072 Tno Cam Emi Tre Laz VdA 0.6398038 0.6531687 0.8354005 1.0202743 1.1592008 7.5554443 > res$cutoff.sd [1] 2.716203 > sort(res$sd) Umb Lig Cam Tre Tos Sar Pug 0.07525481 0.35497752 0.50159389 0.68798782 0.68833454 0.70392237 0.81028208 Laz Pie Tno Sic Mol Mar Abr 0.88933753 1.03681806 1.14590230 1.18266936 1.19003319 1.32699093 1.34546460 Cal Bas Ven Fri Bol Lom Emi 1.50249316 1.52355079 1.62735214 1.64897562 1.65268374 1.89282917 2.32365991 VdA 8.79200721 > > (res1 <- Parafac(ulabor, coda.transform="clr")) Call: Parafac(X = ulabor, coda.transform = "clr") PARAFAC analysis with 2 components. Fit value: 16.85476 Fit percentage: 96.95 % clr-transformed > > ## IGNORE_RDIFF_BEGIN > res1$A; res1$B; res1$C; res1$GA F1 F2 Pie -1.33444073 0.82292805 VdA -18.73636304 1.82146654 Lom -4.10779897 0.75294149 Lig -1.96350146 0.56410819 Tno -0.01825101 0.50552154 Bol 0.46737228 0.53488826 Tre -0.50748792 0.50227060 Ven -3.65748069 0.95469347 Fri -3.59174147 0.97443928 Emi -0.74392099 1.19066493 Tos -2.41880477 0.66889975 Umb -1.50515200 0.50105424 Mar -1.40716216 0.94115526 Laz -2.14667301 0.31880229 Abr -2.88222112 0.36188252 Mol -0.33984674 -0.01401674 Cam -0.99881304 0.27356145 Pug -1.16132224 0.14173066 Bas 0.47396905 -0.06968556 Cal -0.62840999 -0.14648352 Sic -0.78812975 -0.01221515 Sar -0.90676292 0.17775341 F1 F2 Agri 0.0975616 -1.3751331 Man 0.1884542 0.9690904 Ind -0.7425677 0.3393905 Con 0.3193768 0.8557385 Serv 0.1371751 -0.7890863 F1 F2 2001 -0.4495825 -0.7791732 2003 -0.4510298 -0.9401260 2005 -0.4507652 -1.0288730 2007 -0.4216447 -1.1119078 2009 -0.4192016 -1.0656330 F1 F2 17.19533 15.20402 > ## IGNORE_RDIFF_END > > res1$cutoff.rd [1] 1.51674 > sort(res1$rd) Sar Mol Lig Umb Cal Sic Bas Pie 0.3307659 0.4244839 0.4645352 0.5061766 0.5064754 0.5362422 0.5370514 0.5612077 Pug Mar Cam Tos Tno Bol Tre Ven 0.5835217 0.6637070 0.6911580 0.7699203 0.7900113 1.0042183 1.0125992 1.0545346 Fri Emi Abr VdA Laz Lom 1.0848290 1.0964189 1.1859928 1.2827753 1.3511843 1.4378710 > res1$cutoff.sd [1] 2.716203 > sort(res1$sd) Lig Umb Tos Lom Tre Cam Laz Abr 0.1676457 0.2011131 0.3561272 0.5137738 0.5551266 0.5673312 0.6294170 0.7075238 Tno Sar Pug Ven Bol Fri Pie Mol 0.7370372 0.8104082 0.9496252 0.9677263 0.9719430 1.0325935 1.1145116 1.2639866 Bas Sic Mar Cal Emi VdA 1.3230551 1.3288321 1.4426268 1.6895083 2.3756852 4.2460716 > > proc.time() user system elapsed 3.32 0.34 3.67