R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 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 a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("sca-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('sca') > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "agglomblock" > > ### * agglomblock > > flush(stderr()); flush(stdout()) > > ### Name: agglomblock > ### Title: Agglomerate Two Block-Components in SCA > ### Aliases: agglomblock > ### Keywords: multivariate > > ### ** Examples > > > > > cleanEx(); ..nameEx <- "allcrit" > > ### * allcrit > > flush(stderr()); flush(stdout()) > > ### Name: allcrit > ### Title: Simple Component Quality Criterion Computation > ### Aliases: allcrit sccrit > ### Keywords: multivariate > > ### ** Examples > > > > > cleanEx(); ..nameEx <- "corcomp" > > ### * corcomp > > flush(stderr()); flush(stdout()) > > ### Name: corcomp > ### Title: Covariance and Correlation Matrix of Components P on S > ### Aliases: corcomp covcomp > ### Keywords: multivariate > > ### ** Examples > > data(USJudgeRatings) > S.jr <- cor(USJudgeRatings) > sca.jr <- sca(S.jr, b=4, inter=FALSE) > Vr <- covcomp(S.jr, P = sca.jr$simplemat) > Vr B1 B2 D3 D4 D5 B1 10.12146983 -0.03027369 -0.11615970 0.22388444 0.09314354 B2 -0.03027369 1.00000000 -0.23839401 -0.04749288 -0.12583462 D3 -0.11615970 -0.23839401 0.39376977 0.06205256 0.09458930 D4 0.22388444 -0.04749288 0.06205256 0.23496304 0.01737470 D5 0.09314354 -0.12583462 0.09458930 0.01737470 0.10722424 > Cr <- corcomp(S.jr, P = sca.jr$simplemat) > Cr B1 B2 D3 D4 D5 B1 1.00000000 -0.00951576 -0.0581852 0.14517851 0.08940966 B2 -0.00951576 1.00000000 -0.3799043 -0.09797805 -0.38428520 D3 -0.05818520 -0.37990426 1.0000000 0.20400402 0.46033536 D4 0.14517851 -0.09797805 0.2040040 1.00000000 0.10946394 D5 0.08940966 -0.38428520 0.4603354 0.10946394 1.00000000 > > > > cleanEx(); ..nameEx <- "firstpcres" > > ### * firstpcres > > flush(stderr()); flush(stdout()) > > ### Name: firstpcres > ### Title: First Principal Component of Residuals given Components > ### Aliases: firstpcres > ### Keywords: multivariate > > ### ** Examples > > > > > cleanEx(); ..nameEx <- "hearlossC" > > ### * hearlossC > > flush(stderr()); flush(stdout()) > > ### Name: hearlossC > ### Title: Hearing Loss Correlation Data > ### Aliases: hearlossC > ### Keywords: datasets > > ### ** Examples > > data(hearlossC) > symnum(hearlossC) L5 L1 L2 L4 R5 R1 R2 R4 Left5c 1 Left1k , 1 Left2k . . 1 Left4k . 1 Right5c , . 1 Right1k , , . , 1 Right2k . , . . 1 Right4k . , . 1 attr(,"legend") [1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1 > > > > cleanEx(); ..nameEx <- "maxmatrix" > > ### * maxmatrix > > flush(stderr()); flush(stdout()) > > ### Name: maxmatrix > ### Title: Largest Element in Correlation Matrix > ### Aliases: maxmatrix > ### Keywords: multivariate > > ### ** Examples > > data(reflexesC) > maxmatrix(reflexesC) # -> 0.98 at [1, 2] $row [1] 1 $col [1] 2 $val [1] 0.98 > > > > cleanEx(); ..nameEx <- "nextdiff" > > ### * nextdiff > > flush(stderr()); flush(stdout()) > > ### Name: nextdiff > ### Title: Compute the Next Simple Difference-Component for SCA > ### Aliases: nextdiff > ### Keywords: multivariate > > ### ** Examples > > > > > cleanEx(); ..nameEx <- "percent" > > ### * percent > > flush(stderr()); flush(stdout()) > > ### Name: percent > ### Title: Simple Formatting of Percentages > ### Aliases: percent > ### Keywords: utilities print > > ### ** Examples > > percent(0.25) [1] "25 %" > noquote(percent((1:10)/10)) [1] 10 % 20 % 30 % 40 % 50 % 60 % 70 % 80 % 90 % 100 % > (pc <- percent((1:10)/30, 1, sep="")) [1] "3.3%" "6.7%" "10.0%" "13.3%" "16.7%" "20.0%" "23.3%" "26.7%" "30.0%" [10] "33.3%" > noquote(pc) [1] 3.3% 6.7% 10.0% 13.3% 16.7% 20.0% 23.3% 26.7% 30.0% 33.3% > > > > cleanEx(); ..nameEx <- "pitpropC" > > ### * pitpropC > > flush(stderr()); flush(stdout()) > > ### Name: pitpropC > ### Title: Pitprops Strength Correlation Data > ### Aliases: pitpropC > ### Keywords: datasets > > ### ** Examples > > data(pitpropC) > symnum(pitpropC) tp l m ts o rngt rngb bwm bwd w c k d topdiam 1 length B 1 moist . 1 testsg . + 1 ovensg 1 ringtop . . . 1 ringbut . . + 1 bowmax . . . 1 bowdist . , . . 1 whorls . . , . . 1 clear . 1 knots . . 1 diaknot . . 1 attr(,"legend") [1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1 > > > > cleanEx(); ..nameEx <- "quickcrit" > > ### * quickcrit > > flush(stderr()); flush(stdout()) > > ### Name: quickcrit > ### Title: Additional Contribution of New Component to the SC System > ### Aliases: quickcrit > ### Keywords: multivariate > > ### ** Examples > > > > > cleanEx(); ..nameEx <- "reflexesC" > > ### * reflexesC > > flush(stderr()); flush(stdout()) > > ### Name: reflexesC > ### Title: Human Reflexes Correlation Data > ### Aliases: reflexesC > ### Keywords: datasets > > ### ** Examples > > data(reflexesC) > symnum(reflexesC) t.R t.L b.R b.L w.R w.L k.R k.L a.R a.L triceps.R 1 triceps.L B 1 biceps.R . , 1 biceps.L , , + 1 wrist.R . . , , 1 wrist.L . . . , B 1 knee.R . . . . . . 1 knee.L . . + 1 ankle.R . . 1 ankle.L . . * 1 attr(,"legend") [1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1 > > > > cleanEx(); ..nameEx <- "sca" > > ### * sca > > flush(stderr()); flush(stdout()) > > ### Name: sca > ### Title: Simple Component Analysis - Interactively > ### Aliases: sca print.simpcomp > ### Keywords: multivariate > > ### ** Examples > > data(pitpropC) > sc.pitp <- sca(pitpropC, interactive=FALSE) > sc.pitp ------------------------------------------------------------ Simple Component Analysis ------------------------------------------------------------ Optimality criterion : corrected sum of variances Clustering procedure : median linkage Within-block differences : TRUE Possible invertion of signs : FALSE Number of block-components : 6 Number of diff.-components : 0 ------------------------------------------------------------ Simple matrix: B1 B2 B3 B4 B5 B6 topdiam 1 0 0 0 0 0 length 1 0 0 0 0 0 moist 0 1 0 0 0 0 testsg 0 1 0 0 0 0 ovensg 0 0 1 0 0 0 ringtop 1 0 0 0 0 0 ringbut 1 0 0 0 0 0 bowmax 1 0 0 0 0 0 bowdist 1 0 0 0 0 0 whorls 1 0 0 0 0 0 clear 0 0 0 1 0 0 knots 0 0 0 0 1 0 diaknot 0 0 0 0 0 1 ------------------------------------------------------------ Variance principal components: 32.45 % 18.29 % 14.45 % 8.53 % 7.00 % 6.27 % Variance simple components : 30.16 % 14.48 % 7.69 % 7.69 % 7.69 % 7.69 % ------------------------------------------------------------ Extracted variability PCA: 87.00 % Extracted variability SCA: 72.82 % Optimality SCA : 83.70 % ------------------------------------------------------------ Correlations simple components: B1 B2 B3 B4 B5 B6 B1 1.00 0.20 0.08 -0.03 -0.21 -0.20 B2 0.20 1.00 0.04 0.13 0.20 0.07 B3 0.08 0.04 1.00 -0.09 -0.14 -0.21 B4 -0.03 0.13 -0.09 1.00 0.03 0.01 B5 -0.21 0.20 -0.14 0.03 1.00 0.18 B6 -0.20 0.07 -0.21 0.01 0.18 1.00 ------------------------------------------------------------ Max (abs) correlation: 0.21 ( B1 - B5 ) ------------------------------------------------------------ > ## to see it's low-level components: > str(sc.pitp) List of 10 $ simplemat : num [1:13, 1:6] 1 1 0 0 0 1 1 1 1 1 ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr [1:13] "topdiam" "length" "moist" "testsg" ... .. ..$ : chr [1:6] "B1" "B2" "B3" "B4" ... $ loadings : num [1:13, 1:6] 0.378 0.378 0.000 0.000 0.000 ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr [1:13] "topdiam" "length" "moist" "testsg" ... .. ..$ : chr [1:6] "B1" "B2" "B3" "B4" ... $ allcrit :List of 7 ..$ varpc : num [1:6] 0.3245 0.1829 0.1445 0.0853 0.0700 ... ..$ varsc : Named num [1:6] 0.3016 0.1448 0.0769 0.0769 0.0769 ... .. ..- attr(*, "names")= chr [1:6] "B1" "B2" "B3" "B4" ... ..$ cumpc : num 0.87 ..$ cumsc : num 0.728 ..$ opt : num 0.837 ..$ corsc : num [1:6, 1:6] 1.0000 0.1987 0.0792 -0.0309 -0.2128 ... .. ..- attr(*, "dimnames")=List of 2 .. .. ..$ : chr [1:6] "B1" "B2" "B3" "B4" ... .. .. ..$ : chr [1:6] "B1" "B2" "B3" "B4" ... ..$ maxcor:List of 3 .. ..$ row: chr "B1" .. ..$ col: chr "B5" .. ..$ val: num 0.213 $ nblock : num 6 $ ndiff : num 0 $ criterion : chr "csv" $ cluster : chr "median" $ withinblock: logi TRUE $ invertsigns: logi FALSE $ vardata : num [1:13, 1:13] 1 0.954 0.364 0.342 -0.129 0.313 0.496 0.424 0.592 0.545 ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr [1:13] "topdiam" "length" "moist" "testsg" ... .. ..$ : chr [1:13] "topdiam" "length" "moist" "testsg" ... - attr(*, "class")= chr "simpcomp" > > ## Let `X' be a matrix containing some data set whose rows correspond to > ## subjects and whose columns correspond to variables. For example: > > library(MASS) > Sig <- function(p, rho) { r <- diag(p); r[col(r) != row(r)] <- rho; r} > rmvN <- function(n,p, rho) + mvrnorm(n, mu=rep(0,p), Sigma= Sig(p, rho)) > X <- cbind(rmvN(100, 3, 0.7), + rmvN(100, 2, 0.9), + rmvN(100, 4, 0.8)) > > ## An optimal simple system with at least 5 components for the data in `X', > ## where the number of block-components is such that correlations among > ## them are all smaller than 0.4, can be automatically obtained as: > > (r <- sca(cor(X), qmin=5, corblocks=0.4, interactive=FALSE)) ------------------------------------------------------------ Simple Component Analysis ------------------------------------------------------------ Optimality criterion : corrected sum of variances Clustering procedure : median linkage Within-block differences : TRUE Possible invertion of signs : FALSE Number of block-components : 3 Number of diff.-components : 2 ------------------------------------------------------------ Simple matrix: B1 B2 B3 D4 D5 V1 0 1 0 1 1 V2 0 1 0 0 -2 V3 0 1 0 -1 1 V4 0 0 1 0 0 V5 0 0 1 0 0 V6 1 0 0 0 0 V7 1 0 0 0 0 V8 1 0 0 0 0 V9 1 0 0 0 0 ------------------------------------------------------------ Variance principal components: 37.65 % 25.31 % 19.96 % 4.41 % 3.71 % Variance simple components : 36.34 % 25.49 % 20.71 % 4.24 % 3.60 % ------------------------------------------------------------ Extracted variability PCA: 91.04 % Extracted variability SCA: 89.71 % Optimality SCA : 98.54 % ------------------------------------------------------------ Correlations simple components: B1 B2 B3 D4 D5 B1 1.00 -0.11 -0.10 -0.03 0.04 B2 -0.11 1.00 -0.05 0.01 -0.02 B3 -0.10 -0.05 1.00 0.12 0.01 D4 -0.03 0.01 0.12 1.00 -0.02 D5 0.04 -0.02 0.01 -0.02 1.00 ------------------------------------------------------------ Max (abs) correlation: 0.12 ( B3 - D4 ) ------------------------------------------------------------ > > ## On the other hand, an optimal simple system with two block-components > ## and two difference-components for the data in `X' can be automatically > ## obtained as: > > (r <- sca(cor(X), b=2, d=2, qmin=0, corblocks=0, interactive=FALSE)) ------------------------------------------------------------ Simple Component Analysis ------------------------------------------------------------ Optimality criterion : corrected sum of variances Clustering procedure : median linkage Within-block differences : TRUE Possible invertion of signs : FALSE Number of block-components : 2 Number of diff.-components : 2 ------------------------------------------------------------ Simple matrix: B1 B2 D3 D4 V1 0 1 2 1 V2 0 1 2 0 V3 0 1 2 -1 V4 0 1 -3 0 V5 0 1 -3 0 V6 1 0 0 0 V7 1 0 0 0 V8 1 0 0 0 V9 1 0 0 0 ------------------------------------------------------------ Variance principal components: 37.65 % 25.31 % 19.96 % 4.41 % Variance simple components : 36.34 % 22.43 % 23.77 % 4.24 % ------------------------------------------------------------ Extracted variability PCA: 87.33 % Extracted variability SCA: 85.89 % Optimality SCA : 98.36 % ------------------------------------------------------------ Correlations simple components: B1 B2 D3 D4 B1 1.00 -0.15 0.00 -0.03 B2 -0.15 1.00 0.11 0.08 D3 0.00 0.11 1.00 -0.09 D4 -0.03 0.08 -0.09 1.00 ------------------------------------------------------------ Max (abs) correlation: 0.15 ( B1 - B2 ) ------------------------------------------------------------ > > ## The resulting simple matrix is contained in `r$simplemat'. > ## A matrix of scores for such simple components can then be obtained as: > > (Z <- scale(X) %*% r$loadings) B1 B2 D3 D4 [1,] 0.23489300 -0.230824971 -1.682311995 0.339250057 [2,] -0.41763611 -0.862616406 1.253457321 0.902864469 [3,] -2.15248370 0.434354964 -3.058601058 1.055258926 [4,] 0.10524605 1.563918402 2.049593308 -0.251941227 [5,] 1.93768043 1.683933450 -1.474133577 -1.154871217 [6,] 3.05819451 0.061805775 -2.546244771 0.992912872 [7,] -2.50812095 0.523990732 0.371290634 0.190988652 [8,] -0.40550215 1.273969048 0.123173157 0.078481621 [9,] 2.26894634 -0.327537916 1.648800464 -0.116601306 [10,] -1.95669532 -0.299013273 -0.728116415 -0.095122517 [11,] -4.64431521 2.694872479 0.436438051 0.009240197 [12,] -1.66491793 0.405821956 0.248672700 0.304744842 [13,] -1.74481650 -1.390428598 -0.233593395 -0.544903209 [14,] 0.19101565 -3.650828468 -1.725485629 -0.630294444 [15,] -0.67359236 1.250167112 1.175158707 0.560284633 [16,] 0.45461687 0.681989083 -1.250242256 0.902829781 [17,] -0.72525249 -0.631564284 0.438783760 -0.127030740 [18,] 0.83371964 0.940896055 1.074493712 -0.666354529 [19,] -0.57660018 -0.238423969 2.193642496 0.222035314 [20,] 2.32514132 1.016500352 0.047450940 -0.015092785 [21,] -1.29053896 2.150205060 -0.473513204 -0.884312358 [22,] 0.60308350 2.143085297 -0.820745186 -0.312644891 [23,] -1.55563492 0.619612769 -0.850379223 -0.328371149 [24,] 0.47274531 -4.411681913 -0.191541017 -0.160824736 [25,] -0.02187903 1.042221050 0.087484188 -0.648352909 [26,] -3.07944005 0.135554206 -0.604225448 0.825819245 [27,] -0.18898252 -0.696238066 0.147392446 -0.190697097 [28,] 2.27568398 -1.957533748 -1.811432034 -0.895960905 [29,] 1.39040750 -1.565455066 0.347657485 0.233491434 [30,] 0.34857846 0.949818602 -0.341511651 0.188060930 [31,] -2.15313095 1.306311891 1.734754490 -0.592811129 [32,] 2.26412290 -1.687499677 1.503862634 -1.500612661 [33,] 0.20205653 0.003444181 0.743910977 -0.494331973 [34,] -0.76945934 0.925403202 -1.577619997 0.614914061 [35,] 3.16734399 -2.276516347 -1.171401281 -0.112142079 [36,] -1.38447555 -0.095657055 -1.289070456 0.250367042 [37,] 0.63321628 0.119593715 -1.490682547 0.353921577 [38,] 2.48206639 -0.261336340 -0.129455081 -0.569439661 [39,] 1.24574604 0.940828527 1.484566297 0.715134330 [40,] -0.47047777 0.347652256 1.318655874 -0.019969052 [41,] -0.76409015 0.235873975 -1.031110203 0.775490316 [42,] 0.76206999 -1.443223726 0.807810433 0.302315839 [43,] 1.02037618 0.932266956 0.415373645 0.448221051 [44,] 0.13198062 0.286247070 0.842135237 -0.416780407 [45,] 2.55113930 -3.063438018 1.616316183 0.862697544 [46,] -0.06185026 -2.334895330 0.681875312 -0.969076479 [47,] -1.22928451 1.095392412 -0.645167775 -0.770786488 [48,] 1.07526387 0.651034144 0.962283600 -0.174603064 [49,] -3.99381524 0.361394771 -1.040176539 0.157542768 [50,] 0.83891644 2.604003214 -1.142317238 0.883836845 [51,] 0.98925955 1.616362949 -1.205544731 -0.046350189 [52,] -0.36034089 -0.396480225 -1.437084177 0.210368102 [53,] -2.01396038 0.589295916 -0.104176748 0.002670704 [54,] -0.61354511 -1.830941645 -1.064319537 0.043802054 [55,] 2.97901627 3.055055288 -0.221643552 0.667284744 [56,] -1.32760431 2.914432383 1.411906430 0.826054150 [57,] -4.25208420 -1.683958495 0.803859724 -1.566021240 [58,] 1.63666568 -1.686335465 -1.013616469 0.432971943 [59,] -0.84011282 -1.117112197 2.587619122 0.473549859 [60,] -0.87929138 -0.527868850 0.009144008 -0.654808857 [61,] -2.20879588 0.693929739 5.264520036 0.396857849 [62,] 0.03601635 0.902725761 -1.501124659 -0.188758664 [63,] 1.39309776 0.162600683 1.357152259 -0.410585877 [64,] -1.01633733 -0.523502345 0.430013945 0.263824505 [65,] -1.05861402 -1.308751017 -0.675850416 1.066589398 [66,] 2.14461343 0.598971383 -0.506519629 -0.342779436 [67,] -0.37150600 -1.953672801 -2.710680479 -0.191172734 [68,] -0.17261533 2.217503365 0.894534939 -0.391676140 [69,] -1.09198014 -0.487335647 0.715089331 -0.177798490 [70,] 1.76080653 1.463957271 3.712703341 -0.604242275 [71,] -1.81365553 0.104068741 0.865640220 -0.659801452 [72,] 1.64958347 -0.870467620 -1.116828883 0.177605483 [73,] 1.61784748 -0.103675952 1.469713195 -0.597354798 [74,] -0.76798853 -1.470123290 -0.985113807 1.468641123 [75,] 1.68287649 -2.844014563 -0.151766927 0.142410204 [76,] 1.91826677 0.186914254 0.255949652 0.608511529 [77,] 1.17613934 -0.649917047 -0.666963527 -1.457257368 [78,] 3.87159588 -0.306992929 0.100979362 -0.052504599 [79,] -3.60886469 -0.229755414 0.198455761 -0.972062609 [80,] -2.08155934 0.581454772 -2.567793937 0.234633472 [81,] -2.49554270 -0.269673951 -1.484572511 0.462072982 [82,] 0.40457474 0.608890759 -1.389153262 -0.457325892 [83,] 3.04671142 0.548136474 2.178863825 0.655958569 [84,] 3.23540083 -2.037643658 -1.864890362 -0.091022297 [85,] 0.99571791 1.593532335 -0.653730067 -0.460352355 [86,] 1.68765617 0.196028761 0.358324384 -0.547675433 [87,] -0.16863118 -0.647043884 3.347510959 -0.712184997 [88,] 0.93834816 -0.286091593 -0.757229972 0.665059325 [89,] 0.81304415 -1.361688207 2.360744385 0.305437349 [90,] -1.35997662 -0.548828684 1.086611941 0.728232183 [91,] -0.47065557 0.258164198 -2.053179701 -0.198759132 [92,] -0.14571924 1.924872209 0.574922838 0.091383661 [93,] 2.68012059 2.277695740 0.009184174 0.258663547 [94,] -1.84123635 0.998197672 0.362187801 -0.995721423 [95,] -3.89668049 1.779849509 1.750185250 1.207649422 [96,] 1.51133991 -0.264425052 1.515922797 0.269049090 [97,] -1.43538367 -0.464103621 -3.117396670 0.104487242 [98,] -0.76960964 -0.899343169 -0.725218581 0.725400431 [99,] 1.77643501 -2.408365184 -0.602794422 -0.130473299 [100,] -1.32410148 -0.051977193 -1.490502731 -0.109254697 > > ## On the other hand, scores of simple components calculated from the > ## variance-covariance matrix of `X' can be obtained as: > > r <- sca(var(X), b=2, d=2, qmin=0, corblocks=0, interactive=FALSE) > Z <- scale(X, scale=FALSE) %*% r$loadings > > ## One can also use the program interactively as follows: > > if(interactive()) { + r <- sca(cor(X), corblocks=0.4, qmin=5, interactive = TRUE) + + ## Since the interactive part of the program is active here, the proposed + ## system can then be modified according to the user's wishes. The + ## result of the procedure will be contained in `r'. + } > > > > > cleanEx(); ..nameEx <- "simpvector" > > ### * simpvector > > flush(stderr()); flush(stdout()) > > ### Name: simpvector > ### Title: Simplify a (Principal Component) Vector to a Simple Component > ### Aliases: simpvector > ### Keywords: multivariate > > ### ** Examples > > x0 <- c(-2:3, 3:-1,0:3,1,1) > cbind(x0, simpvector(x0)) # entries (-11, 0, 3) x0 [1,] -2 -11 [2,] -1 -11 [3,] 0 0 [4,] 1 3 [5,] 2 3 [6,] 3 3 [7,] 3 3 [8,] 2 3 [9,] 1 3 [10,] 0 0 [11,] -1 -11 [12,] 0 0 [13,] 1 3 [14,] 2 3 [15,] 3 3 [16,] 1 3 [17,] 1 3 > > > > cleanEx(); ..nameEx <- "sortmatrix" > > ### * sortmatrix > > flush(stderr()); flush(stdout()) > > ### Name: sortmatrix > ### Title: Sort Simple Component Matrix > ### Aliases: sortmatrix > ### Keywords: multivariate > > ### ** Examples > > > > > ### *