R Under development (unstable) (2023-12-04 r85659 ucrt) -- "Unsuffered Consequences" Copyright (C) 2023 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(pcaPP)) > > ## Sparse loadings > set.seed (0) > ##x <- data.Zou() > data(iris) > x <- iris[, 1:4] > > l1median_NM (x)$par [1] 5.931944 2.913282 4.215406 1.364975 > l1median_CG (x)$par [1] 5.932216 2.912279 4.215837 1.364750 > l1median_BFGS (x)$par [1] 5.932216 2.912279 4.215837 1.364750 > l1median_NLM (x)$par [1] 5.932216 2.912279 4.215837 1.364750 > l1median_HoCr (x)$par [1] 5.932216 2.912279 4.215837 1.364750 > l1median_VaZh (x)$par [1] 5.932216 2.912279 4.215837 1.364750 > > # compare with coordinate-wise median: > apply(x,2,median) Sepal.Length Sepal.Width Petal.Length Petal.Width 5.80 3.00 4.35 1.30 > > pc <- PCAgrid(x) > pc Call: PCAgrid(x = x) Standard deviations: [1] 2.3555356 0.9095565 4 variables and 150 observations. > summary(pc) Importance of components: [,1] [,2] Standard deviation 2.3555356 0.9095565 Proportion of Variance 0.8702457 0.1297543 Cumulative Proportion 0.8702457 1.0000000 > pc$loadings Loadings: Comp.1 Comp.2 Sepal.Length 0.589 -0.618 Sepal.Width 0.174 Petal.Length 0.598 0.749 Petal.Width 0.543 -0.163 Comp.1 Comp.2 SS loadings 1.00 1.00 Proportion Var 0.25 0.25 Cumulative Var 0.25 0.50 > pc$scores Comp.1 Comp.2 [1,] -2.791519460 -1.304428269 [2,] -2.921720995 -1.267984502 [3,] -3.094390048 -1.184566289 [4,] -3.036232432 -0.990326562 [5,] -2.847966568 -1.225246155 [6,] -2.316930680 -1.227763426 [7,] -3.034282033 -1.029294612 [8,] -2.793136680 -1.185134557 [9,] -3.218791382 -0.976577184 [10,] -2.913781498 -1.159347616 [11,] -2.550040927 -1.379942552 [12,] -2.851201009 -0.986658731 [13,] -3.034948391 -1.189945935 [14,] -3.508870813 -1.105959455 [15,] -2.486269684 -1.799588594 [16,] -2.247359234 -1.475864129 [17,] -2.556030025 -1.527547488 [18,] -2.737211646 -1.320701930 [19,] -2.196952220 -1.414201690 [20,] -2.670019387 -1.193504288 [21,] -2.437908677 -1.282302147 [22,] -2.618184048 -1.227195159 [23,] -3.322744244 -1.277970595 [24,] -2.454216458 -1.163245624 [25,] -2.671876500 -0.761820684 [26,] -2.743251740 -1.179857376 [27,] -2.624746217 -1.142735864 [28,] -2.672825041 -1.291247159 [29,] -2.735072351 -1.383610383 [30,] -2.915065539 -0.959728243 [31,] -2.858618431 -1.038910357 [32,] -2.448842723 -1.464741501 [33,] -2.712298010 -1.170470245 [34,] -2.538533811 -1.429567429 [35,] -2.859473685 -1.175621278 [36,] -2.977406137 -1.444807021 [37,] -2.615615966 -1.626433906 [38,] -2.961193964 -1.147207588 [39,] -3.276093744 -1.034105991 [40,] -2.734217097 -1.246899462 [41,] -2.855906065 -1.333883041 [42,] -3.180173667 -1.234065019 [43,] -3.271148796 -0.999271573 [44,] -2.513658115 -1.157865978 [45,] -2.376612229 -0.909993888 [46,] -2.926332764 -1.222493258 [47,] -2.664552365 -1.102284611 [48,] -3.093534795 -1.047855368 [49,] -2.608960510 -1.318177647 [50,] -2.855383990 -1.277497781 [51,] 0.944798547 -0.252278522 [52,] 0.526039193 -0.047854782 [53,] 1.057263977 -0.074312455 [54,] -0.433979126 0.009091732 [55,] 0.634843715 -0.104342507 [56,] -0.004903408 0.347378043 [57,] 0.643449570 0.164945702 [58,] -1.366371442 -0.078702751 [59,] 0.587620145 -0.116142881 [60,] -0.606315000 0.172835607 [61,] -1.197792083 -0.060244461 [62,] 0.047171823 0.001297281 [63,] -0.304777128 -0.268329019 [64,] 0.407104882 0.251354000 [65,] -0.599324044 -0.247953982 [66,] 0.586242816 -0.309239061 [67,] 0.049737584 0.411430044 [68,] -0.350479086 0.017232851 [69,] 0.383475287 -0.098497059 [70,] -0.538505058 -0.060237448 [71,] 0.573689229 0.436986807 [72,] -0.068099260 -0.274411656 [73,] 0.688911637 0.191773724 [74,] 0.296016781 0.266484114 [75,] 0.290456471 -0.217451116 [76,] 0.524850760 -0.264891364 [77,] 0.876844322 -0.123471530 [78,] 1.105342801 0.074198839 [79,] 0.282943440 0.146953213 [80,] -0.770520160 -0.388095545 [81,] -0.659671951 -0.090835767 [82,] -0.773754601 -0.149508121 [83,] -0.361413131 -0.165206503 [84,] 0.690955323 0.545521228 [85,] -0.068101581 0.534959854 [86,] 0.349613624 0.217765596 [87,] 0.819875139 -0.100674676 [88,] 0.276476880 -0.185243448 [89,] -0.297977388 0.144193304 [90,] -0.429034177 0.043926150 [91,] -0.241770172 0.377401082 [92,] 0.349802520 0.193825194 [93,] -0.304110769 -0.107677696 [94,] -1.309924333 -0.157884865 [95,] -0.245619974 0.166887693 [96,] -0.233590783 0.173648076 [97,] -0.181755443 0.139957206 [98,] 0.172617306 -0.093921306 [99,] -1.371076498 -0.425927061 [100,] -0.244002754 0.047593981 [101,] 1.909292764 0.992780951 [102,] 0.736039599 0.620230054 [103,] 2.096225912 0.436558712 [104,] 1.280148828 0.737243684 [105,] 1.737241394 0.715928467 [106,] 2.809247679 0.652356294 [107,] -0.266446237 0.724151014 [108,] 2.287768508 0.644216739 [109,] 1.625486934 0.570407258 [110,] 2.506761266 0.564094445 [111,] 1.215146861 0.258688099 [112,] 1.209106767 0.399532653 [113,] 1.680367819 0.322069366 [114,] 0.666708045 0.555940865 [115,] 1.010051141 0.556278956 [116,] 1.438700391 0.421524051 [117,] 1.340685631 0.556185066 [118,] 3.002029704 0.788601413 [119,] 3.146217501 0.713213277 [120,] 0.564510303 0.399762829 [121,] 1.972397649 0.412483586 [122,] 0.555431049 0.595011381 [123,] 2.868689336 0.646976648 [124,] 0.856780025 0.177787157 [125,] 1.748415331 0.585977929 [126,] 2.056941838 0.533395224 [127,] 0.740558081 0.182023256 [128,] 0.746358283 0.353568595 [129,] 1.499519377 0.609240585 [130,] 1.823831591 0.381216098 [131,] 2.278973757 0.398868932 [132,] 2.831928733 0.472780879 [133,] 1.553827190 0.592966924 [134,] 0.815878732 0.393917382 [135,] 0.937660987 0.873616514 [136,] 2.677908707 0.183313988 [137,] 1.618358079 0.726687759 [138,] 1.284238522 0.635367181 [139,] 0.627663864 0.340387484 [140,] 1.681985039 0.202775654 [141,] 1.846618987 0.427376511 [142,] 1.611276157 -0.054609716 [143,] 0.736039599 0.620230054 [144,] 2.033027739 0.624140523 [145,] 1.965646585 0.520883283 [146,] 1.550739354 0.126448902 [147,] 0.965917727 0.201625094 [148,] 1.269976749 0.298799697 [149,] 1.385581011 0.654834295 [150,] 0.748068790 0.626990436 > > proc.time() user system elapsed 0.18 0.01 0.20