cluster/0000755000176200001440000000000014764341102011735 5ustar liggesuserscluster/tests/0000755000176200001440000000000014764135160013104 5ustar liggesuserscluster/tests/diana-ex.R0000644000176200001440000000145311674325037014721 0ustar liggesuserslibrary(cluster) options(digits = 6) data(votes.repub) di.votes <- daisy(votes.repub) .p00 <- proc.time() summary(diana(votes.repub, metric = "manhattan", stand = TRUE)) summary(diana(di.votes, keep.diss = FALSE)) cat('Time elapsed: ', proc.time() - .p00,'\n') data(agriculture) data(ruspini) .p0 <- proc.time() dia.agr <- diana(agriculture) drusp0 <- diana(ruspini, keep.diss=FALSE, keep.data=FALSE) drusp1 <- diana(ruspini, metric = "manhattan") cat('Time elapsed: ', proc.time() - .p0,'\n') summary(dia.agr) summary(drusp0) summary(drusp1) str (drusp1) ## From system.file("scripts/ch11.R", package = "MASS") data(swiss) swiss.x <- as.matrix(swiss[,-1]) .p1 <- proc.time() dCH <- diana(swiss.x) cat('Time elapsed: ', proc.time() - .p1,'\n') str(as.dendrogram(as.hclust(dCH)))# keep back-compatible cluster/tests/agnes-ex.Rout.save0000644000176200001440000006310714764134052016431 0ustar liggesusers R version 4.0.3 Patched (2021-01-18 r79850) -- "Bunny-Wunnies Freak Out" Copyright (C) 2021 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) 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. > library(cluster) > options(digits = 6) > data(votes.repub) > > ## IGNORE_RDIFF_BEGIN > source(system.file("test-tools.R", package = "cluster"), keep.source = FALSE) Loading required package: tools doExtras <- cluster:::doExtras() : TRUE > ## IGNORE_RDIFF_END > ## -> showProc.time() ... & doExtras > > agn1 <- agnes(votes.repub, metric = "manhattan", stand = TRUE) > summary(agn1) Object of class 'agnes' from call: agnes(x = votes.repub, metric = "manhattan", stand = TRUE) Agglomerative coefficient: 0.797756 Order of objects: [1] Alabama Georgia Arkansas Louisiana Mississippi [6] South Carolina Alaska Vermont Arizona Montana [11] Nevada Colorado Idaho Wyoming Utah [16] California Oregon Washington Minnesota Connecticut [21] New York New Jersey Illinois Ohio Indiana [26] Michigan Pennsylvania New Hampshire Wisconsin Delaware [31] Kentucky Maryland Missouri New Mexico West Virginia [36] Iowa South Dakota North Dakota Kansas Nebraska [41] Maine Massachusetts Rhode Island Florida North Carolina [46] Tennessee Virginia Oklahoma Hawaii Texas Merge: [,1] [,2] [1,] -7 -32 [2,] -13 -35 [3,] -12 -50 [4,] 1 -30 [5,] 2 -14 [6,] -26 -28 [7,] -5 -37 [8,] -15 -41 [9,] -22 -38 [10,] -25 -31 [11,] 7 -47 [12,] -21 -39 [13,] -16 -27 [14,] 4 5 [15,] -42 -46 [16,] -20 10 [17,] 14 9 [18,] -3 6 [19,] -6 3 [20,] -33 15 [21,] 17 -29 [22,] -17 16 [23,] 8 -34 [24,] 21 -49 [25,] 22 -48 [26,] -8 25 [27,] 19 -44 [28,] 11 -23 [29,] 28 24 [30,] -11 -43 [31,] 18 27 [32,] 23 13 [33,] 29 26 [34,] 20 -36 [35,] -1 -10 [36,] 32 -19 [37,] 31 33 [38,] -9 34 [39,] 37 36 [40,] 35 -4 [41,] -2 -45 [42,] 40 -18 [43,] -24 -40 [44,] 39 12 [45,] 44 38 [46,] 41 45 [47,] 42 43 [48,] 46 30 [49,] 47 48 Height: [1] 27.36345 31.15453 35.61832 51.44421 35.69152 87.45523 31.58222 47.53682 [9] 16.34184 11.49397 22.11426 16.35662 10.46294 19.03961 28.41137 11.70132 [17] 12.72838 19.07671 20.90246 8.38200 11.10094 12.92659 9.23004 11.37867 [25] 15.97442 12.70819 16.91515 17.74499 24.83533 18.78225 17.03525 15.77893 [33] 12.71848 18.52818 30.74557 12.55524 17.14634 22.33846 12.80419 27.38835 [41] 37.23685 12.79160 38.76377 29.38432 16.63215 14.75762 25.59605 53.03627 [49] 21.07684 1225 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 8.38 25.54 34.51 45.06 56.02 167.60 Metric : manhattan Number of objects : 50 Available components: [1] "order" "height" "ac" "merge" "diss" "call" [7] "method" "order.lab" "data" > Dvr <- daisy(votes.repub) > agn2 <- agnes(Dvr, method = "complete") > summary(agn2) Object of class 'agnes' from call: agnes(x = Dvr, method = "complete") Agglomerative coefficient: 0.88084 Order of objects: [1] Alabama Georgia Louisiana Arkansas Florida [6] Texas Mississippi South Carolina Alaska Michigan [11] Connecticut New York New Hampshire Indiana Ohio [16] Illinois New Jersey Pennsylvania Minnesota North Dakota [21] Wisconsin Iowa South Dakota Kansas Nebraska [26] Arizona Nevada Montana Oklahoma Colorado [31] Idaho Wyoming Utah California Oregon [36] Washington Missouri New Mexico West Virginia Delaware [41] Kentucky Maryland North Carolina Tennessee Virginia [46] Hawaii Maine Massachusetts Rhode Island Vermont Merge: [,1] [,2] [1,] -12 -50 [2,] -7 -32 [3,] -14 -35 [4,] -13 -30 [5,] -25 -31 [6,] -37 -47 [7,] -21 -39 [8,] -3 -28 [9,] 4 -38 [10,] -16 -27 [11,] -15 -41 [12,] 8 -26 [13,] -2 -22 [14,] -33 -42 [15,] 14 -46 [16,] 1 -44 [17,] -11 -19 [18,] 2 -29 [19,] -5 6 [20,] -17 -20 [21,] -34 -49 [22,] 5 -48 [23,] 18 3 [24,] 11 10 [25,] 23 9 [26,] -23 21 [27,] -8 20 [28,] 12 -36 [29,] -6 16 [30,] 13 25 [31,] 28 29 [32,] -1 -10 [33,] 19 22 [34,] 17 7 [35,] -4 -9 [36,] 30 26 [37,] 35 -43 [38,] 32 -18 [39,] -24 -40 [40,] 36 24 [41,] 27 15 [42,] 31 33 [43,] 38 37 [44,] 40 42 [45,] 34 -45 [46,] 43 39 [47,] 44 41 [48,] 47 45 [49,] 46 48 Height: [1] 48.2397 60.8984 72.9221 56.1363 58.8227 116.7048 63.0951 281.9508 [9] 28.1437 47.1690 19.4218 32.9438 36.7643 20.2258 39.1728 20.8792 [17] 25.3229 56.3813 42.2230 33.6978 64.5254 26.1547 37.4564 25.9221 [25] 80.4894 23.4206 27.8273 43.4492 48.0483 43.7055 17.1992 31.1988 [33] 70.4868 33.2328 22.1831 54.3057 21.1413 35.1129 121.4022 43.3829 [41] 33.4744 66.7591 29.5099 30.1541 178.4119 32.7611 55.3633 22.6334 [49] 83.1040 1225 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 17.2 48.3 64.7 82.2 105.5 282.0 Metric : euclidean Number of objects : 50 Available components: [1] "order" "height" "ac" "merge" "diss" "call" [7] "method" "order.lab" > ## almost same: > (ag2. <- agnes(Dvr, method= "complete", keep.diss=FALSE)) Call: agnes(x = Dvr, method = "complete", keep.diss = FALSE) Agglomerative coefficient: 0.88084 Order of objects: [1] Alabama Georgia Louisiana Arkansas Florida [6] Texas Mississippi South Carolina Alaska Michigan [11] Connecticut New York New Hampshire Indiana Ohio [16] Illinois New Jersey Pennsylvania Minnesota North Dakota [21] Wisconsin Iowa South Dakota Kansas Nebraska [26] Arizona Nevada Montana Oklahoma Colorado [31] Idaho Wyoming Utah California Oregon [36] Washington Missouri New Mexico West Virginia Delaware [41] Kentucky Maryland North Carolina Tennessee Virginia [46] Hawaii Maine Massachusetts Rhode Island Vermont Height (summary): Min. 1st Qu. Median Mean 3rd Qu. Max. 17.2 28.1 39.2 52.3 58.8 282.0 Available components: [1] "order" "height" "ac" "merge" "diss" "call" [7] "method" "order.lab" > ag22 <- agnes(votes.repub, method= "complete", keep.diss=FALSE,keep.data=FALSE) > stopifnot(identical(agn2[-5:-6], ag2.[-5:-6]), + identical(Dvr, daisy(votes.repub)), # DUP=FALSE (!) + identical(ag2.[-6], ag22[-6]) + ) > > data(agriculture) > summary(agnes(agriculture)) Object of class 'agnes' from call: agnes(x = agriculture) Agglomerative coefficient: 0.781893 Order of objects: [1] B NL D F UK DK L I GR P E IRL Merge: [,1] [,2] [1,] -1 -10 [2,] -2 -9 [3,] 1 -3 [4,] 3 -6 [5,] -5 -7 [6,] 4 -12 [7,] 6 2 [8,] -4 -11 [9,] 7 -8 [10,] 8 5 [11,] 9 10 Height: [1] 1.64924 2.24836 2.76918 4.02677 4.78835 2.22036 5.29409 14.77963 [9] 5.16236 8.55075 3.14006 66 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 1.65 4.36 7.99 9.59 13.25 24.04 Metric : euclidean Number of objects : 12 Available components: [1] "order" "height" "ac" "merge" "diss" "call" [7] "method" "order.lab" "data" > > data(ruspini) > summary(ar0 <- agnes(ruspini, keep.diss=FALSE, keep.data=FALSE)) Object of class 'agnes' from call: agnes(x = ruspini, keep.diss = FALSE, keep.data = FALSE) Agglomerative coefficient: 0.947954 Order of objects: [1] 1 2 3 5 4 6 8 7 9 10 14 15 17 16 18 19 11 12 13 20 61 62 66 63 64 [26] 68 65 67 69 70 71 72 75 73 74 21 22 23 24 27 28 29 30 25 26 32 35 31 36 39 [51] 40 33 34 37 38 41 42 43 44 45 49 51 53 50 54 52 55 56 57 59 60 58 46 47 48 Merge: [,1] [,2] [1,] -18 -19 [2,] -55 -56 [3,] -27 -28 [4,] -49 -51 [5,] -33 -34 [6,] -23 -24 [7,] -67 -69 [8,] -59 -60 [9,] -29 -30 [10,] -36 -39 [11,] -32 -35 [12,] -50 -54 [13,] -25 -26 [14,] -16 1 [15,] -70 -71 [16,] -64 -68 [17,] -37 -38 [18,] 12 -52 [19,] -62 -66 [20,] -12 -13 [21,] -9 -10 [22,] -42 -43 [23,] -15 -17 [24,] -47 -48 [25,] -21 -22 [26,] 7 15 [27,] 2 -57 [28,] 4 -53 [29,] 10 -40 [30,] 3 9 [31,] -73 -74 [32,] -72 -75 [33,] -11 20 [34,] 13 11 [35,] -6 -8 [36,] -14 23 [37,] -2 -3 [38,] -65 26 [39,] 5 17 [40,] 25 6 [41,] 36 14 [42,] 34 -31 [43,] -4 35 [44,] 28 18 [45,] 27 8 [46,] 19 -63 [47,] -46 24 [48,] -1 37 [49,] 16 38 [50,] 40 30 [51,] 42 29 [52,] 33 -20 [53,] 49 32 [54,] 51 39 [55,] 21 41 [56,] 48 -5 [57,] 45 -58 [58,] 53 31 [59,] 43 -7 [60,] 50 54 [61,] 44 57 [62,] -41 22 [63,] -61 46 [64,] 55 52 [65,] 63 58 [66,] -44 -45 [67,] 59 64 [68,] 56 67 [69,] 66 61 [70,] 60 62 [71,] 69 47 [72,] 70 71 [73,] 68 65 [74,] 73 72 Height: [1] 9.26758 6.40312 12.13789 22.37868 7.63441 6.32456 14.58991 [8] 21.63544 4.12311 12.07902 6.36396 4.24264 7.23741 3.56155 [15] 1.41421 16.38921 5.85486 4.12311 10.69547 67.75052 15.48443 [22] 4.12311 8.94386 17.00500 3.60555 9.53375 6.46443 2.82843 [29] 4.48680 3.60555 10.91541 5.83095 14.34411 5.65685 101.14200 [36] 4.47214 6.98022 2.23607 9.56136 2.00000 5.61339 2.82843 [43] 14.95692 3.16228 6.19728 3.00000 7.28356 9.97147 3.00000 [50] 5.47542 11.07404 2.23607 6.60456 3.60555 24.90532 15.45463 [57] 4.24264 64.42555 17.02939 22.56493 2.23607 5.22383 8.28122 [64] 3.16228 3.81721 15.20808 2.00000 5.19258 8.51123 2.82843 [71] 12.62990 34.72475 9.14005 4.47214 Available components: [1] "order" "height" "ac" "merge" "diss" "call" [7] "method" "order.lab" > summary(ar1 <- agnes(ruspini, metric = "manhattan")) Object of class 'agnes' from call: agnes(x = ruspini, metric = "manhattan") Agglomerative coefficient: 0.946667 Order of objects: [1] 1 2 3 5 4 6 8 7 9 10 14 16 18 19 15 17 11 12 13 20 61 62 66 63 73 [26] 74 64 68 65 67 69 70 71 72 75 21 22 23 24 27 28 29 30 25 26 32 35 31 36 39 [51] 40 33 34 37 38 41 42 43 44 45 49 51 53 50 54 52 55 56 57 59 60 58 46 47 48 Merge: [,1] [,2] [1,] -55 -56 [2,] -27 -28 [3,] -18 -19 [4,] -49 -51 [5,] -36 -39 [6,] -33 -34 [7,] -32 -35 [8,] -23 -24 [9,] -67 -69 [10,] -59 -60 [11,] -50 -54 [12,] -29 -30 [13,] -25 -26 [14,] -16 3 [15,] -70 -71 [16,] -64 -68 [17,] -62 -66 [18,] 11 -52 [19,] -37 -38 [20,] -12 -13 [21,] -9 -10 [22,] 9 15 [23,] 1 -57 [24,] -47 -48 [25,] -42 -43 [26,] -21 -22 [27,] -15 -17 [28,] 4 -53 [29,] 2 12 [30,] 5 -40 [31,] 6 19 [32,] 13 7 [33,] -11 20 [34,] -73 -74 [35,] -72 -75 [36,] -6 -8 [37,] -65 22 [38,] -14 14 [39,] -2 -3 [40,] 32 -31 [41,] 38 27 [42,] 26 8 [43,] 28 18 [44,] -46 24 [45,] -4 36 [46,] 23 10 [47,] -1 39 [48,] 42 29 [49,] 33 -20 [50,] 37 35 [51,] 40 30 [52,] 17 -63 [53,] 16 50 [54,] 51 31 [55,] 46 -58 [56,] 21 41 [57,] 47 -5 [58,] 45 -7 [59,] 52 34 [60,] -44 -45 [61,] 48 54 [62,] 43 55 [63,] 59 53 [64,] 56 49 [65,] -41 25 [66,] -61 63 [67,] 57 58 [68,] 67 64 [69,] 60 62 [70,] 61 65 [71,] 69 44 [72,] 70 71 [73,] 68 66 [74,] 73 72 Height: [1] 11.50000 9.00000 16.00000 26.25000 10.00000 8.00000 16.66667 [8] 28.70833 5.00000 15.50000 8.66667 4.00000 2.00000 9.25000 [15] 6.00000 20.50000 7.50000 5.00000 12.33333 94.33333 22.78571 [22] 5.00000 12.50000 18.00000 8.00000 20.20000 5.00000 13.78571 [29] 8.25000 4.00000 5.50000 5.00000 12.40000 8.00000 125.71357 [36] 6.00000 9.50000 3.00000 11.87500 2.00000 7.00000 4.00000 [43] 18.72917 4.00000 7.50000 3.00000 9.25000 12.40000 3.00000 [50] 7.50000 14.43750 3.00000 7.50000 5.00000 32.38333 21.00000 [57] 6.00000 85.49616 18.00000 28.75000 3.00000 6.50000 9.55556 [64] 4.00000 5.00000 19.61111 2.00000 6.00000 11.00000 4.00000 [71] 15.40000 47.02381 10.00000 6.00000 2775 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 2.0 52.5 97.0 91.0 128.0 187.0 Metric : manhattan Number of objects : 75 Available components: [1] "order" "height" "ac" "merge" "diss" "call" [7] "method" "order.lab" "data" > str(ar1) List of 9 $ order : int [1:75] 1 2 3 5 4 6 8 7 9 10 ... $ height : num [1:74] 11.5 9 16 26.2 10 ... $ ac : num 0.947 $ merge : int [1:74, 1:2] -55 -27 -18 -49 -36 -33 -32 -23 -67 -59 ... $ diss : 'dissimilarity' num [1:2775] 11 12 29 13 25 43 33 22 27 39 ... ..- attr(*, "Size")= int 75 ..- attr(*, "Metric")= chr "manhattan" ..- attr(*, "Labels")= chr [1:75] "1" "2" "3" "4" ... $ call : language agnes(x = ruspini, metric = "manhattan") $ method : chr "average" $ order.lab: chr [1:75] "1" "2" "3" "5" ... $ data : num [1:75, 1:2] 4 5 10 9 13 13 12 15 18 19 ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr [1:75] "1" "2" "3" "4" ... .. ..$ : chr [1:2] "x" "y" - attr(*, "class")= chr [1:2] "agnes" "twins" > > showProc.time() Time (user system elapsed): 0.602 0.061 0.667 > > summary(ar2 <- agnes(ruspini, metric="manhattan", method = "weighted")) Object of class 'agnes' from call: agnes(x = ruspini, metric = "manhattan", method = "weighted") Agglomerative coefficient: 0.942387 Order of objects: [1] 1 2 3 5 9 10 14 16 18 19 15 17 4 6 8 7 11 12 13 20 61 64 68 65 67 [26] 69 70 71 62 66 63 72 75 73 74 21 22 23 24 27 28 29 30 25 26 32 35 31 36 39 [51] 40 33 34 37 38 41 42 43 44 45 49 51 53 50 54 52 55 56 57 59 60 58 46 47 48 Merge: [,1] [,2] [1,] -55 -56 [2,] -27 -28 [3,] -18 -19 [4,] -49 -51 [5,] -36 -39 [6,] -33 -34 [7,] -32 -35 [8,] -23 -24 [9,] -67 -69 [10,] -59 -60 [11,] -50 -54 [12,] -29 -30 [13,] -25 -26 [14,] -16 3 [15,] -70 -71 [16,] -64 -68 [17,] -62 -66 [18,] 11 -52 [19,] -37 -38 [20,] -12 -13 [21,] -9 -10 [22,] 9 15 [23,] 1 -57 [24,] -47 -48 [25,] -42 -43 [26,] -21 -22 [27,] -15 -17 [28,] 4 -53 [29,] 2 12 [30,] 5 -40 [31,] 6 19 [32,] 13 7 [33,] -11 20 [34,] -73 -74 [35,] -72 -75 [36,] -14 14 [37,] -6 -8 [38,] -65 22 [39,] 36 27 [40,] -2 -3 [41,] 32 -31 [42,] 28 18 [43,] 26 8 [44,] -46 24 [45,] -4 37 [46,] 23 10 [47,] -1 40 [48,] 16 38 [49,] 43 29 [50,] 17 -63 [51,] 41 30 [52,] 33 -20 [53,] 35 34 [54,] 46 -58 [55,] 47 -5 [56,] 51 31 [57,] 21 39 [58,] 45 -7 [59,] -44 -45 [60,] -61 48 [61,] 42 54 [62,] 49 56 [63,] -41 25 [64,] 55 57 [65,] 60 50 [66,] 65 53 [67,] 58 52 [68,] 59 61 [69,] 64 67 [70,] 62 63 [71,] 68 44 [72,] 70 71 [73,] 69 66 [74,] 73 72 Height: [1] 11.5000 9.0000 15.2500 21.7734 5.0000 15.8750 8.0000 4.0000 [9] 2.0000 9.0000 6.0000 32.1172 10.0000 8.0000 16.0000 27.9062 [17] 7.5000 5.0000 13.2500 97.9766 18.3125 5.0000 11.8750 8.2500 [25] 4.0000 5.5000 5.0000 22.3438 5.0000 12.5000 23.7812 8.0000 [33] 14.5000 8.0000 114.9764 6.0000 9.5000 3.0000 11.8750 2.0000 [41] 7.0000 4.0000 20.2031 4.0000 7.5000 3.0000 9.2500 12.6250 [49] 3.0000 7.5000 15.6875 3.0000 7.5000 5.0000 33.5469 21.0000 [57] 6.0000 69.4453 18.0000 28.4375 3.0000 6.5000 9.5000 4.0000 [65] 5.0000 19.1250 2.0000 6.0000 10.5000 4.0000 15.0000 41.5312 [73] 10.0000 6.0000 2775 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 2.0 52.5 97.0 91.0 128.0 187.0 Metric : manhattan Number of objects : 75 Available components: [1] "order" "height" "ac" "merge" "diss" "call" [7] "method" "order.lab" "data" > print (ar3 <- agnes(ruspini, metric="manhattan", method = "flexible", + par.method = 0.5)) Call: agnes(x = ruspini, metric = "manhattan", method = "flexible", par.method = 0.5) Agglomerative coefficient: 0.942387 Order of objects: [1] 1 2 3 5 9 10 14 16 18 19 15 17 4 6 8 7 11 12 13 20 61 64 68 65 67 [26] 69 70 71 62 66 63 72 75 73 74 21 22 23 24 27 28 29 30 25 26 32 35 31 36 39 [51] 40 33 34 37 38 41 42 43 44 45 49 51 53 50 54 52 55 56 57 59 60 58 46 47 48 Height (summary): Min. 1st Qu. Median Mean 3rd Qu. Max. 2.00 5.00 8.12 14.22 15.58 114.98 Available components: [1] "order" "height" "ac" "merge" "diss" "call" [7] "method" "order.lab" "data" > stopifnot(all.equal(ar2[1:4], ar3[1:4], tol=1e-12)) > > showProc.time() Time (user system elapsed): 0.003 0.001 0.004 > > ## Small example, testing "flexible" vs "single" > i8 <- -c(1:2, 9:10) > dim(agr8 <- agriculture[i8, ]) [1] 8 2 > i5 <- -c(1:2, 8:12) > dim(agr5 <- agriculture[i5, ]) [1] 5 2 > > ##' Check equivalence of method "flexible" (par=...) with one > ##' of ("single", "complete", "weighted") > chk <- function(d, method=c("single", "complete", "weighted"), + trace.lev = 1, + iC = -(6:7), # <- not using 'call' and 'method' for comparisons + doplot = FALSE, tol = 1e-12) + { + if(!inherits(d, "dist")) d <- daisy(d, "manhattan") + method <- match.arg(method) + par.meth <- list("single" = c(.5, .5, 0, -.5), + "complete"= c(.5, .5, 0, +.5), + "weighted"= c(0.5)) + a.s <- agnes(d, method=method, trace.lev=trace.lev) + ## From theory, this should give the same, but it does not --- why ??? + a.f <- agnes(d, method="flex", par.method = par.meth[[method]], trace.lev=trace.lev) + + if(doplot) { + op <- par(mfrow = c(2,2), mgp = c(1.6, 0.6, 0), mar = .1 + c(4,4,2,1)) + on.exit(par(op)) + plot(a.s) + plot(a.f) + } + structure(all.equal(a.s[iC], a.f[iC], tolerance = tol), + fits = list(s = a.s, f = a.f)) + } > > chk(agr5, trace = 3) C agnes(n=5, method = 2, ..): 4 merging steps nmerge=0, j=2, d_min = D(1,4) = 3.40000; -> (-1,-4); last=4; upd(n,b); old D(A, j), D(B, j), j=2 = (31.5,28.1); new D(A', 2) = 28.1 old D(A, j), D(B, j), j=3 = (14.7,11.3); new D(A', 3) = 11.3 old D(A, j), D(B, j), j=5 = (18.3,14.9); new D(A', 5) = 14.9 --> size(A_new)= 2 nmerge=1, j=2, d_min = D(3,5) = 3.60000; -> (-3,-5); last=5; old D(A, j), D(B, j), j=1 = (11.3,14.9); new D(A', 1) = 11.3 old D(A, j), D(B, j), j=2 = (16.8,13.2); new D(A', 2) = 13.2 --> size(A_new)= 2 nmerge=2, j=2, d_min = D(1,3) = 11.3000; -> (1,2); last=4; upd(n,b); old D(A, j), D(B, j), j=2 = (28.1,13.2); new D(A', 2) = 13.2 --> size(A_new)= 4 nmerge=3, j=2, d_min = D(1,2) = 13.2000; -> (3,-2); last=5; --> size(A_new)= 5 C agnes(n=5, method = 6, ..): |par| = 4, alpha[1:4] = (0.5,0.5,0,-0.5); 4 merging steps nmerge=0, j=2, d_min = D(1,4) = 3.40000; -> (-1,-4); last=4; upd(n,b); old D(A, j), D(B, j), j=2 = (31.5,28.1); new D(A', 2) = 28.1 old D(A, j), D(B, j), j=3 = (14.7,11.3); new D(A', 3) = 11.3 old D(A, j), D(B, j), j=5 = (18.3,14.9); new D(A', 5) = 14.9 --> size(A_new)= 2 nmerge=1, j=2, d_min = D(3,5) = 3.60000; -> (-3,-5); last=5; old D(A, j), D(B, j), j=1 = (11.3,14.9); new D(A', 1) = 11.3 old D(A, j), D(B, j), j=2 = (16.8,13.2); new D(A', 2) = 13.2 --> size(A_new)= 2 nmerge=2, j=2, d_min = D(1,3) = 11.3000; -> (1,2); last=4; upd(n,b); old D(A, j), D(B, j), j=2 = (28.1,13.2); new D(A', 2) = 13.2 --> size(A_new)= 4 nmerge=3, j=2, d_min = D(1,2) = 13.2000; -> (3,-2); last=5; --> size(A_new)= 5 [1] TRUE attr(,"fits") attr(,"fits")$s Call: agnes(x = d, method = method, trace.lev = trace.lev) Agglomerative coefficient: 0.587879 Order of objects: [1] D F E IRL GR Height (summary): Min. 1st Qu. Median Mean 3rd Qu. Max. 3.40 3.55 7.45 7.88 11.78 13.20 Available components: [1] "order" "height" "ac" "merge" "diss" "call" [7] "method" "order.lab" attr(,"fits")$f Call: agnes(x = d, method = "flex", par.method = par.meth[[method]], trace.lev = trace.lev) Agglomerative coefficient: 0.587879 Order of objects: [1] D F E IRL GR Height (summary): Min. 1st Qu. Median Mean 3rd Qu. Max. 3.40 3.55 7.45 7.88 11.78 13.20 Available components: [1] "order" "height" "ac" "merge" "diss" "call" [7] "method" "order.lab" > > stopifnot(chk(agr5), chk(agr5, "complete", trace = 2), chk(agr5, "weighted"), + chk(agr8), chk(agr8, "complete"), chk(agr8, "weighted", trace.lev=2), + chk(agriculture), chk(agriculture, "complete"), + chk(ruspini), chk(ruspini, "complete"), chk(ruspini, "weighted")) C agnes(n=5, method = 2, ..): 4 merging steps C agnes(n=5, method = 6, ..): |par| = 4, alpha[1:4] = (0.5,0.5,0,-0.5); 4 merging steps C agnes(n=5, method = 3, ..): 4 merging steps nmerge=0, j=2, d_min = D(1,4) = 3.40000; last=4; upd(n,b); size(A_new)= 2 nmerge=1, j=2, d_min = D(3,5) = 3.60000; last=5; size(A_new)= 2 nmerge=2, j=2, d_min = D(2,3) = 16.8000; last=4; size(A_new)= 3 nmerge=3, j=2, d_min = D(1,2) = 31.5000; last=3; size(A_new)= 5 C agnes(n=5, method = 6, ..): |par| = 4, alpha[1:4] = (0.5,0.5,0,0.5); 4 merging steps nmerge=0, j=2, d_min = D(1,4) = 3.40000; last=4; upd(n,b); size(A_new)= 2 nmerge=1, j=2, d_min = D(3,5) = 3.60000; last=5; size(A_new)= 2 nmerge=2, j=2, d_min = D(2,3) = 16.8000; last=4; size(A_new)= 3 nmerge=3, j=2, d_min = D(1,2) = 31.5000; last=3; size(A_new)= 5 C agnes(n=5, method = 5, ..): 4 merging steps C agnes(n=5, method = 6, ..): 4 merging steps C agnes(n=8, method = 2, ..): 7 merging steps C agnes(n=8, method = 6, ..): |par| = 4, alpha[1:4] = (0.5,0.5,0,-0.5); 7 merging steps C agnes(n=8, method = 3, ..): 7 merging steps C agnes(n=8, method = 6, ..): |par| = 4, alpha[1:4] = (0.5,0.5,0,0.5); 7 merging steps C agnes(n=8, method = 5, ..): 7 merging steps nmerge=0, j=2, d_min = D(1,4) = 3.40000; last=4; upd(n,b); size(A_new)= 2 nmerge=1, j=2, d_min = D(3,5) = 3.60000; last=5; size(A_new)= 2 nmerge=2, j=2, d_min = D(1,6) = 5.40000; last=6; upd(n,b); size(A_new)= 3 nmerge=3, j=2, d_min = D(2,7) = 6.70000; last=7; upd(n,b); size(A_new)= 2 nmerge=4, j=2, d_min = D(1,8) = 7.75000; last=8; upd(n,b); size(A_new)= 4 nmerge=5, j=2, d_min = D(2,3) = 11.6500; last=7; size(A_new)= 4 nmerge=6, j=2, d_min = D(1,2) = 18.3750; last=5; size(A_new)= 8 C agnes(n=8, method = 6, ..): 7 merging steps nmerge=0, j=2, d_min = D(1,4) = 3.40000; last=4; upd(n,b); size(A_new)= 2 nmerge=1, j=2, d_min = D(3,5) = 3.60000; last=5; size(A_new)= 2 nmerge=2, j=2, d_min = D(1,6) = 5.40000; last=6; upd(n,b); size(A_new)= 3 nmerge=3, j=2, d_min = D(2,7) = 6.70000; last=7; upd(n,b); size(A_new)= 2 nmerge=4, j=2, d_min = D(1,8) = 7.75000; last=8; upd(n,b); size(A_new)= 4 nmerge=5, j=2, d_min = D(2,3) = 11.6500; last=7; size(A_new)= 4 nmerge=6, j=2, d_min = D(1,2) = 18.3750; last=5; size(A_new)= 8 C agnes(n=12, method = 2, ..): 11 merging steps C agnes(n=12, method = 6, ..): |par| = 4, alpha[1:4] = (0.5,0.5,0,-0.5); 11 merging steps C agnes(n=12, method = 3, ..): 11 merging steps C agnes(n=12, method = 6, ..): |par| = 4, alpha[1:4] = (0.5,0.5,0,0.5); 11 merging steps C agnes(n=75, method = 2, ..): 74 merging steps C agnes(n=75, method = 6, ..): |par| = 4, alpha[1:4] = (0.5,0.5,0,-0.5); 74 merging steps C agnes(n=75, method = 3, ..): 74 merging steps C agnes(n=75, method = 6, ..): |par| = 4, alpha[1:4] = (0.5,0.5,0,0.5); 74 merging steps C agnes(n=75, method = 5, ..): 74 merging steps C agnes(n=75, method = 6, ..): 74 merging steps > > showProc.time() Time (user system elapsed): 0.04 0.001 0.041 > > ## an invalid "flexible" case - now must give error early: > x <- rbind(c( -6, -9), c( 0, 13), + c(-15, 6), c(-14, 0), c(12,-10)) > (dx <- daisy(x, "manhattan")) Dissimilarities : 1 2 3 4 2 28 3 24 22 4 17 27 7 5 19 35 43 36 Metric : manhattan Number of objects : 5 > a.x <- tryCatch(agnes(dx, method="flexible", par = -.2), + error = function(e)e) > ## agnes(method=6, par.method=*) lead to invalid merge; step 4, D(.,.)=-26.1216 > if(!inherits(a.x, "error")) stop("invalid 'par' in \"flexible\" did not give error") > if(!all(vapply(c("par[.]method", "merge"), grepl, NA, x=a.x$message))) + stop("error message did not contain expected words") > > > proc.time() user system elapsed 0.767 0.094 0.859 cluster/tests/fanny-ex.Rout.save0000644000176200001440000020223514724620406016443 0ustar liggesusers R version 4.4.1 Patched (2024-09-30 r87205) -- "Race for Your Life" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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. > ## IGNORE_RDIFF_BEGIN > .libPaths() # show full library tree {also as check of R CMD check!} [1] "/tmp/RtmpeWFqQT/RLIBS_28dee75f47fb34" [2] "/u/maechler/R/D/r-patched/F38-64-inst/library" > ## IGNORE_RDIFF_END > library(cluster) > > ####---------- Tests for FANNY i.e., fanny() -------------------------- > #### > ### -- thanks to ../.Rbuildignore , the output of this is > ### -- only compared to saved values for the maintainer > > ###--- An extension of example(fanny) : ------------------- > set.seed(21) > ## generate 10+15 objects in two clusters, plus 3 objects lying > ## between those clusters. > x <- rbind(cbind(rnorm(10, 0, 0.5), rnorm(10, 0, 0.5)), + cbind(rnorm(15, 5, 0.5), rnorm(15, 5, 0.5)), + cbind(rnorm( 3,3.2,0.5), rnorm( 3,3.2,0.5))) > > .proctime00 <- proc.time() > > (fannyx <- fanny(x, 2)) Fuzzy Clustering object of class 'fanny' : m.ship.expon. 2 objective 14.17769 tolerance 1e-15 iterations 9 converged 1 maxit 500 n 28 Membership coefficients (in %, rounded): [,1] [,2] [1,] 89 11 [2,] 95 5 [3,] 92 8 [4,] 94 6 [5,] 89 11 [6,] 93 7 [7,] 92 8 [8,] 93 7 [9,] 95 5 [10,] 96 4 [11,] 5 95 [12,] 7 93 [13,] 4 96 [14,] 7 93 [15,] 5 95 [16,] 6 94 [17,] 10 90 [18,] 5 95 [19,] 4 96 [20,] 8 92 [21,] 8 92 [22,] 4 96 [23,] 6 94 [24,] 6 94 [25,] 12 88 [26,] 40 60 [27,] 22 78 [28,] 29 71 Fuzzyness coefficients: dunn_coeff normalized 0.8436121 0.6872242 Closest hard clustering: [1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > summary(fannyx) Fuzzy Clustering object of class 'fanny' : m.ship.expon. 2 objective 14.17769 tolerance 1e-15 iterations 9 converged 1 maxit 500 n 28 Membership coefficients (in %, rounded): [,1] [,2] [1,] 89 11 [2,] 95 5 [3,] 92 8 [4,] 94 6 [5,] 89 11 [6,] 93 7 [7,] 92 8 [8,] 93 7 [9,] 95 5 [10,] 96 4 [11,] 5 95 [12,] 7 93 [13,] 4 96 [14,] 7 93 [15,] 5 95 [16,] 6 94 [17,] 10 90 [18,] 5 95 [19,] 4 96 [20,] 8 92 [21,] 8 92 [22,] 4 96 [23,] 6 94 [24,] 6 94 [25,] 12 88 [26,] 40 60 [27,] 22 78 [28,] 29 71 Fuzzyness coefficients: dunn_coeff normalized 0.8436121 0.6872242 Closest hard clustering: [1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Silhouette plot information: cluster neighbor sil_width 10 1 2 0.8803873 9 1 2 0.8726948 2 1 2 0.8624826 4 1 2 0.8569474 8 1 2 0.8446916 7 1 2 0.8379922 6 1 2 0.8260655 3 1 2 0.8218139 1 1 2 0.8018154 5 1 2 0.7778144 22 2 1 0.8622465 19 2 1 0.8526094 11 2 1 0.8524562 13 2 1 0.8521850 18 2 1 0.8474339 15 2 1 0.8473217 16 2 1 0.8430436 23 2 1 0.8391805 24 2 1 0.8387914 12 2 1 0.8326846 14 2 1 0.8293329 20 2 1 0.8187388 21 2 1 0.8173937 17 2 1 0.7951874 25 2 1 0.7718178 27 2 1 0.6444521 28 2 1 0.5321902 26 2 1 0.3304049 Average silhouette width per cluster: [1] 0.8382705 0.7781928 Average silhouette width of total data set: [1] 0.7996491 378 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 0.07909 1.03510 2.98900 3.88190 6.89260 8.44010 Metric : euclidean Number of objects : 28 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > str(fannyx) List of 11 $ membership : num [1:28, 1:2] 0.889 0.953 0.916 0.937 0.891 ... $ coeff : Named num [1:2] 0.844 0.687 ..- attr(*, "names")= chr [1:2] "dunn_coeff" "normalized" $ memb.exp : num 2 $ clustering : int [1:28] 1 1 1 1 1 1 1 1 1 1 ... $ k.crisp : num 2 $ objective : Named num [1:2] 1.42e+01 1.00e-15 ..- attr(*, "names")= chr [1:2] "objective" "tolerance" $ convergence: Named int [1:3] 9 1 500 ..- attr(*, "names")= chr [1:3] "iterations" "converged" "maxit" $ diss : 'dissimilarity' num [1:378] 1.523 0.987 1.602 1.584 1.903 ... ..- attr(*, "Size")= int 28 ..- attr(*, "Metric")= chr "euclidean" $ call : language fanny(x = x, k = 2) $ silinfo :List of 3 ..$ widths : num [1:28, 1:3] 1 1 1 1 1 1 1 1 1 1 ... .. ..- attr(*, "dimnames")=List of 2 .. .. ..$ : chr [1:28] "10" "9" "2" "4" ... .. .. ..$ : chr [1:3] "cluster" "neighbor" "sil_width" ..$ clus.avg.widths: num [1:2] 0.838 0.778 ..$ avg.width : num 0.8 $ data : num [1:28, 1:2] 0.397 0.261 0.873 -0.636 1.099 ... - attr(*, "class")= chr [1:2] "fanny" "partition" > ## Different platforms differ (even gcc 3.0.1 vs 3.2 on same platform)! > ## {70 or 71 iterations} > ## ==> No "fanny-ex.Rout.save" is distributed ! > ## -------------------------------------------- > ## IGNORE_RDIFF_BEGIN > summary(fanny(x,3))# one extra cluster Fuzzy Clustering object of class 'fanny' : m.ship.expon. 2 objective 9.39325 tolerance 1e-15 iterations 45 converged 1 maxit 500 n 28 Membership coefficients (in %, rounded): [,1] [,2] [,3] [1,] 80 10 11 [2,] 91 4 5 [3,] 84 8 9 [4,] 88 5 6 [5,] 79 10 12 [6,] 86 7 8 [7,] 86 7 8 [8,] 87 6 7 [9,] 91 4 5 [10,] 93 3 4 [11,] 3 55 43 [12,] 3 72 25 [13,] 3 41 57 [14,] 4 61 35 [15,] 2 75 23 [16,] 3 54 42 [17,] 5 37 58 [18,] 3 38 60 [19,] 2 38 59 [20,] 4 66 30 [21,] 4 41 55 [22,] 2 61 37 [23,] 3 73 24 [24,] 4 58 38 [25,] 7 43 50 [26,] 22 31 47 [27,] 11 32 58 [28,] 15 33 52 Fuzzyness coefficients: dunn_coeff normalized 0.5864035 0.3796053 Closest hard clustering: [1] 1 1 1 1 1 1 1 1 1 1 2 2 3 2 2 2 3 3 3 2 3 2 2 2 3 3 3 3 Silhouette plot information: cluster neighbor sil_width 10 1 3 0.86761636 9 1 3 0.85927690 2 1 3 0.84637141 4 1 3 0.84263476 8 1 3 0.82827133 7 1 3 0.82191633 6 1 3 0.80515251 3 1 3 0.80077380 1 1 3 0.78174030 5 1 3 0.74877291 23 2 3 0.69381057 15 2 3 0.68790994 12 2 3 0.68113233 20 2 3 0.60243554 24 2 3 0.53703144 22 2 3 0.51528059 14 2 3 0.49467784 11 2 3 0.47962831 16 2 3 0.47844504 27 3 2 0.34881727 28 3 2 0.33616051 26 3 2 0.32389804 17 3 2 -0.02523208 21 3 2 -0.16440140 25 3 2 -0.21039298 18 3 2 -0.21192236 19 3 2 -0.26773065 13 3 2 -0.29006339 Average silhouette width per cluster: [1] 0.82025266 0.57448351 -0.01787412 Average silhouette width of total data set: [1] 0.4718575 378 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 0.07909 1.03510 2.98900 3.88190 6.89260 8.44010 Metric : euclidean Number of objects : 28 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > ## IGNORE_RDIFF_END > > ## CRAN-relevant M1 mac: aarch64-apple-darwin24.1.0 / Apple clang version 16.0.0 (clang-1600.0.26.6) / macOS Sequoia 15.1.1 > ## IGNORE_RDIFF_BEGIN > (fanny(x,2, memb.exp = 1.5)) Fuzzy Clustering object of class 'fanny' : m.ship.expon. 1.5 objective 16.08227 tolerance 1e-15 iterations 10 converged 1 maxit 500 n 28 Membership coefficients (in %, rounded): [,1] [,2] [1,] 99 1 [2,] 100 0 [3,] 99 1 [4,] 100 0 [5,] 98 2 [6,] 99 1 [7,] 99 1 [8,] 99 1 [9,] 100 0 [10,] 100 0 [11,] 0 100 [12,] 1 99 [13,] 0 100 [14,] 1 99 [15,] 0 100 [16,] 0 100 [17,] 1 99 [18,] 0 100 [19,] 0 100 [20,] 1 99 [21,] 1 99 [22,] 0 100 [23,] 0 100 [24,] 0 100 [25,] 2 98 [26,] 26 74 [27,] 6 94 [28,] 12 88 Fuzzyness coefficients: dunn_coeff normalized 0.9635331 0.9270661 Closest hard clustering: [1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > ## IGNORE_RDIFF_END > (fanny(x,2, memb.exp = 1.2)) Fuzzy Clustering object of class 'fanny' : m.ship.expon. 1.2 objective 16.49219 tolerance 1e-15 iterations 7 converged 1 maxit 500 n 28 Membership coefficients (in %, rounded): [,1] [,2] [1,] 100 0 [2,] 100 0 [3,] 100 0 [4,] 100 0 [5,] 100 0 [6,] 100 0 [7,] 100 0 [8,] 100 0 [9,] 100 0 [10,] 100 0 [11,] 0 100 [12,] 0 100 [13,] 0 100 [14,] 0 100 [15,] 0 100 [16,] 0 100 [17,] 0 100 [18,] 0 100 [19,] 0 100 [20,] 0 100 [21,] 0 100 [22,] 0 100 [23,] 0 100 [24,] 0 100 [25,] 0 100 [26,] 5 95 [27,] 0 100 [28,] 0 100 Fuzzyness coefficients: dunn_coeff normalized 0.9964339 0.9928679 Closest hard clustering: [1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > (fanny(x,2, memb.exp = 1.1)) Fuzzy Clustering object of class 'fanny' : m.ship.expon. 1.1 objective 16.51151 tolerance 1e-15 iterations 5 converged 1 maxit 500 n 28 Membership coefficients (in %, rounded): [,1] [,2] [1,] 100 0 [2,] 100 0 [3,] 100 0 [4,] 100 0 [5,] 100 0 [6,] 100 0 [7,] 100 0 [8,] 100 0 [9,] 100 0 [10,] 100 0 [11,] 0 100 [12,] 0 100 [13,] 0 100 [14,] 0 100 [15,] 0 100 [16,] 0 100 [17,] 0 100 [18,] 0 100 [19,] 0 100 [20,] 0 100 [21,] 0 100 [22,] 0 100 [23,] 0 100 [24,] 0 100 [25,] 0 100 [26,] 0 100 [27,] 0 100 [28,] 0 100 Fuzzyness coefficients: dunn_coeff normalized 0.9998489 0.9996979 Closest hard clustering: [1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > (fanny(x,2, memb.exp = 3)) Fuzzy Clustering object of class 'fanny' : m.ship.expon. 3 objective 8.844693 tolerance 1e-15 iterations 11 converged 1 maxit 500 n 28 Membership coefficients (in %, rounded): [,1] [,2] [1,] 73 27 [2,] 82 18 [3,] 76 24 [4,] 79 21 [5,] 74 26 [6,] 78 22 [7,] 77 23 [8,] 79 21 [9,] 81 19 [10,] 82 18 [11,] 18 82 [12,] 21 79 [13,] 18 82 [14,] 22 78 [15,] 19 81 [16,] 20 80 [17,] 26 74 [18,] 19 81 [19,] 18 82 [20,] 23 77 [21,] 23 77 [22,] 16 84 [23,] 21 79 [24,] 21 79 [25,] 28 72 [26,] 46 54 [27,] 36 64 [28,] 40 60 Fuzzyness coefficients: dunn_coeff normalized 0.6516764 0.3033528 Closest hard clustering: [1] 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > ## for subsetting, when compairing: > not.conv <- setdiff(names(fannyx), c("convergence", "call")) > notMconv <- setdiff(names(fannyx), c("membership", "convergence", "call")) > > data(ruspini) # < to run under R 1.9.1 > summary(fanny(ruspini, 3), digits = 9) Fuzzy Clustering object of class 'fanny' : m.ship.expon. 2 objective 719.5606 tolerance 1e-15 iterations 21 converged 1 maxit 500 n 75 Membership coefficients (in %, rounded): [,1] [,2] [,3] 1 68 13 19 2 73 12 15 3 76 10 14 4 73 14 13 5 69 11 20 6 80 9 11 7 64 20 16 8 79 10 11 9 83 7 10 10 85 7 9 11 82 9 10 12 82 8 10 13 78 11 12 14 81 7 12 15 77 8 15 16 81 7 12 17 70 10 20 18 79 8 13 19 78 8 14 20 73 12 15 21 17 74 10 22 14 78 8 23 12 80 8 24 14 78 8 25 10 83 6 26 9 86 5 27 10 84 6 28 11 83 6 29 14 77 8 30 14 78 8 31 11 83 7 32 8 87 5 33 8 87 5 34 8 87 5 35 8 88 5 36 9 86 6 37 8 86 5 38 9 86 6 39 9 85 6 40 11 82 7 41 20 68 12 42 13 78 9 43 13 78 9 44 22 61 17 45 27 52 21 46 33 39 28 47 35 38 28 48 35 39 26 49 26 53 22 50 27 50 24 51 25 53 22 52 26 51 23 53 25 54 21 54 27 48 24 55 28 45 27 56 28 44 27 57 27 47 26 58 26 49 24 59 28 46 27 60 28 44 28 61 15 8 77 62 12 6 82 63 13 8 79 64 11 5 83 65 8 4 88 66 11 6 83 67 7 4 89 68 14 7 79 69 8 4 89 70 7 3 90 71 7 3 89 72 11 5 83 73 11 6 83 74 12 6 81 75 13 6 81 Fuzzyness coefficients: dunn_coeff normalized 0.6045235 0.4067852 Closest hard clustering: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 Silhouette plot information: cluster neighbor sil_width 10 1 3 0.8056096 6 1 3 0.7954977 9 1 3 0.7923048 11 1 3 0.7831672 8 1 3 0.7823246 12 1 3 0.7658171 3 1 3 0.7587961 14 1 3 0.7569107 4 1 3 0.7532051 2 1 3 0.7456150 16 1 3 0.7436018 13 1 3 0.7398841 18 1 3 0.7080079 15 1 3 0.7006854 19 1 3 0.7000938 1 1 3 0.6798381 5 1 3 0.6646571 20 1 3 0.6619626 7 1 2 0.6437853 17 1 3 0.6148541 39 2 1 0.6283295 38 2 1 0.6262721 40 2 1 0.6255492 43 2 1 0.6243319 36 2 1 0.6221530 35 2 1 0.6178548 37 2 1 0.6121605 42 2 1 0.6088119 44 2 1 0.6066538 32 2 1 0.6052260 34 2 1 0.5958391 31 2 1 0.5954537 33 2 1 0.5899279 26 2 1 0.5890979 53 2 1 0.5846364 51 2 1 0.5785105 49 2 1 0.5734352 25 2 1 0.5691955 52 2 1 0.5584872 27 2 1 0.5574419 28 2 1 0.5478805 23 2 1 0.5457126 58 2 1 0.5443257 50 2 1 0.5431889 54 2 1 0.5338363 24 2 1 0.5282567 45 2 1 0.5249071 57 2 1 0.5237845 22 2 1 0.5150893 59 2 3 0.5015850 30 2 1 0.4973340 55 2 1 0.4949786 29 2 1 0.4899519 56 2 3 0.4856790 41 2 1 0.4816846 60 2 3 0.4766350 21 2 1 0.4658079 46 2 1 0.3138537 47 2 1 0.2329901 48 2 1 0.2275249 70 3 1 0.8548947 67 3 1 0.8527439 65 3 1 0.8503105 69 3 1 0.8391810 71 3 1 0.8381065 66 3 1 0.8229841 62 3 1 0.8153092 64 3 1 0.8061254 73 3 1 0.7950213 63 3 1 0.7795369 72 3 1 0.7748121 61 3 1 0.7701103 68 3 1 0.7620559 74 3 1 0.7596815 75 3 1 0.7425538 Average silhouette width per cluster: [1] 0.7298309 0.5361094 0.8042285 Average silhouette width of total data set: [1] 0.6413923 2775 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 1.414 40.106 75.591 71.538 99.169 154.500 Metric : euclidean Number of objects : 75 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > summary(fanny(ruspini, 4), digits = 9)# 'correct' #{clusters} Fuzzy Clustering object of class 'fanny' : m.ship.expon. 2 objective 422.8389 tolerance 1e-15 iterations 12 converged 1 maxit 500 n 75 Membership coefficients (in %, rounded): [,1] [,2] [,3] [,4] 1 66 10 9 15 2 71 9 8 11 3 76 7 6 10 4 69 11 9 11 5 68 9 8 15 6 80 7 6 8 7 57 18 13 13 8 76 9 7 9 9 85 5 4 7 10 86 4 4 6 11 78 7 6 8 12 78 7 7 9 13 72 10 9 10 14 82 5 5 8 15 76 6 6 11 16 81 5 5 9 17 68 8 8 16 18 77 6 6 11 19 75 7 7 11 20 65 11 11 14 21 10 74 10 6 22 7 80 8 4 23 6 82 8 4 24 8 79 9 5 25 5 87 6 3 26 4 89 5 2 27 4 87 5 3 28 5 85 6 3 29 8 78 9 5 30 8 79 9 5 31 6 81 9 4 32 3 89 5 2 33 4 87 6 3 34 5 84 7 3 35 4 87 6 3 36 5 83 8 4 37 6 79 10 4 38 7 76 12 5 39 7 78 11 4 40 8 71 15 6 41 16 49 25 10 42 12 57 23 8 43 12 55 25 8 44 10 23 59 8 45 10 16 65 8 46 17 18 51 15 47 20 20 44 17 48 21 21 42 16 49 4 7 85 4 50 4 6 87 4 51 5 8 83 4 52 3 5 88 3 53 6 11 78 5 54 4 5 88 3 55 6 7 82 5 56 6 8 80 6 57 4 6 85 4 58 7 11 76 6 59 7 10 77 7 60 8 11 74 8 61 12 6 8 74 62 9 5 6 79 63 11 6 9 74 64 8 4 5 83 65 6 3 3 88 66 9 4 6 81 67 5 2 3 91 68 12 5 6 77 69 5 2 3 89 70 4 2 3 91 71 5 2 3 89 72 10 4 5 81 73 10 5 7 79 74 11 5 7 76 75 12 5 6 77 Fuzzyness coefficients: dunn_coeff normalized 0.6237448 0.4983264 Closest hard clustering: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Silhouette plot information: cluster neighbor sil_width 10 1 4 0.8056096 6 1 4 0.7954977 9 1 4 0.7923048 11 1 4 0.7831672 8 1 2 0.7811793 12 1 4 0.7658171 3 1 4 0.7587961 14 1 4 0.7569107 2 1 4 0.7456150 16 1 4 0.7436018 13 1 4 0.7398841 4 1 2 0.7361533 18 1 4 0.7080079 15 1 4 0.7006854 19 1 4 0.7000938 1 1 4 0.6798381 5 1 4 0.6646571 20 1 4 0.6619626 17 1 4 0.6148541 7 1 2 0.5900575 26 2 3 0.8357433 32 2 3 0.8332753 27 2 3 0.8290271 25 2 3 0.8285547 28 2 3 0.8192636 35 2 3 0.8186309 33 2 3 0.8175087 23 2 3 0.8089969 22 2 3 0.8025389 34 2 3 0.8013310 31 2 3 0.7949677 36 2 3 0.7943536 24 2 3 0.7930770 29 2 3 0.7897346 30 2 3 0.7892027 21 2 3 0.7698024 37 2 3 0.7684502 39 2 3 0.7631648 38 2 3 0.7438848 40 2 3 0.7083130 42 2 3 0.5291270 43 2 3 0.4931623 41 2 3 0.4290814 54 3 2 0.7741745 57 3 2 0.7703455 55 3 2 0.7641810 50 3 2 0.7619943 52 3 2 0.7616220 56 3 2 0.7575313 59 3 2 0.7327828 49 3 2 0.7317002 51 3 2 0.7209864 60 3 2 0.7206840 58 3 2 0.7019611 53 3 2 0.6775322 45 3 2 0.5974787 46 3 2 0.5740823 47 3 2 0.4835635 48 3 2 0.4247331 44 3 2 0.4196093 70 4 1 0.8548947 67 4 1 0.8527439 65 4 1 0.8503105 69 4 1 0.8391810 71 4 1 0.8381065 66 4 1 0.8229841 62 4 1 0.8153092 64 4 1 0.8061254 73 4 1 0.7950213 63 4 1 0.7795369 72 4 1 0.7748121 61 4 1 0.7701103 68 4 1 0.7620559 74 4 1 0.7596815 75 4 1 0.7425538 Average silhouette width per cluster: [1] 0.7262347 0.7548344 0.6691154 0.8042285 Average silhouette width of total data set: [1] 0.737657 2775 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 1.414 40.106 75.591 71.538 99.169 154.500 Metric : euclidean Number of objects : 75 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > summary(fanny(ruspini, 5), digits = 9) Fuzzy Clustering object of class 'fanny' : m.ship.expon. 2 objective 344.054 tolerance 1e-15 iterations 30 converged 1 maxit 500 n 75 Membership coefficients (in %, rounded): [,1] [,2] [,3] [,4] [,5] 1 60 10 10 8 13 2 65 9 9 7 10 3 71 7 7 6 9 4 60 11 11 8 10 5 63 8 8 7 14 6 74 7 7 5 7 7 47 16 16 10 11 8 68 8 9 6 8 9 81 4 4 4 6 10 83 4 4 4 5 11 72 7 7 6 8 12 72 7 7 6 8 13 64 9 10 8 9 14 79 5 5 4 7 15 73 6 6 5 10 16 78 5 5 5 8 17 64 7 8 7 14 18 73 6 6 6 10 19 71 6 7 6 10 20 58 10 11 9 12 21 5 60 26 6 3 22 4 67 23 4 2 23 4 65 25 4 2 24 4 62 26 5 3 25 3 68 25 3 2 26 3 61 31 3 2 27 3 69 24 3 2 28 3 64 27 4 2 29 4 63 25 5 3 30 4 61 27 5 3 31 4 47 41 6 3 32 3 48 44 4 2 33 3 43 48 4 2 34 3 35 56 4 2 35 3 36 56 4 2 36 3 34 56 5 2 37 3 26 64 5 2 38 3 24 65 5 2 39 4 30 58 6 2 40 5 31 53 8 3 41 10 28 41 15 6 42 6 26 51 12 4 43 6 25 50 13 4 44 8 17 24 44 7 45 9 14 18 52 7 46 14 15 18 41 12 47 16 16 20 34 14 48 17 17 21 32 13 49 4 6 8 78 4 50 4 5 7 82 3 51 4 7 9 76 4 52 3 5 6 84 3 53 6 9 12 69 5 54 3 4 6 84 3 55 5 6 7 77 5 56 5 7 8 75 5 57 4 5 6 82 3 58 6 9 11 69 5 59 6 8 10 71 6 60 7 9 11 67 7 61 12 6 6 7 69 62 9 5 5 6 75 63 11 6 6 8 69 64 8 4 4 4 80 65 5 3 3 3 86 66 8 4 5 6 77 67 4 2 2 2 89 68 11 5 5 6 73 69 5 2 2 3 88 70 4 2 2 3 89 71 5 2 2 3 87 72 9 4 4 5 78 73 9 5 5 6 75 74 11 5 6 7 71 75 11 5 5 6 73 Fuzzyness coefficients: dunn_coeff normalized 0.5114030 0.3892538 Closest hard clustering: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 Silhouette plot information: cluster neighbor sil_width 10 1 5 0.80560959 6 1 5 0.79549768 9 1 5 0.79230476 11 1 5 0.78316718 8 1 2 0.77898970 12 1 5 0.76581709 3 1 5 0.75879612 14 1 5 0.75691067 2 1 5 0.74561500 16 1 5 0.74360183 13 1 5 0.73988410 4 1 2 0.73129406 18 1 5 0.70800786 15 1 5 0.70068540 19 1 5 0.70009384 1 1 5 0.67983808 5 1 5 0.66465711 20 1 5 0.66196261 17 1 5 0.61485412 7 1 2 0.57933844 22 2 3 0.64692795 23 2 3 0.61550541 24 2 3 0.60008003 25 2 3 0.58870755 21 2 3 0.58680476 29 2 3 0.57562680 27 2 3 0.53630654 30 2 3 0.50899690 28 2 3 0.47603437 26 2 3 0.45468170 31 2 3 0.22164438 32 2 3 0.17652220 43 3 2 0.45636660 42 3 2 0.45534454 38 3 2 0.45388647 37 3 2 0.37929513 39 3 2 0.28792444 40 3 2 0.27156486 41 3 2 0.26700037 34 3 2 0.13274819 36 3 2 0.13049634 35 3 2 0.03864907 33 3 2 -0.10466026 54 4 3 0.74140256 57 4 3 0.73972663 55 4 3 0.73410322 56 4 3 0.72732850 50 4 3 0.72559236 52 4 3 0.72450938 59 4 3 0.70004311 60 4 3 0.68771996 49 4 3 0.68729634 51 4 3 0.67478586 58 4 3 0.66155189 53 4 3 0.62364614 45 4 3 0.52499298 46 4 3 0.52187006 47 4 3 0.42305501 48 4 3 0.35520120 44 4 3 0.28882028 70 5 1 0.85489470 67 5 1 0.85274392 65 5 1 0.85031051 69 5 1 0.83918099 71 5 1 0.83810647 66 5 1 0.82298407 62 5 1 0.81530920 64 5 1 0.80612543 73 5 1 0.79502130 63 5 1 0.77953687 72 5 1 0.77481212 61 5 1 0.77011029 68 5 1 0.76205594 74 5 1 0.75968147 75 5 1 0.74255385 Average silhouette width per cluster: [1] 0.7253463 0.4989865 0.2516923 0.6200968 0.8042285 Average silhouette width of total data set: [1] 0.6115794 2775 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 1.414 40.106 75.591 71.538 99.169 154.500 Metric : euclidean Number of objects : 75 Available components: [1] "membership" "coeff" "memb.exp" "clustering" "k.crisp" [6] "objective" "convergence" "diss" "call" "silinfo" [11] "data" > > cat('Time elapsed: ', proc.time() - .proctime00,'\n') Time elapsed: 0.042 0.008 0.052 0 0 > data(chorSub) > p4cl <- pam(chorSub, k = 4, cluster.only = TRUE) > ## The first two are "completely fuzzy" -- and now give a warnings > ## IGNORE_RDIFF_BEGIN > f4.20 <- fanny(chorSub, k = 4, trace.lev = 1) fanny()'s fuzzy(n = 61, k = 4): fuzzy(): initial obj = 8277.57 Converged after 44 iterations, obj = 2665.982 fanny()'s caddy(*, k = 4): -> k_true (crisp) = 2 < k (= 4) !! Warning message: In fanny(chorSub, k = 4, trace.lev = 1) : the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ? > f4.20$coef dunn_coeff normalized 2.500000e-01 3.330669e-15 > ## IGNORE_RDIFF_END > stopifnot(exprs = { + all.equal(f4.20$coef, c(dunn_coeff = 0.25, normalized = 3.330669e-15)) + all.equal(f4.20$objective[["objective"]], 2665.982, tol = 8e-7) + all.equal(f4.20$silinfo$avg.width, 0.250643, tol = 2e-6) + }) > > f4.18 <- fanny(chorSub, k = 4, memb.exp = 1.8) # same problem Warning message: In fanny(chorSub, k = 4, memb.exp = 1.8) : the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ? > f4.18. <- fanny(chorSub, k = 4, memb.exp = 1.8, + iniMem.p = f4.20$membership) # very quick convergence Warning message: In fanny(chorSub, k = 4, memb.exp = 1.8, iniMem.p = f4.20$membership) : the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ? > stopifnot(all.equal(f4.18[not.conv], f4.18.[not.conv], tol = 5e-7)) > > f4.16 <- fanny(chorSub, k = 4, memb.exp = 1.6) # now gives 4 crisp clusters > ## IGNORE_RDIFF_BEGIN > f4.16. <- fanny(chorSub, k = 4, memb.exp = 1.6, + iniMem.p = f4.18$membership, trace.lev = 2)# wrongly "converged" immediately; no longer! fanny()'s fuzzy(n = 61, k = 4): fuzzy(): initial obj = 4641.75 ef[]= ( 15405.8, 15405.8, 15405.8, 15405.8) esp[]= ( 6.63795, 6.63795, 6.63795, 6.63795) m == n: obj = 4641.7451124068 not converged: it = 1 m == n: obj = 4641.7451124068 not converged: it = 2 m == n: obj = 4641.7451124067 not converged: it = 3 m == n: obj = 4641.7451124067 not converged: it = 4 m == n: obj = 4641.7451124066 not converged: it = 5 m == n: obj = 4641.7451124065 not converged: it = 6 m == n: obj = 4641.7451124064 not converged: it = 7 m == n: obj = 4641.7451124062 not converged: it = 8 m == n: obj = 4641.7451124059 not converged: it = 9 m == n: obj = 4641.7451124055 not converged: it = 10 m == n: obj = 4641.7451124048 not converged: it = 11 m == n: obj = 4641.7451124038 not converged: it = 12 m == n: obj = 4641.7451124024 not converged: it = 13 m == n: obj = 4641.7451124002 not converged: it = 14 m == n: obj = 4641.7451123969 not converged: it = 15 m == n: obj = 4641.7451123920 not converged: it = 16 m == n: obj = 4641.7451123848 not converged: it = 17 m == n: obj = 4641.7451123740 not converged: it = 18 m == n: obj = 4641.7451123580 not converged: it = 19 m == n: obj = 4641.7451123342 not converged: it = 20 m == n: obj = 4641.7451122987 not converged: it = 21 m == n: obj = 4641.7451122458 not converged: it = 22 m == n: obj = 4641.7451121672 not converged: it = 23 m == n: obj = 4641.7451120502 not converged: it = 24 m == n: obj = 4641.7451118760 not converged: it = 25 m == n: obj = 4641.7451116168 not converged: it = 26 m == n: obj = 4641.7451112310 not converged: it = 27 m == n: obj = 4641.7451106568 not converged: it = 28 m == n: obj = 4641.7451098021 not converged: it = 29 m == n: obj = 4641.7451085301 not converged: it = 30 m == n: obj = 4641.7451066368 not converged: it = 31 m == n: obj = 4641.7451038188 not converged: it = 32 m == n: obj = 4641.7450996246 not converged: it = 33 m == n: obj = 4641.7450933819 not converged: it = 34 m == n: obj = 4641.7450840901 not converged: it = 35 m == n: obj = 4641.7450702597 not converged: it = 36 m == n: obj = 4641.7450496738 not converged: it = 37 m == n: obj = 4641.7450190318 not converged: it = 38 m == n: obj = 4641.7449734207 not converged: it = 39 m == n: obj = 4641.7449055260 not converged: it = 40 m == n: obj = 4641.7448044581 not converged: it = 41 m == n: obj = 4641.7446540036 not converged: it = 42 m == n: obj = 4641.7444300216 not converged: it = 43 m == n: obj = 4641.7440965647 not converged: it = 44 m == n: obj = 4641.7436001025 not converged: it = 45 m == n: obj = 4641.7428609171 not converged: it = 46 m == n: obj = 4641.7417602891 not converged: it = 47 m == n: obj = 4641.7401214217 not converged: it = 48 m == n: obj = 4641.7376810561 not converged: it = 49 m == n: obj = 4641.7340472856 not converged: it = 50 m == n: obj = 4641.7286369629 not converged: it = 51 m == n: obj = 4641.7205831038 not converged: it = 52 m == n: obj = 4641.7085985379 not converged: it = 53 m == n: obj = 4641.6907766285 not converged: it = 54 m == n: obj = 4641.6643034513 not converged: it = 55 m == n: obj = 4641.6250499545 not converged: it = 56 m == n: obj = 4641.5670118398 not converged: it = 57 m == n: obj = 4641.4815802745 not converged: it = 58 m == n: obj = 4641.3566816476 not converged: it = 59 m == n: obj = 4641.1759631584 not converged: it = 60 m == n: obj = 4640.9184870127 not converged: it = 61 m == n: obj = 4640.5598748380 not converged: it = 62 m == n: obj = 4640.0763951643 not converged: it = 63 m == n: obj = 4639.4535091538 not converged: it = 64 m == n: obj = 4638.6985627477 not converged: it = 65 m == n: obj = 4637.8525223026 not converged: it = 66 m == n: obj = 4636.9902717889 not converged: it = 67 m == n: obj = 4636.2011348287 not converged: it = 68 m == n: obj = 4635.5562138862 not converged: it = 69 m == n: obj = 4635.0841061959 not converged: it = 70 m == n: obj = 4634.7709393872 not converged: it = 71 m == n: obj = 4634.5791836454 not converged: it = 72 m == n: obj = 4634.4681223189 not converged: it = 73 m == n: obj = 4634.4053264338 not converged: it = 74 m == n: obj = 4634.3691581286 not converged: it = 75 m == n: obj = 4634.3467429052 not converged: it = 76 m == n: obj = 4634.3309831621 not converged: it = 77 m == n: obj = 4634.3181561250 not converged: it = 78 m == n: obj = 4634.3063657101 not converged: it = 79 m == n: obj = 4634.2946565359 not converged: it = 80 m == n: obj = 4634.2825420462 not converged: it = 81 m == n: obj = 4634.2697644380 not converged: it = 82 m == n: obj = 4634.2561761591 not converged: it = 83 m == n: obj = 4634.2416826439 not converged: it = 84 m == n: obj = 4634.2262151364 not converged: it = 85 m == n: obj = 4634.2097180825 not converged: it = 86 m == n: obj = 4634.1921435378 not converged: it = 87 m == n: obj = 4634.1734489659 not converged: it = 88 m == n: obj = 4634.1535967048 not converged: it = 89 m == n: obj = 4634.1325542860 not converged: it = 90 m == n: obj = 4634.1102952171 not converged: it = 91 m == n: obj = 4634.0868000400 not converged: it = 92 m == n: obj = 4634.0620575623 not converged: it = 93 m == n: obj = 4634.0360661965 not converged: it = 94 m == n: obj = 4634.0088353517 not converged: it = 95 m == n: obj = 4633.9803868188 not converged: it = 96 m == n: obj = 4633.9507560809 not converged: it = 97 m == n: obj = 4633.9199934721 not converged: it = 98 m == n: obj = 4633.8881650953 not converged: it = 99 m == n: obj = 4633.8553534087 not converged: it = 100 m == n: obj = 4633.8216573862 not converged: it = 101 m == n: obj = 4633.7871921716 not converged: it = 102 m == n: obj = 4633.7520881605 not converged: it = 103 m == n: obj = 4633.7164894758 not converged: it = 104 m == n: obj = 4633.6805518354 not converged: it = 105 m == n: obj = 4633.6444398582 not converged: it = 106 m == n: obj = 4633.6083238934 not converged: it = 107 m == n: obj = 4633.5723765040 not converged: it = 108 m == n: obj = 4633.5367687642 not converged: it = 109 m == n: obj = 4633.5016665539 not converged: it = 110 m == n: obj = 4633.4672270359 not converged: it = 111 m == n: obj = 4633.4335954897 not converged: it = 112 m == n: obj = 4633.4009026493 not converged: it = 113 m == n: obj = 4633.3692626504 not converged: it = 114 m == n: obj = 4633.3387716507 not converged: it = 115 m == n: obj = 4633.3095071322 not converged: it = 116 m == n: obj = 4633.2815278568 not converged: it = 117 m == n: obj = 4633.2548744046 not converged: it = 118 m == n: obj = 4633.2295702011 not converged: it = 119 m == n: obj = 4633.2056229217 not converged: it = 120 m == n: obj = 4633.1830261616 not converged: it = 121 m == n: obj = 4633.1617612597 not converged: it = 122 m == n: obj = 4633.1417991795 not converged: it = 123 m == n: obj = 4633.1231023655 not converged: it = 124 m == n: obj = 4633.1056265122 not converged: it = 125 m == n: obj = 4633.0893221975 not converged: it = 126 m == n: obj = 4633.0741363541 not converged: it = 127 m == n: obj = 4633.0600135613 not converged: it = 128 m == n: obj = 4633.0468971544 not converged: it = 129 m == n: obj = 4633.0347301568 not converged: it = 130 m == n: obj = 4633.0234560452 not converged: it = 131 m == n: obj = 4633.0130193623 not converged: it = 132 m == n: obj = 4633.0033661946 not converged: it = 133 m == n: obj = 4632.9944445330 not converged: it = 134 m == n: obj = 4632.9862045316 not converged: it = 135 m == n: obj = 4632.9785986833 not converged: it = 136 m == n: obj = 4632.9715819245 not converged: it = 137 m == n: obj = 4632.9651116845 not converged: it = 138 m == n: obj = 4632.9591478893 not converged: it = 139 m == n: obj = 4632.9536529294 not converged: it = 140 m == n: obj = 4632.9485916022 not converged: it = 141 m == n: obj = 4632.9439310334 not converged: it = 142 m == n: obj = 4632.9396405840 not converged: it = 143 m == n: obj = 4632.9356917488 not converged: it = 144 m == n: obj = 4632.9320580478 not converged: it = 145 m == n: obj = 4632.9287149149 not converged: it = 146 m == n: obj = 4632.9256395866 not converged: it = 147 m == n: obj = 4632.9228109913 not converged: it = 148 m == n: obj = 4632.9202096409 not converged: it = 149 m == n: obj = 4632.9178175259 not converged: it = 150 m == n: obj = 4632.9156180154 not converged: it = 151 m == n: obj = 4632.9135957603 not converged: it = 152 m == n: obj = 4632.9117366027 not converged: it = 153 m == n: obj = 4632.9100274892 not converged: it = 154 m == n: obj = 4632.9084563902 not converged: it = 155 m == n: obj = 4632.9070122233 not converged: it = 156 m == n: obj = 4632.9056847824 not converged: it = 157 m == n: obj = 4632.9044646710 not converged: it = 158 m == n: obj = 4632.9033432401 not converged: it = 159 m == n: obj = 4632.9023125305 not converged: it = 160 m == n: obj = 4632.9013652195 not converged: it = 161 m == n: obj = 4632.9004945707 not converged: it = 162 m == n: obj = 4632.8996943886 not converged: it = 163 m == n: obj = 4632.8989589752 not converged: it = 164 m == n: obj = 4632.8982830915 not converged: it = 165 m == n: obj = 4632.8976619203 not converged: it = 166 m == n: obj = 4632.8970910330 not converged: it = 167 m == n: obj = 4632.8965663585 not converged: it = 168 m == n: obj = 4632.8960841547 not converged: it = 169 m == n: obj = 4632.8956409819 not converged: it = 170 m == n: obj = 4632.8952336787 not converged: it = 171 m == n: obj = 4632.8948593394 not converged: it = 172 m == n: obj = 4632.8945152937 not converged: it = 173 m == n: obj = 4632.8941990874 not converged: it = 174 m == n: obj = 4632.8939084654 not converged: it = 175 m == n: obj = 4632.8936413550 not converged: it = 176 m == n: obj = 4632.8933958517 not converged: it = 177 m == n: obj = 4632.8931702052 not converged: it = 178 m == n: obj = 4632.8929628073 not converged: it = 179 m == n: obj = 4632.8927721801 not converged: it = 180 m == n: obj = 4632.8925969653 not converged: it = 181 m == n: obj = 4632.8924359151 not converged: it = 182 m == n: obj = 4632.8922878825 not converged: it = 183 m == n: obj = 4632.8921518138 not converged: it = 184 m == n: obj = 4632.8920267405 not converged: it = 185 m == n: obj = 4632.8919117727 not converged: it = 186 m == n: obj = 4632.8918060926 not converged: it = 187 m == n: obj = 4632.8917089487 not converged: it = 188 m == n: obj = 4632.8916196505 not converged: it = 189 m == n: obj = 4632.8915375633 not converged: it = 190 m == n: obj = 4632.8914621038 not converged: it = 191 m == n: obj = 4632.8913927362 not converged: it = 192 m == n: obj = 4632.8913289678 not converged: it = 193 m == n: obj = 4632.8912703460 not converged: it = 194 m == n: obj = 4632.8912164548 not converged: it = 195 m == n: obj = 4632.8911669118 not converged: it = 196 m == n: obj = 4632.8911213658 not converged: it = 197 m == n: obj = 4632.8910794937 not converged: it = 198 m == n: obj = 4632.8910409987 not converged: it = 199 m == n: obj = 4632.8910056082 not converged: it = 200 m == n: obj = 4632.8909730713 not converged: it = 201 m == n: obj = 4632.8909431577 not converged: it = 202 m == n: obj = 4632.8909156555 not converged: it = 203 m == n: obj = 4632.8908903701 not converged: it = 204 m == n: obj = 4632.8908671226 not converged: it = 205 m == n: obj = 4632.8908457484 not converged: it = 206 m == n: obj = 4632.8908260965 not converged: it = 207 m == n: obj = 4632.8908080279 not converged: it = 208 m == n: obj = 4632.8907914148 not converged: it = 209 m == n: obj = 4632.8907761399 not converged: it = 210 m == n: obj = 4632.8907620952 not converged: it = 211 m == n: obj = 4632.8907491815 not converged: it = 212 m == n: obj = 4632.8907373077 not converged: it = 213 m == n: obj = 4632.8907263899 not converged: it = 214 m == n: obj = 4632.8907163510 not converged: it = 215 m == n: obj = 4632.8907071202 not converged: it = 216 m == n: obj = 4632.8906986324 not converged: it = 217 m == n: obj = 4632.8906908277 not converged: it = 218 m == n: obj = 4632.8906836511 not converged: it = 219 m == n: obj = 4632.8906770519 not converged: it = 220 m == n: obj = 4632.8906709837 not converged: it = 221 m == n: obj = 4632.8906654037 not converged: it = 222 m == n: obj = 4632.8906602726 not converged: it = 223 m == n: obj = 4632.8906555542 not converged: it = 224 m == n: obj = 4632.8906512153 not converged: it = 225 m == n: obj = 4632.8906472254 not converged: it = 226 m == n: obj = 4632.8906435563 not converged: it = 227 m == n: obj = 4632.8906401822 not converged: it = 228 m == n: obj = 4632.8906370794 not converged: it = 229 m == n: obj = 4632.8906342261 not converged: it = 230 m == n: obj = 4632.8906316021 not converged: it = 231 m == n: obj = 4632.8906291891 not converged: it = 232 m == n: obj = 4632.8906269700 not converged: it = 233 m == n: obj = 4632.8906249293 not converged: it = 234 m == n: obj = 4632.8906230526 not converged: it = 235 m == n: obj = 4632.8906213267 not converged: it = 236 m == n: obj = 4632.8906197395 not converged: it = 237 m == n: obj = 4632.8906182798 not converged: it = 238 m == n: obj = 4632.8906169374 not converged: it = 239 m == n: obj = 4632.8906157028 not converged: it = 240 m == n: obj = 4632.8906145675 not converged: it = 241 m == n: obj = 4632.8906135233 not converged: it = 242 m == n: obj = 4632.8906125630 not converged: it = 243 m == n: obj = 4632.8906116798 not converged: it = 244 m == n: obj = 4632.8906108675 not converged: it = 245 m == n: obj = 4632.8906101205 not converged: it = 246 m == n: obj = 4632.8906094335 not converged: it = 247 m == n: obj = 4632.8906088016 not converged: it = 248 m == n: obj = 4632.8906082205 not converged: it = 249 m == n: obj = 4632.8906076860 not converged: it = 250 m == n: obj = 4632.8906071945 not converged: it = 251 m == n: obj = 4632.8906067424 not converged: it = 252 m == n: obj = 4632.8906063266 not converged: it = 253 m == n: obj = 4632.8906059441 not converged: it = 254 m == n: obj = 4632.8906055924 not converged: it = 255 m == n: obj = 4632.8906052689 not converged: it = 256 m == n: obj = 4632.8906049714 not converged: it = 257 m == n: obj = 4632.8906046977 not converged: it = 258 m == n: obj = 4632.8906044460 not converged: it = 259 m == n: obj = 4632.8906042145 not converged: it = 260 m == n: obj = 4632.8906040016 not converged: it = 261 m == n: obj = 4632.8906038058 not converged: it = 262 m == n: obj = 4632.8906036257 not converged: it = 263 m == n: obj = 4632.8906034600 not converged: it = 264 m == n: obj = 4632.8906033076 not converged: it = 265 m == n: obj = 4632.8906031675 not converged: it = 266 m == n: obj = 4632.8906030386 not converged: it = 267 m == n: obj = 4632.8906029200 not converged: it = 268 m == n: obj = 4632.8906028110 not converged: it = 269 m == n: obj = 4632.8906027106 not converged: it = 270 m == n: obj = 4632.8906026184 not converged: it = 271 m == n: obj = 4632.8906025335 not converged: it = 272 m == n: obj = 4632.8906024555 not converged: it = 273 m == n: obj = 4632.8906023837 not converged: it = 274 m == n: obj = 4632.8906023176 not converged: it = 275 m == n: obj = 4632.8906022569 not converged: it = 276 m == n: obj = 4632.8906022010 not converged: it = 277 m == n: obj = 4632.8906021496 not converged: it = 278 m == n: obj = 4632.8906021024 not converged: it = 279 m == n: obj = 4632.8906020589 not converged: it = 280 m == n: obj = 4632.8906020189 not converged: it = 281 m == n: obj = 4632.8906019821 not converged: it = 282 m == n: obj = 4632.8906019483 not converged: it = 283 m == n: obj = 4632.8906019171 not converged: it = 284 m == n: obj = 4632.8906018885 not converged: it = 285 m == n: obj = 4632.8906018622 not converged: it = 286 m == n: obj = 4632.8906018379 not converged: it = 287 m == n: obj = 4632.8906018157 not converged: it = 288 m == n: obj = 4632.8906017952 not converged: it = 289 m == n: obj = 4632.8906017763 not converged: it = 290 m == n: obj = 4632.8906017590 not converged: it = 291 m == n: obj = 4632.8906017430 not converged: it = 292 m == n: obj = 4632.8906017284 not converged: it = 293 m == n: obj = 4632.8906017149 not converged: it = 294 m == n: obj = 4632.8906017025 not converged: it = 295 m == n: obj = 4632.8906016911 not converged: it = 296 m == n: obj = 4632.8906016806 not converged: it = 297 m == n: obj = 4632.8906016709 not converged: it = 298 m == n: obj = 4632.8906016620 not converged: it = 299 m == n: obj = 4632.8906016539 not converged: it = 300 m == n: obj = 4632.8906016463 not converged: it = 301 m == n: obj = 4632.8906016394 not converged: it = 302 m == n: obj = 4632.8906016331 not converged: it = 303 m == n: obj = 4632.8906016272 not converged: it = 304 m == n: obj = 4632.8906016218 not converged: it = 305 m == n: obj = 4632.8906016169 not converged: it = 306 m == n: obj = 4632.8906016123 not converged: it = 307 m == n: obj = 4632.8906016081 not converged: it = 308 m == n: obj = 4632.8906016043 not converged: it = 309 m == n: obj = 4632.8906016007 not converged: it = 310 m == n: obj = 4632.8906015975 not converged: it = 311 m == n: obj = 4632.8906015945 not converged: it = 312 m == n: obj = 4632.8906015917 not converged: it = 313 m == n: obj = 4632.8906015892 not converged: it = 314 m == n: obj = 4632.8906015868 not converged: it = 315 m == n: obj = 4632.8906015847 not converged: it = 316 m == n: obj = 4632.8906015827 not converged: it = 317 m == n: obj = 4632.8906015809 not converged: it = 318 m == n: obj = 4632.8906015792 not converged: it = 319 m == n: obj = 4632.8906015777 not converged: it = 320 m == n: obj = 4632.8906015762 not converged: it = 321 m == n: obj = 4632.8906015749 not converged: it = 322 m == n: obj = 4632.8906015737 not converged: it = 323 m == n: obj = 4632.8906015726 not converged: it = 324 m == n: obj = 4632.8906015716 not converged: it = 325 m == n: obj = 4632.8906015707 not converged: it = 326 m == n: obj = 4632.8906015698 not converged: it = 327 m == n: obj = 4632.8906015691 not converged: it = 328 m == n: obj = 4632.8906015683 not converged: it = 329 m == n: obj = 4632.8906015677 not converged: it = 330 m == n: obj = 4632.8906015671 not converged: it = 331 m == n: obj = 4632.8906015665 not converged: it = 332 m == n: obj = 4632.8906015660 not converged: it = 333 m == n: obj = 4632.8906015655 not converged: it = 334 m == n: obj = 4632.8906015650 not converged: it = 335 m == n: obj = 4632.8906015646 not converged: it = 336 m == n: obj = 4632.8906015643 not converged: it = 337 m == n: obj = 4632.8906015639 not converged: it = 338 m == n: obj = 4632.8906015636 not converged: it = 339 m == n: obj = 4632.8906015633 not converged: it = 340 m == n: obj = 4632.8906015630 not converged: it = 341 m == n: obj = 4632.8906015628 not converged: it = 342 m == n: obj = 4632.8906015626 not converged: it = 343 m == n: obj = 4632.8906015624 not converged: it = 344 m == n: obj = 4632.8906015622 not converged: it = 345 m == n: obj = 4632.8906015620 not converged: it = 346 m == n: obj = 4632.8906015618 not converged: it = 347 m == n: obj = 4632.8906015617 not converged: it = 348 m == n: obj = 4632.8906015615 not converged: it = 349 m == n: obj = 4632.8906015614 not converged: it = 350 m == n: obj = 4632.8906015613 not converged: it = 351 m == n: obj = 4632.8906015612 not converged: it = 352 m == n: obj = 4632.8906015611 not converged: it = 353 m == n: obj = 4632.8906015610 not converged: it = 354 m == n: obj = 4632.8906015609 not converged: it = 355 m == n: obj = 4632.8906015608 not converged: it = 356 m == n: obj = 4632.8906015608 not converged: it = 357 m == n: obj = 4632.8906015607 not converged: it = 358 m == n: obj = 4632.8906015606 not converged: it = 359 m == n: obj = 4632.8906015606 not converged: it = 360 m == n: obj = 4632.8906015605 not converged: it = 361 m == n: obj = 4632.8906015605 not converged: it = 362 m == n: obj = 4632.8906015604 not converged: it = 363 m == n: obj = 4632.8906015604 not converged: it = 364 m == n: obj = 4632.8906015603 not converged: it = 365 m == n: obj = 4632.8906015603 not converged: it = 366 m == n: obj = 4632.8906015603 not converged: it = 367 m == n: obj = 4632.8906015602 not converged: it = 368 m == n: obj = 4632.8906015602 not converged: it = 369 m == n: obj = 4632.8906015602 not converged: it = 370 m == n: obj = 4632.8906015602 not converged: it = 371 m == n: obj = 4632.8906015602 not converged: it = 372 m == n: obj = 4632.8906015601 not converged: it = 373 m == n: obj = 4632.8906015601 not converged: it = 374 m == n: obj = 4632.8906015601 not converged: it = 375 m == n: obj = 4632.8906015601 not converged: it = 376 m == n: obj = 4632.8906015601 not converged: it = 377 m == n: obj = 4632.8906015601 not converged: it = 378 m == n: obj = 4632.8906015600 not converged: it = 379 m == n: obj = 4632.8906015600 not converged: it = 380 m == n: obj = 4632.8906015600 not converged: it = 381 m == n: obj = 4632.8906015600 not converged: it = 382 m == n: obj = 4632.8906015600 not converged: it = 383 m == n: obj = 4632.8906015600 not converged: it = 384 m == n: obj = 4632.8906015600 Converged after 385 iterations, obj = 4632.8906015599995953 fanny()'s caddy(*, k = 4): -> k_true (crisp) = 4 > f4.16.2<- fanny(chorSub, k = 4, memb.exp = 1.6, + iniMem.p = cluster:::as.membership(p4cl), tol = 1e-10, trace.lev = 2) fanny()'s fuzzy(n = 61, k = 4): fuzzy(): initial obj = 7365.64 ef[]= ( 46750.7, 97854, 64737.8, 24170.1) esp[]= ( 17, 17, 17, 10) m == n: obj = 4744.9792255200 not converged: it = 1 m == n: obj = 4679.5979841397 not converged: it = 2 m == n: obj = 4661.1063474652 not converged: it = 3 m == n: obj = 4651.1976132009 not converged: it = 4 m == n: obj = 4645.1558185569 not converged: it = 5 m == n: obj = 4641.3016999595 not converged: it = 6 m == n: obj = 4638.7561402053 not converged: it = 7 m == n: obj = 4637.0268537669 not converged: it = 8 m == n: obj = 4635.8286004555 not converged: it = 9 m == n: obj = 4634.9880315172 not converged: it = 10 m == n: obj = 4634.3943437634 not converged: it = 11 m == n: obj = 4633.9736501112 not converged: it = 12 m == n: obj = 4633.6751509742 not converged: it = 13 m == n: obj = 4633.4632343974 not converged: it = 14 m == n: obj = 4633.3126714974 not converged: it = 15 m == n: obj = 4633.2055165701 not converged: it = 16 m == n: obj = 4633.1290071452 not converged: it = 17 m == n: obj = 4633.0740913561 not converged: it = 18 m == n: obj = 4633.0343739482 not converged: it = 19 m == n: obj = 4633.0053552141 not converged: it = 20 m == n: obj = 4632.9838809909 not converged: it = 21 m == n: obj = 4632.9677467724 not converged: it = 22 m == n: obj = 4632.9554145804 not converged: it = 23 m == n: obj = 4632.9458119538 not converged: it = 24 m == n: obj = 4632.9381902596 not converged: it = 25 m == n: obj = 4632.9320254723 not converged: it = 26 m == n: obj = 4632.9269490798 not converged: it = 27 m == n: obj = 4632.9227001877 not converged: it = 28 m == n: obj = 4632.9190924339 not converged: it = 29 m == n: obj = 4632.9159911876 not converged: it = 30 m == n: obj = 4632.9132978577 not converged: it = 31 m == n: obj = 4632.9109390974 not converged: it = 32 m == n: obj = 4632.9088593706 not converged: it = 33 m == n: obj = 4632.9070158249 not converged: it = 34 m == n: obj = 4632.9053747439 not converged: it = 35 m == n: obj = 4632.9039090813 not converged: it = 36 m == n: obj = 4632.9025967379 not converged: it = 37 m == n: obj = 4632.9014193477 not converged: it = 38 m == n: obj = 4632.9003614151 not converged: it = 39 m == n: obj = 4632.8994096946 not converged: it = 40 m == n: obj = 4632.8985527385 not converged: it = 41 m == n: obj = 4632.8977805631 not converged: it = 42 m == n: obj = 4632.8970843966 not converged: it = 43 m == n: obj = 4632.8964564866 not converged: it = 44 m == n: obj = 4632.8958899491 not converged: it = 45 m == n: obj = 4632.8953786491 not converged: it = 46 m == n: obj = 4632.8949171027 not converged: it = 47 m == n: obj = 4632.8945003975 not converged: it = 48 m == n: obj = 4632.8941241249 not converged: it = 49 m == n: obj = 4632.8937843232 not converged: it = 50 m == n: obj = 4632.8934774285 not converged: it = 51 m == n: obj = 4632.8932002321 not converged: it = 52 m == n: obj = 4632.8929498430 not converged: it = 53 m == n: obj = 4632.8927236556 not converged: it = 54 m == n: obj = 4632.8925193198 not converged: it = 55 m == n: obj = 4632.8923347162 not converged: it = 56 m == n: obj = 4632.8921679323 not converged: it = 57 m == n: obj = 4632.8920172421 not converged: it = 58 m == n: obj = 4632.8918810877 not converged: it = 59 m == n: obj = 4632.8917580629 not converged: it = 60 m == n: obj = 4632.8916468978 not converged: it = 61 m == n: obj = 4632.8915464462 not converged: it = 62 m == n: obj = 4632.8914556728 not converged: it = 63 m == n: obj = 4632.8913736426 not converged: it = 64 m == n: obj = 4632.8912995115 not converged: it = 65 m == n: obj = 4632.8912325169 not converged: it = 66 m == n: obj = 4632.8911719701 not converged: it = 67 m == n: obj = 4632.8911172490 not converged: it = 68 m == n: obj = 4632.8910677916 not converged: it = 69 m == n: obj = 4632.8910230905 not converged: it = 70 m == n: obj = 4632.8909826870 not converged: it = 71 m == n: obj = 4632.8909461670 not converged: it = 72 m == n: obj = 4632.8909131564 not converged: it = 73 m == n: obj = 4632.8908833169 not converged: it = 74 m == n: obj = 4632.8908563432 not converged: it = 75 m == n: obj = 4632.8908319595 not converged: it = 76 m == n: obj = 4632.8908099163 not converged: it = 77 m == n: obj = 4632.8907899884 not converged: it = 78 m == n: obj = 4632.8907719724 not converged: it = 79 m == n: obj = 4632.8907556842 not converged: it = 80 m == n: obj = 4632.8907409578 not converged: it = 81 m == n: obj = 4632.8907276430 not converged: it = 82 m == n: obj = 4632.8907156041 not converged: it = 83 m == n: obj = 4632.8907047185 not converged: it = 84 m == n: obj = 4632.8906948754 not converged: it = 85 m == n: obj = 4632.8906859747 not converged: it = 86 m == n: obj = 4632.8906779259 not converged: it = 87 m == n: obj = 4632.8906706472 not converged: it = 88 m == n: obj = 4632.8906640647 not converged: it = 89 m == n: obj = 4632.8906581117 not converged: it = 90 m == n: obj = 4632.8906527276 not converged: it = 91 m == n: obj = 4632.8906478581 not converged: it = 92 m == n: obj = 4632.8906434537 not converged: it = 93 m == n: obj = 4632.8906394699 not converged: it = 94 m == n: obj = 4632.8906358664 not converged: it = 95 m == n: obj = 4632.8906326068 not converged: it = 96 m == n: obj = 4632.8906296582 not converged: it = 97 m == n: obj = 4632.8906269907 not converged: it = 98 m == n: obj = 4632.8906245774 not converged: it = 99 m == n: obj = 4632.8906223942 not converged: it = 100 m == n: obj = 4632.8906204189 not converged: it = 101 m == n: obj = 4632.8906186316 not converged: it = 102 m == n: obj = 4632.8906170145 not converged: it = 103 m == n: obj = 4632.8906155512 not converged: it = 104 m == n: obj = 4632.8906142271 not converged: it = 105 m == n: obj = 4632.8906130289 not converged: it = 106 m == n: obj = 4632.8906119446 not converged: it = 107 m == n: obj = 4632.8906109632 not converged: it = 108 m == n: obj = 4632.8906100750 not converged: it = 109 m == n: obj = 4632.8906092711 not converged: it = 110 m == n: obj = 4632.8906085435 not converged: it = 111 m == n: obj = 4632.8906078849 not converged: it = 112 m == n: obj = 4632.8906072887 not converged: it = 113 m == n: obj = 4632.8906067490 not converged: it = 114 m == n: obj = 4632.8906062603 not converged: it = 115 m == n: obj = 4632.8906058180 Converged after 116 iterations, obj = 4632.8906058179836691 fanny()'s caddy(*, k = 4): -> k_true (crisp) = 4 > all.equal((m1 <- f4.16 $membership), + (m2 <- f4.16.2$membership)) [1] "Mean relative difference: 0.0002281145" > ## IGNORE_RDIFF_END > stopifnot(identical(dimnames(m1), dimnames(m2)), + 0 < m1,m1 < 1, 0 < m2,m2 < 1, + ## the memberships are quite close but have only converged to precision 0.000228 + all.equal(m1, m2, tol = 0.001)) > stopifnot(exprs = { + f4.16$clustering == f4.16.2$clustering + all.equal(f4.16[notMconv], f4.16.2[notMconv], tol = 1e-7) + }) > > f4.14 <- fanny(chorSub, k = 4, memb.exp = 1.4) > f4.12 <- fanny(chorSub, k = 4, memb.exp = 1.2) > > table(f4.12$clustering, f4.14$clustering)# close but different 1 2 3 4 1 14 0 8 0 2 1 14 0 2 3 0 0 12 5 4 0 0 0 5 > table(f4.16$clustering, f4.14$clustering)# ditto 1 2 3 4 1 2 0 1 5 2 1 14 0 7 3 3 0 4 0 4 9 0 15 0 > table(f4.12$clustering, f4.16$clustering)# hence differ even more 1 2 3 4 1 2 0 3 17 2 1 16 0 0 3 5 1 4 7 4 0 5 0 0 > > symnum(cbind(f4.16$membership, 1, f4.12$membership), + cutpoints= c(0., 0.2, 0.6, 0.8, 0.9, 0.95, 1 -1e-7, 1 +1e-7), + symbols = c(" ", ".", ",", "+", "*", "B","1")) 190 . . . . 1 , 191 . . 1 B 192 . . . . 1 + 193 . . 1 * 194 . . 1 B 195 . . . . 1 + 196 . . . . 1 , 197 . . . . 1 + 198 . . 1 + 199 . . 1 B 200 . . . . 1 , . 201 . . 1 B 202 . . 1 B 203 . . . . 1 . . 204 . . 1 + 205 . . . . 1 * 206 . . 1 + 207 . . 1 B 208 . . 1 B 209 . . 1 B 210 . . 1 + 211 . . 1 + 212 . . . . 1 . . 213 . . . . 1 , 214 . . . . 1 . , 215 . . 1 B 216 . . 1 B 217 . . 1 B 218 . . 1 . , 219 . . . . 1 . . 220 . . 1 B 221 . . 1 , 222 . . 1 B 223 . . . . 1 . . 224 . . 1 , . 225 . . . . 1 + 226 . . 1 + 227 . . 1 B 228 . . . . 1 . . 229 . . . . 1 . . . 230 . . 1 , . 231 . . 1 * 232 . . 1 . , 233 . . 1 B 234 . . 1 , . 235 . . . . 1 + 236 . . . . 1 B 237 . . 1 B 238 . . 1 + 239 . . 1 B 240 . . 1 B 241 . . . . 1 , . 242 . . 1 B 243 . . 1 * 244 . . 1 + 245 . . 1 B 246 . . 1 B 247 . . . . 1 B 248 . . 1 + 249 . . 1 + 250 . . 1 + attr(,"legend") [1] 0 ' ' 0.2 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 0.9999999 '1' 1 > > > ## Last Line: > cat('Time elapsed: ', proc.time() - .proctime00,'\n') Time elapsed: 0.136 0.007 0.143 0 0 > > proc.time() user system elapsed 0.230 0.038 0.260 cluster/tests/fanny-ex.R0000644000176200001440000000735414724620406014763 0ustar liggesusers## IGNORE_RDIFF_BEGIN .libPaths() # show full library tree {also as check of R CMD check!} ## IGNORE_RDIFF_END library(cluster) ####---------- Tests for FANNY i.e., fanny() -------------------------- #### ### -- thanks to ../.Rbuildignore , the output of this is ### -- only compared to saved values for the maintainer ###--- An extension of example(fanny) : ------------------- set.seed(21) ## generate 10+15 objects in two clusters, plus 3 objects lying ## between those clusters. x <- rbind(cbind(rnorm(10, 0, 0.5), rnorm(10, 0, 0.5)), cbind(rnorm(15, 5, 0.5), rnorm(15, 5, 0.5)), cbind(rnorm( 3,3.2,0.5), rnorm( 3,3.2,0.5))) .proctime00 <- proc.time() (fannyx <- fanny(x, 2)) summary(fannyx) str(fannyx) ## Different platforms differ (even gcc 3.0.1 vs 3.2 on same platform)! ## {70 or 71 iterations} ## ==> No "fanny-ex.Rout.save" is distributed ! ## -------------------------------------------- ## IGNORE_RDIFF_BEGIN summary(fanny(x,3))# one extra cluster ## IGNORE_RDIFF_END ## CRAN-relevant M1 mac: aarch64-apple-darwin24.1.0 / Apple clang version 16.0.0 (clang-1600.0.26.6) / macOS Sequoia 15.1.1 ## IGNORE_RDIFF_BEGIN (fanny(x,2, memb.exp = 1.5)) ## IGNORE_RDIFF_END (fanny(x,2, memb.exp = 1.2)) (fanny(x,2, memb.exp = 1.1)) (fanny(x,2, memb.exp = 3)) ## for subsetting, when compairing: not.conv <- setdiff(names(fannyx), c("convergence", "call")) notMconv <- setdiff(names(fannyx), c("membership", "convergence", "call")) data(ruspini) # < to run under R 1.9.1 summary(fanny(ruspini, 3), digits = 9) summary(fanny(ruspini, 4), digits = 9)# 'correct' #{clusters} summary(fanny(ruspini, 5), digits = 9) cat('Time elapsed: ', proc.time() - .proctime00,'\n') data(chorSub) p4cl <- pam(chorSub, k = 4, cluster.only = TRUE) ## The first two are "completely fuzzy" -- and now give a warnings ## IGNORE_RDIFF_BEGIN f4.20 <- fanny(chorSub, k = 4, trace.lev = 1) f4.20$coef ## IGNORE_RDIFF_END stopifnot(exprs = { all.equal(f4.20$coef, c(dunn_coeff = 0.25, normalized = 3.330669e-15)) all.equal(f4.20$objective[["objective"]], 2665.982, tol = 8e-7) all.equal(f4.20$silinfo$avg.width, 0.250643, tol = 2e-6) }) f4.18 <- fanny(chorSub, k = 4, memb.exp = 1.8) # same problem f4.18. <- fanny(chorSub, k = 4, memb.exp = 1.8, iniMem.p = f4.20$membership) # very quick convergence stopifnot(all.equal(f4.18[not.conv], f4.18.[not.conv], tol = 5e-7)) f4.16 <- fanny(chorSub, k = 4, memb.exp = 1.6) # now gives 4 crisp clusters ## IGNORE_RDIFF_BEGIN f4.16. <- fanny(chorSub, k = 4, memb.exp = 1.6, iniMem.p = f4.18$membership, trace.lev = 2)# wrongly "converged" immediately; no longer! f4.16.2<- fanny(chorSub, k = 4, memb.exp = 1.6, iniMem.p = cluster:::as.membership(p4cl), tol = 1e-10, trace.lev = 2) all.equal((m1 <- f4.16 $membership), (m2 <- f4.16.2$membership)) ## IGNORE_RDIFF_END stopifnot(identical(dimnames(m1), dimnames(m2)), 0 < m1,m1 < 1, 0 < m2,m2 < 1, ## the memberships are quite close but have only converged to precision 0.000228 all.equal(m1, m2, tol = 0.001)) stopifnot(exprs = { f4.16$clustering == f4.16.2$clustering all.equal(f4.16[notMconv], f4.16.2[notMconv], tol = 1e-7) }) f4.14 <- fanny(chorSub, k = 4, memb.exp = 1.4) f4.12 <- fanny(chorSub, k = 4, memb.exp = 1.2) table(f4.12$clustering, f4.14$clustering)# close but different table(f4.16$clustering, f4.14$clustering)# ditto table(f4.12$clustering, f4.16$clustering)# hence differ even more symnum(cbind(f4.16$membership, 1, f4.12$membership), cutpoints= c(0., 0.2, 0.6, 0.8, 0.9, 0.95, 1 -1e-7, 1 +1e-7), symbols = c(" ", ".", ",", "+", "*", "B","1")) ## Last Line: cat('Time elapsed: ', proc.time() - .proctime00,'\n') cluster/tests/ellipsoid-ex.R0000644000176200001440000000211713467043541015626 0ustar liggesuserslibrary(cluster) tools::assertWarning(eh <- ellipsoidhull(cbind(x=1:4, y = 1:4)), verbose=TRUE) #singular eh ## center ok, shape "0 volume" --> Warning stopifnot(volume(eh) == 0) set.seed(157) for(n in 4:10) { ## n=2 and 3 still differ -- platform dependently! cat("n = ",n,"\n") x2 <- rnorm(n) print(ellipsoidhull(cbind(1:n, x2))) print(ellipsoidhull(cbind(1:n, x2, 4*x2 + rnorm(n)))) } set.seed(1) x <- rt(100, df = 4) y <- 100 + 5 * x + rnorm(100) ellipsoidhull(cbind(x,y)) z <- 10 - 8 * x + y + rnorm(100) (e3 <- ellipsoidhull(cbind(x,y,z))) d3o <- cbind(x,y + rt(100,3), 2 * x^2 + rt(100, 2)) (e. <- ellipsoidhull(d3o, ret.sq = TRUE)) stopifnot(all.equal(e.$sqdist, with(e., mahalanobis(d3o, center=loc, cov=cov)), tol = 1e-13)) d5 <- cbind(d3o, 2*abs(y)^1.5 + rt(100,3), 3*x - sqrt(abs(y))) (e5 <- ellipsoidhull(d5, ret.sq = TRUE)) tail(sort(e5$sqdist)) ## 4 values 5.00039 ... 5.0099 (e5.1e77 <- ellipsoidhull(1e77*d5)) stopifnot(# proof correct scaling c^5 all.equal(volume(e5.1e77, log=TRUE) - volume(e5, log=TRUE), ncol(d5) * 77* log(10)) ) cluster/tests/clara-ex.Rout.save0000644000176200001440000000560013257174710016411 0ustar liggesusers R version 3.5.0 alpha (2018-03-28 r74481) Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) 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. > #### These are *NOT* compared with output in the released version of > ### 'cluster' currently > > library(cluster) > > source(system.file("test-tools.R", package = "cluster"), keep.source = FALSE) Loading required package: tools > ## -> showProc.time() ... & doExtras > > data(xclara) > ## Try 100 times *different* random samples -- for reliability: > nSim <- 100 > nCl <- 3 # = no.classes > showProc.time() Time elapsed: 0.431 0.065 0.533 > > ## unknown problem: this is still platform dependent to some extent: > set.seed(107)# << reproducibility; somewhat favorable with "small iDoubt" > cl <- replicate(nSim, clara(xclara, nCl, rngR = TRUE)$cluster) > tcl <- apply(cl,1, tabulate, nbins = nCl) > showProc.time() Time elapsed: 0.224 0.003 0.227 > ## those that are not always in same cluster (5 out of 3000 for this seed): > (iDoubt <- which(apply(tcl,2, function(n) all(n < nSim)))) [1] 6 71 243 245 610 708 727 770 1038 1081 1120 1248 1289 1610 1644 [16] 1922 > > if(doExtras) { + if(getRversion() < "3.2.1") + lengths <- function (x, use.names = TRUE) vapply(x, length, 1L, USE.NAMES = use.names) + rrr <- lapply(1:128, function(iseed) { + set.seed(iseed) + cat(iseed, if(iseed %% 10 == 0) "\n" else "") + cl <- replicate(nSim, clara(xclara, nCl, rngR = TRUE)$cluster) + tcl <- apply(cl,1, tabulate, nbins = nCl) + which(apply(tcl,2, function(n) all(n < nSim))) + }); cat("\n") + showProc.time() + cat("Number of cases which \"changed\" clusters:\n") + print(lengths(rrr)) + ## compare with "true" -- are the "changers" only those with small sil.width? + ## __TODO!__ + showSys.time(px <- pam(xclara,3))# 1.84 on lynne(2013) + + } ## doExtras > > > if(length(iDoubt)) { # (not for all seeds) + tabD <- tcl[,iDoubt, drop=FALSE] + dimnames(tabD) <- list(cluster = paste(1:nCl), obs = format(iDoubt)) + print( t(tabD) ) # how many times in which clusters + } cluster obs 1 2 3 6 98 2 0 71 99 1 0 243 98 0 2 245 86 0 14 610 84 16 0 708 87 13 0 727 87 0 13 770 0 1 99 1038 80 20 0 1081 48 52 0 1120 5 95 0 1248 21 79 0 1289 3 97 0 1610 59 41 0 1644 18 82 0 1922 10 90 0 > > proc.time() user system elapsed 0.818 0.104 1.017 cluster/tests/clara-gower.R0000644000176200001440000000550114532110372015422 0ustar liggesusersquit("no") ## retracted metric = "gower": bad memory leakage -- see ./clara-gower_valgrind.Rout <<<<< ## Originally inspired by Kasper Fischer-Rasmussen 's clara_gower.html [html from Rmd] library(cluster) packageDescription("cluster") ## carefully getting 150 + 200 + 150 = 500 obs. from the 3 xclara clusters : str(dd <- xclara[c(1:150, 1001:1200, 2101:2250), ]) dim(dd) # 500 2 set.seed(47) cl_manhat <- clara(dd, 3, metric = "manhattan", rngR=TRUE, pamLike=TRUE, samples = 500) cl_gower <- clara(dd, 3, metric = "gower", rngR=TRUE, pamLike=TRUE, samples = 500) table(cl_manhat$cluster, cl_gower $cluster) stopifnot(exprs = { ## Apart from [188], they are the same ## usually even *including* [188], but not always ???? {FIXME ??? Random? even we use rngR?} cl_manhat$cluster[-188] == cl_gower $cluster[-188] identical(rle(unname(cl_manhat$cluster)), structure(class = "rle", list(lengths = c(29L, 1L, 120L, 80L, 1L, 119L, 150L), values = c( 1L, 2L, 1L, 2L, 1L, 2L, 3L)))) }) ## ==> no distinction between the clusters wrt Manhattan vs. Gower's distance. ## Using {cluster}'s built in tools to compute Gower's distance. cl_gower_full <- clara(dd, k = 3, metric = "gower", rngR = TRUE, pamLike = TRUE, samples = 500, sampsize = nrow(dd)) dist_cl_full <- as.matrix(cl_gower_full$diss) i_full <- rownames(dist_cl_full) d_full <- data.frame(CLARA = as.vector(cl_gower_full$diss), DAISY = as.vector(daisy(dd[i_full, ], metric = "gower"))) ## MM: instead of all this, just all.equal(d_full$CLARA, d_full$DAISY, tol=0) # "Mean relative difference: 2.17e-16" ## ... but sometimes *VERY* different (relative diff. 0.5xxx) if(FALSE) stopifnot( all.equal(d_full$CLARA, d_full$DAISY, tol = 1e-15) ) ## equal up to 15 digits! ## We can see that the distance measurements are exactly identical when the ## whole data is used in the clustering. This is because the Gower distance ## scales the distances measurements with the range of each feature. Due to ## the subsampling, approximate ranges are calculated based on each ## subsample explaining the deviations. ## MM: compare -- with pam(): dGow <- daisy(dd, metric="gower") cl_full <- clara(dd, k = 3, metric = "gower", rngR = TRUE, pamLike = TRUE, samples = 1, sampsize = nrow(dd)) all.equal(c(dGow) , c(cl_full$diss), tol=0) # "Mean relative difference: 2.171402e-16" pam_3 <- pam(dGow, k = 3, variant = "faster") ## FIXME !! -- bug !? all.equal(pam_3 $ clustering, # we would want *identical* -- bug ?? cl_full$ clustering) all.equal(c(dGow) , c(cl_full$diss), tol = 1e-15) if(FALSE) ## FIXME stopifnot(exprs = { identical(pam_3 $ clustering, cl_full$ clustering) all.equal(c(dGow) , c(cl_full$diss), tol = 1e-15) }) cluster/tests/clusplot-out.R0000644000176200001440000000152410761764276015714 0ustar liggesuserslibrary(cluster) ### clusplot() & pam() RESULT checking ... ## plotting votes.diss(dissimilarity) in a bivariate plot and ## partitioning into 2 clusters data(votes.repub) votes.diss <- daisy(votes.repub) for(k in 2:4) { votes.clus <- pam(votes.diss, k, diss = TRUE)$clustering print(clusplot(votes.diss, votes.clus, diss = TRUE, shade = TRUE)) } ## plotting iris (dataframe) in a 2-dimensional plot and partitioning ## into 3 clusters. data(iris) iris.x <- iris[, 1:4] for(k in 2:5) print(clusplot(iris.x, pam(iris.x, k)$clustering, diss = FALSE)) .Random.seed <- c(0L,rep(7654L,3)) ## generate 25 objects, divided into 2 clusters. x <- rbind(cbind(rnorm(10,0,0.5), rnorm(10,0,0.5)), cbind(rnorm(15,5,0.5), rnorm(15,5,0.5))) print.default(clusplot(px2 <- pam(x, 2))) clusplot(px2, labels = 2, col.p = 1 + px2$clustering) cluster/tests/daisy-ex.R0000644000176200001440000000715414237502131014750 0ustar liggesusers## For different cluster versions require(cluster) if(interactive()) print(packageDescription("cluster")) ## trivial cases should 'work': daisy(cbind(1)) (d10 <- daisy(matrix(0., 1,0))); str(d10) d01 <- daisy(matrix(0., 0,1)) if(paste(R.version$major, R.version$minor, sep=".") >= "2.1.0") print(d01) str(d01) d32 <- data.frame(eins=c("A"=1,"B"=1,"C"=1), zwei=c(2,2,2)) daisy(d32) daisy(d32, stand = TRUE) daisy(d32, type = list(ordratio="zwei")) str(d5 <- data.frame(a= c(0, 0, 0,1,0,0, 0,0,1, 0,NA), b= c(NA,0, 1,1,0,1, 0,1,0, 1,0), c= c(0, 1, 1,0,1,NA,1,0,1, 0,NA), d= c(1, 1, 0,1,0,0, 0,0,0, 1,0), e= c(1, NA,0,1,0,0, 0,0,NA,1,1))) (d0 <- daisy(d5)) (d1 <- daisy(d5, type = list(asymm = 1:5))) (d2 <- daisy(d5, type = list(symm = 1:2, asymm= 3:5))) (d2.<- daisy(d5, type = list( asymm= 3:5))) stopifnot(identical(c(d2), c(d2.))) (dS <- daisy(d5, stand = TRUE))# gave error in some versions stopifnot(all.equal(as.vector(summary(c(dS), digits=9)), c(0, 2.6142638, 3.4938562, 3.2933687, 4.0591077, 5.5580177), tol = 1e-7))# 7.88e-9 d5[,4] <- 1 # binary with only one instead of two values (d0 <- daisy(d5)) (d1 <- daisy(d5, type = list(asymm = 1:5)))# 2 NAs (d2 <- daisy(d5, type = list(symm = 1:2, asymm= 3:5))) (d2.<- daisy(d5, type = list( asymm= 3:5))) ## better leave away the constant variable: it has no effect: stopifnot(identical(c(d1), c(daisy(d5[,-4], type = list(asymm = 1:4))))) ###---- Trivial "binary only" matrices (not data frames) did fail: x <- matrix(0, 2, 2) dimnames(x)[[2]] <- c("A", "B")## colnames<- is missing in S+ daisy(x, type = list(symm= "B", asymm="A")) daisy(x, type = list(symm= "B"))# 0 too x2 <- x; x2[2,2] <- 1 daisy(x2, type= list(symm = "B"))# |-> 0.5 (gives 1 in S+) daisy(x2, type= list(symm = "B", asymm="A"))# 1 x3 <- x; x3[] <- diag(2) daisy(x3) # warning: both as interval scaled -> sqrt(2) daisy(x3, type= list(symm="B", asymm="A"))# 1 daisy(x3, type= list(symm =c("B","A"))) # 1, S+: sqrt(2) daisy(x3, type= list(asymm=c("B","A"))) # 1, S+ : sqrt(2) x4 <- rbind(x3, 1) daisy(x4, type= list(symm="B", asymm="A"))# 1 0.5 0.5 daisy(x4, type= list(symm=c("B","A"))) # dito; S+ : 1.41 1 1 daisy(x4, type= list(asymm=c("A","B"))) # dito, dito ## ----------- example(daisy) ----------------------- data(flower) data(agriculture) ## Example 1 in ref: ## Dissimilarities using Euclidean metric and without standardization (d.agr <- daisy(agriculture, metric = "euclidean", stand = FALSE)) (d.agr2 <- daisy(agriculture, metric = "manhattan")) ## Example 2 in ref (dfl0 <- daisy(flower)) stopifnot(identical(c(dfl0), c(daisy(flower, type = list(symm = 1)))) && identical(c(dfl0), c(daisy(flower, type = list(symm = 2)))) && identical(c(dfl0), c(daisy(flower, type = list(symm = 3)))) && identical(c(dfl0), c(daisy(flower, type = list(symm = c(1,3))))) ) (dfl1 <- daisy(flower, type = list(asymm = 3))) (dfl2 <- daisy(flower, type = list(asymm = c(1, 3), ordratio = 7))) (dfl3 <- daisy(flower, type = list(asymm = 1:3))) ## --- animals data(animals) d0 <- daisy(animals) d1 <- daisy(animals - 1, type=list(asymm=c(2,4))) (d2 <- daisy(animals - 1, type=list(symm = c(1,3,5,6), asymm=c(2,4)))) stopifnot(c(d1) == c(d2)) d3 <- daisy(2 - animals, type=list(asymm=c(2,4))) (d4 <- daisy(2 - animals, type=list(symm = c(1,3,5,6), asymm=c(2,4)))) stopifnot(c(d3) == c(d4)) pairs(cbind(d0,d2,d4), main = "Animals -- symmetric and asymm. dissimilarities") cluster/tests/daisy-ex.Rout.save0000644000176200001440000012353314237502131016435 0ustar liggesusers R version 4.2.0 Patched (2022-05-13 r82353) -- "Vigorous Calisthenics" Copyright (C) 2022 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) 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. > ## For different cluster versions > > require(cluster) Loading required package: cluster > > if(interactive()) print(packageDescription("cluster")) > > ## trivial cases should 'work': > daisy(cbind(1)) Dissimilarities : dissimilarity(0) Metric : euclidean Number of objects : 1 > (d10 <- daisy(matrix(0., 1,0))); str(d10) Dissimilarities : dissimilarity(0) Metric : euclidean Number of objects : 1 'dissimilarity' num(0) - attr(*, "Size")= int 1 - attr(*, "Metric")= chr "euclidean" > d01 <- daisy(matrix(0., 0,1)) > if(paste(R.version$major, R.version$minor, sep=".") >= "2.1.0") + print(d01) Dissimilarities : dissimilarity(0) Metric : euclidean Number of objects : 0 > str(d01) 'dissimilarity' num(0) - attr(*, "Size")= int 0 - attr(*, "Metric")= chr "euclidean" > d32 <- data.frame(eins=c("A"=1,"B"=1,"C"=1), zwei=c(2,2,2)) > daisy(d32) Dissimilarities : A B B 0 C 0 0 Metric : euclidean Number of objects : 3 > daisy(d32, stand = TRUE) Dissimilarities : A B B 0 C 0 0 Metric : euclidean Number of objects : 3 Warning message: In daisy(d32, stand = TRUE) : 'x' has constant columns 1, 2; these are standardized to 0 > daisy(d32, type = list(ordratio="zwei")) Dissimilarities : A B B 0 C 0 0 Metric : mixed ; Types = I, T Number of objects : 3 > > > str(d5 <- data.frame(a= c(0, 0, 0,1,0,0, 0,0,1, 0,NA), + b= c(NA,0, 1,1,0,1, 0,1,0, 1,0), + c= c(0, 1, 1,0,1,NA,1,0,1, 0,NA), + d= c(1, 1, 0,1,0,0, 0,0,0, 1,0), + e= c(1, NA,0,1,0,0, 0,0,NA,1,1))) 'data.frame': 11 obs. of 5 variables: $ a: num 0 0 0 1 0 0 0 0 1 0 ... $ b: num NA 0 1 1 0 1 0 1 0 1 ... $ c: num 0 1 1 0 1 NA 1 0 1 0 ... $ d: num 1 1 0 1 0 0 0 0 0 1 ... $ e: num 1 NA 0 1 0 0 0 0 NA 1 ... > (d0 <- daisy(d5)) Dissimilarities : 1 2 3 4 5 6 7 8 2 1.290994 3 1.936492 1.581139 4 1.118034 1.936492 2.000000 5 1.936492 1.118034 1.000000 2.236068 6 1.825742 1.825742 0.000000 1.936492 1.118034 7 1.936492 1.118034 1.000000 2.236068 0.000000 1.118034 8 1.581139 1.936492 1.000000 1.732051 1.414214 0.000000 1.414214 9 2.236068 1.581139 1.581139 1.936492 1.118034 1.825742 1.118034 1.936492 10 0.000000 1.581139 1.732051 1.000000 2.000000 1.581139 2.000000 1.414214 11 1.581139 1.581139 1.825742 1.825742 1.290994 1.825742 1.290994 1.825742 9 10 2 3 4 5 6 7 8 9 10 2.236068 11 0.000000 1.825742 Metric : euclidean Number of objects : 11 Warning message: In daisy(d5) : binary variable(s) 1, 2, 3, 4, 5 treated as interval scaled > (d1 <- daisy(d5, type = list(asymm = 1:5))) Dissimilarities : 1 2 3 4 5 6 7 2 0.5000000 3 1.0000000 0.6666667 4 0.3333333 0.7500000 0.8000000 5 1.0000000 0.5000000 0.5000000 1.0000000 6 1.0000000 1.0000000 0.0000000 0.7500000 1.0000000 7 1.0000000 0.5000000 0.5000000 1.0000000 0.0000000 1.0000000 8 1.0000000 1.0000000 0.5000000 0.7500000 1.0000000 0.0000000 1.0000000 9 1.0000000 0.6666667 0.6666667 0.7500000 0.5000000 1.0000000 0.5000000 10 0.0000000 0.6666667 0.7500000 0.2500000 1.0000000 0.6666667 1.0000000 11 0.5000000 1.0000000 1.0000000 0.6666667 1.0000000 1.0000000 1.0000000 8 9 10 2 3 4 5 6 7 8 9 1.0000000 10 0.6666667 1.0000000 11 1.0000000 NA 0.6666667 Metric : mixed ; Types = A, A, A, A, A Number of objects : 11 > (d2 <- daisy(d5, type = list(symm = 1:2, asymm= 3:5))) Dissimilarities : 1 2 3 4 5 6 7 2 0.3333333 3 0.7500000 0.5000000 4 0.3333333 0.7500000 0.8000000 5 0.7500000 0.2500000 0.3333333 1.0000000 6 0.6666667 0.6666667 0.0000000 0.7500000 0.5000000 7 0.7500000 0.2500000 0.3333333 1.0000000 0.0000000 0.5000000 8 0.6666667 0.7500000 0.3333333 0.7500000 0.6666667 0.0000000 0.6666667 9 1.0000000 0.5000000 0.6666667 0.7500000 0.3333333 1.0000000 0.3333333 10 0.0000000 0.5000000 0.6000000 0.2500000 0.8000000 0.5000000 0.8000000 11 0.5000000 0.5000000 1.0000000 0.6666667 0.5000000 1.0000000 0.5000000 8 9 10 2 3 4 5 6 7 8 9 1.0000000 10 0.5000000 1.0000000 11 1.0000000 0.0000000 0.6666667 Metric : mixed ; Types = S, S, A, A, A Number of objects : 11 > (d2.<- daisy(d5, type = list( asymm= 3:5))) Dissimilarities : 1 2 3 4 5 6 7 2 0.3333333 3 0.7500000 0.5000000 4 0.3333333 0.7500000 0.8000000 5 0.7500000 0.2500000 0.3333333 1.0000000 6 0.6666667 0.6666667 0.0000000 0.7500000 0.5000000 7 0.7500000 0.2500000 0.3333333 1.0000000 0.0000000 0.5000000 8 0.6666667 0.7500000 0.3333333 0.7500000 0.6666667 0.0000000 0.6666667 9 1.0000000 0.5000000 0.6666667 0.7500000 0.3333333 1.0000000 0.3333333 10 0.0000000 0.5000000 0.6000000 0.2500000 0.8000000 0.5000000 0.8000000 11 0.5000000 0.5000000 1.0000000 0.6666667 0.5000000 1.0000000 0.5000000 8 9 10 2 3 4 5 6 7 8 9 1.0000000 10 0.5000000 1.0000000 11 1.0000000 0.0000000 0.6666667 Metric : mixed ; Types = I, I, A, A, A Number of objects : 11 Warning message: In daisy(d5, type = list(asymm = 3:5)) : binary variable(s) 1, 2 treated as interval scaled > stopifnot(identical(c(d2), c(d2.))) > (dS <- daisy(d5, stand = TRUE))# gave error in some versions Dissimilarities : 1 2 3 4 5 6 7 8 2 2.614264 3 4.010913 3.291786 4 3.493856 4.725761 4.757684 5 4.010913 2.415752 2.000000 5.160965 6 3.823025 3.801028 0.000000 4.813384 2.236068 7 4.010913 2.415752 2.000000 5.160965 0.000000 2.236068 8 3.310837 3.995202 2.025000 4.305222 2.846160 0.000000 2.846160 9 5.558018 4.247692 4.148136 3.995202 3.493856 4.789855 3.493856 4.725761 10 0.000000 3.182103 3.587469 3.125000 4.107303 3.310837 4.107303 2.961302 11 3.416389 3.416389 3.674376 3.801028 2.614264 3.674376 2.614264 3.674376 9 10 2 3 4 5 6 7 8 9 10 5.307417 11 0.000000 3.801028 Metric : euclidean Number of objects : 11 Warning message: In daisy(d5, stand = TRUE) : binary variable(s) 1, 2, 3, 4, 5 treated as interval scaled > stopifnot(all.equal(as.vector(summary(c(dS), digits=9)), + c(0, 2.6142638, 3.4938562, 3.2933687, 4.0591077, 5.5580177), + tol = 1e-7))# 7.88e-9 > > d5[,4] <- 1 # binary with only one instead of two values > (d0 <- daisy(d5)) Dissimilarities : 1 2 3 4 5 6 7 8 2 1.290994 3 1.581139 1.118034 4 1.118034 1.936492 1.732051 5 1.581139 0.000000 1.000000 2.000000 6 1.290994 1.290994 0.000000 1.581139 1.118034 7 1.581139 0.000000 1.000000 2.000000 0.000000 1.118034 8 1.118034 1.581139 1.000000 1.414214 1.414214 0.000000 1.414214 9 1.825742 1.118034 1.581139 1.581139 1.118034 1.825742 1.118034 1.936492 10 0.000000 1.581139 1.414214 1.000000 1.732051 1.118034 1.732051 1.000000 11 0.000000 0.000000 1.825742 1.290994 1.290994 1.825742 1.290994 1.825742 9 10 2 3 4 5 6 7 8 9 10 1.936492 11 0.000000 1.290994 Metric : euclidean Number of objects : 11 Warning message: In daisy(d5) : binary variable(s) 1, 2, 3, 5 treated as interval scaled > (d1 <- daisy(d5, type = list(asymm = 1:5)))# 2 NAs Dissimilarities : 1 2 3 4 5 6 7 2 1.0000000 3 1.0000000 0.5000000 4 0.5000000 1.0000000 0.7500000 5 1.0000000 0.0000000 0.5000000 1.0000000 6 1.0000000 1.0000000 0.0000000 0.6666667 1.0000000 7 1.0000000 0.0000000 0.5000000 1.0000000 0.0000000 1.0000000 8 1.0000000 1.0000000 0.5000000 0.6666667 1.0000000 0.0000000 1.0000000 9 1.0000000 0.5000000 0.6666667 0.6666667 0.5000000 1.0000000 0.5000000 10 0.0000000 1.0000000 0.6666667 0.3333333 1.0000000 0.5000000 1.0000000 11 0.0000000 NA 1.0000000 0.5000000 1.0000000 1.0000000 1.0000000 8 9 10 2 3 4 5 6 7 8 9 1.0000000 10 0.5000000 1.0000000 11 1.0000000 NA 0.5000000 Metric : mixed ; Types = A, A, A, A, A Number of objects : 11 Warning message: In daisy(d5, type = list(asymm = 1:5)) : at least one binary variable has not 2 different levels. > (d2 <- daisy(d5, type = list(symm = 1:2, asymm= 3:5))) Dissimilarities : 1 2 3 4 5 6 7 2 0.5000000 3 0.6666667 0.3333333 4 0.5000000 1.0000000 0.7500000 5 0.6666667 0.0000000 0.3333333 1.0000000 6 0.5000000 0.5000000 0.0000000 0.6666667 0.5000000 7 0.6666667 0.0000000 0.3333333 1.0000000 0.0000000 0.5000000 8 0.5000000 0.6666667 0.3333333 0.6666667 0.6666667 0.0000000 0.6666667 9 1.0000000 0.3333333 0.6666667 0.6666667 0.3333333 1.0000000 0.3333333 10 0.0000000 0.6666667 0.5000000 0.3333333 0.7500000 0.3333333 0.7500000 11 0.0000000 0.0000000 1.0000000 0.5000000 0.5000000 1.0000000 0.5000000 8 9 10 2 3 4 5 6 7 8 9 1.0000000 10 0.3333333 1.0000000 11 1.0000000 0.0000000 0.5000000 Metric : mixed ; Types = S, S, A, A, A Number of objects : 11 Warning message: In daisy(d5, type = list(symm = 1:2, asymm = 3:5)) : at least one binary variable has not 2 different levels. > (d2.<- daisy(d5, type = list( asymm= 3:5))) Dissimilarities : 1 2 3 4 5 6 7 2 0.5000000 3 0.6666667 0.3333333 4 0.5000000 1.0000000 0.7500000 5 0.6666667 0.0000000 0.3333333 1.0000000 6 0.5000000 0.5000000 0.0000000 0.6666667 0.5000000 7 0.6666667 0.0000000 0.3333333 1.0000000 0.0000000 0.5000000 8 0.5000000 0.6666667 0.3333333 0.6666667 0.6666667 0.0000000 0.6666667 9 1.0000000 0.3333333 0.6666667 0.6666667 0.3333333 1.0000000 0.3333333 10 0.0000000 0.6666667 0.5000000 0.3333333 0.7500000 0.3333333 0.7500000 11 0.0000000 0.0000000 1.0000000 0.5000000 0.5000000 1.0000000 0.5000000 8 9 10 2 3 4 5 6 7 8 9 1.0000000 10 0.3333333 1.0000000 11 1.0000000 0.0000000 0.5000000 Metric : mixed ; Types = I, I, A, A, A Number of objects : 11 Warning messages: 1: In daisy(d5, type = list(asymm = 3:5)) : at least one binary variable has not 2 different levels. 2: In daisy(d5, type = list(asymm = 3:5)) : binary variable(s) 1, 2 treated as interval scaled > ## better leave away the constant variable: it has no effect: > stopifnot(identical(c(d1), c(daisy(d5[,-4], type = list(asymm = 1:4))))) > > ###---- Trivial "binary only" matrices (not data frames) did fail: > > x <- matrix(0, 2, 2) > dimnames(x)[[2]] <- c("A", "B")## colnames<- is missing in S+ > daisy(x, type = list(symm= "B", asymm="A")) Dissimilarities : 1 2 0 Metric : mixed ; Types = A, S Number of objects : 2 Warning message: In daisy(x, type = list(symm = "B", asymm = "A")) : at least one binary variable has not 2 different levels. > daisy(x, type = list(symm= "B"))# 0 too Dissimilarities : 1 2 0 Metric : mixed ; Types = I, S Number of objects : 2 Warning message: In daisy(x, type = list(symm = "B")) : at least one binary variable has not 2 different levels. > > x2 <- x; x2[2,2] <- 1 > daisy(x2, type= list(symm = "B"))# |-> 0.5 (gives 1 in S+) Dissimilarities : 1 2 0.5 Metric : mixed ; Types = I, S Number of objects : 2 > daisy(x2, type= list(symm = "B", asymm="A"))# 1 Dissimilarities : 1 2 1 Metric : mixed ; Types = A, S Number of objects : 2 Warning message: In daisy(x2, type = list(symm = "B", asymm = "A")) : at least one binary variable has not 2 different levels. > > x3 <- x; x3[] <- diag(2) > daisy(x3) # warning: both as interval scaled -> sqrt(2) Dissimilarities : 1 2 1.414214 Metric : euclidean Number of objects : 2 > daisy(x3, type= list(symm="B", asymm="A"))# 1 Dissimilarities : 1 2 1 Metric : mixed ; Types = A, S Number of objects : 2 > daisy(x3, type= list(symm =c("B","A"))) # 1, S+: sqrt(2) Dissimilarities : 1 2 1 Metric : mixed ; Types = S, S Number of objects : 2 > daisy(x3, type= list(asymm=c("B","A"))) # 1, S+ : sqrt(2) Dissimilarities : 1 2 1 Metric : mixed ; Types = A, A Number of objects : 2 > > x4 <- rbind(x3, 1) > daisy(x4, type= list(symm="B", asymm="A"))# 1 0.5 0.5 Dissimilarities : 1 2 2 1.0 3 0.5 0.5 Metric : mixed ; Types = A, S Number of objects : 3 > daisy(x4, type= list(symm=c("B","A"))) # dito; S+ : 1.41 1 1 Dissimilarities : 1 2 2 1.0 3 0.5 0.5 Metric : mixed ; Types = S, S Number of objects : 3 > daisy(x4, type= list(asymm=c("A","B"))) # dito, dito Dissimilarities : 1 2 2 1.0 3 0.5 0.5 Metric : mixed ; Types = A, A Number of objects : 3 > > > > ## ----------- example(daisy) ----------------------- > > data(flower) > data(agriculture) > > ## Example 1 in ref: > ## Dissimilarities using Euclidean metric and without standardization > (d.agr <- daisy(agriculture, metric = "euclidean", stand = FALSE)) Dissimilarities : B DK D GR E F IRL DK 5.408327 D 2.061553 3.405877 GR 22.339651 22.570113 22.661200 E 9.818350 11.182576 10.394710 12.567418 F 3.448188 3.512834 2.657066 20.100995 8.060397 IRL 12.747549 13.306014 13.080138 9.604166 3.140064 10.564563 I 5.803447 5.470832 5.423099 17.383325 5.727128 2.773085 7.920859 L 4.275512 2.220360 2.300000 24.035391 12.121056 4.060788 14.569145 NL 1.649242 5.096077 2.435159 20.752349 8.280097 2.202272 11.150785 P 17.236299 17.864490 17.664088 5.162364 7.430343 15.164432 4.601087 UK 2.828427 8.052950 4.850773 21.485344 8.984431 5.303772 12.103718 I L NL P DK D GR E F IRL I L 6.660330 NL 4.204759 4.669047 P 12.515990 19.168985 15.670673 UK 6.723095 7.102112 3.124100 16.323296 Metric : euclidean Number of objects : 12 > (d.agr2 <- daisy(agriculture, metric = "manhattan")) Dissimilarities : B DK D GR E F IRL I L NL P DK 7.5 D 2.7 4.8 GR 30.4 31.9 31.5 E 13.6 15.1 14.7 16.8 F 4.3 3.8 3.4 28.1 11.3 IRL 17.2 18.7 18.3 13.2 3.6 14.9 I 6.0 7.5 7.1 24.4 7.6 3.7 11.2 L 5.0 2.5 2.3 33.8 17.0 5.7 20.6 9.4 NL 2.0 6.3 3.1 28.4 11.6 3.1 15.2 4.4 5.4 P 23.7 25.2 24.8 6.7 10.1 21.4 6.5 17.7 27.1 21.7 UK 3.2 10.7 5.9 28.0 11.2 7.5 14.8 8.8 8.2 4.4 21.3 Metric : manhattan Number of objects : 12 > > > ## Example 2 in ref > (dfl0 <- daisy(flower)) Dissimilarities : 1 2 3 4 5 6 7 2 0.8875408 3 0.5272467 0.5147059 4 0.3517974 0.5504493 0.5651552 5 0.4115605 0.6226307 0.3726307 0.6383578 6 0.2269199 0.6606209 0.3003268 0.4189951 0.3443627 7 0.2876225 0.5999183 0.4896242 0.3435866 0.4197712 0.1892974 8 0.4234069 0.4641340 0.6038399 0.2960376 0.4673203 0.5714869 0.4107843 9 0.5808824 0.4316585 0.4463644 0.8076797 0.3306781 0.5136846 0.5890931 10 0.6094363 0.4531046 0.4678105 0.5570670 0.3812908 0.4119281 0.5865196 11 0.3278595 0.7096814 0.5993873 0.6518791 0.3864788 0.4828840 0.5652369 12 0.4267565 0.5857843 0.6004902 0.5132761 0.5000817 0.5248366 0.6391340 13 0.5196487 0.5248366 0.5395425 0.7464461 0.2919118 0.4524510 0.5278595 14 0.2926062 0.5949346 0.6096405 0.3680147 0.5203431 0.3656863 0.5049837 15 0.6221814 0.3903595 0.5300654 0.5531454 0.4602124 0.5091503 0.3345588 16 0.6935866 0.3575163 0.6222222 0.3417892 0.7301471 0.5107843 0.4353758 17 0.7765114 0.1904412 0.5801471 0.4247141 0.6880719 0.5937092 0.5183007 18 0.4610294 0.4515114 0.7162173 0.4378268 0.4755310 0.6438317 0.4692402 8 9 10 11 12 13 14 2 3 4 5 6 7 8 9 0.6366422 10 0.6639706 0.4256127 11 0.4955474 0.4308007 0.3948121 12 0.4216503 0.4194036 0.3812092 0.2636029 13 0.5754085 0.2181781 0.3643791 0.3445670 0.2331699 14 0.4558007 0.4396650 0.3609477 0.2838644 0.1591503 0.3784314 15 0.4512255 0.2545343 0.4210784 0.4806781 0.4295752 0.3183007 0.4351307 16 0.6378268 0.6494690 0.3488562 0.7436683 0.6050654 0.5882353 0.4598039 17 0.4707516 0.6073938 0.3067810 0.7015931 0.5629902 0.5461601 0.5427288 18 0.1417892 0.5198529 0.8057598 0.5359477 0.5495507 0.5733252 0.5698121 15 16 17 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 0.3949346 17 0.3528595 0.1670752 18 0.5096814 0.7796160 0.6125408 Metric : mixed ; Types = N, N, N, N, O, O, I, I Number of objects : 18 > stopifnot(identical(c(dfl0), + c(daisy(flower, type = list(symm = 1)))) && + identical(c(dfl0), + c(daisy(flower, type = list(symm = 2)))) && + identical(c(dfl0), + c(daisy(flower, type = list(symm = 3)))) && + identical(c(dfl0), + c(daisy(flower, type = list(symm = c(1,3))))) + ) > > (dfl1 <- daisy(flower, type = list(asymm = 3))) Dissimilarities : 1 2 3 4 5 6 7 2 0.8875408 3 0.5272467 0.5882353 4 0.3517974 0.5504493 0.5651552 5 0.4115605 0.7115780 0.4258637 0.6383578 6 0.2269199 0.7549953 0.3432306 0.4189951 0.3935574 7 0.2876225 0.6856209 0.5595705 0.3435866 0.4797386 0.2163399 8 0.4234069 0.4641340 0.6038399 0.2960376 0.4673203 0.5714869 0.4107843 9 0.5808824 0.4933240 0.5101307 0.8076797 0.3779178 0.5870682 0.6732493 10 0.6094363 0.5178338 0.5346405 0.5570670 0.4357610 0.4707750 0.6703081 11 0.3278595 0.7096814 0.5993873 0.6518791 0.3864788 0.4828840 0.5652369 12 0.4267565 0.5857843 0.6004902 0.5132761 0.5000817 0.5248366 0.6391340 13 0.5196487 0.5998133 0.6166200 0.7464461 0.3336134 0.5170868 0.6032680 14 0.2926062 0.5949346 0.6096405 0.3680147 0.5203431 0.3656863 0.5049837 15 0.6221814 0.4461251 0.6057890 0.5531454 0.5259570 0.5818861 0.3823529 16 0.6935866 0.4085901 0.7111111 0.3417892 0.8344538 0.5837535 0.4975724 17 0.7765114 0.2176471 0.6630252 0.4247141 0.7863679 0.6785247 0.5923436 18 0.4610294 0.4515114 0.7162173 0.4378268 0.4755310 0.6438317 0.4692402 8 9 10 11 12 13 14 2 3 4 5 6 7 8 9 0.6366422 10 0.6639706 0.4864146 11 0.4955474 0.4308007 0.3948121 12 0.4216503 0.4194036 0.3812092 0.2636029 13 0.5754085 0.2493464 0.4164332 0.3445670 0.2331699 14 0.4558007 0.4396650 0.3609477 0.2838644 0.1591503 0.3784314 15 0.4512255 0.2908964 0.4812325 0.4806781 0.4295752 0.3637722 0.4351307 16 0.6378268 0.7422502 0.3986928 0.7436683 0.6050654 0.6722689 0.4598039 17 0.4707516 0.6941643 0.3506069 0.7015931 0.5629902 0.6241830 0.5427288 18 0.1417892 0.5198529 0.8057598 0.5359477 0.5495507 0.5733252 0.5698121 15 16 17 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 0.4513539 17 0.4032680 0.1909430 18 0.5096814 0.7796160 0.6125408 Metric : mixed ; Types = N, N, A, N, O, O, I, I Number of objects : 18 > (dfl2 <- daisy(flower, type = list(asymm = c(1, 3), ordratio = 7))) Dissimilarities : 1 2 3 4 5 6 7 2 0.9007353 3 0.6176471 0.5882353 4 0.4226891 0.5455882 0.6403361 5 0.4806723 0.7369748 0.5264706 0.7605042 6 0.2823529 0.7470588 0.3911765 0.4764706 0.4980392 7 0.3310924 0.6983193 0.6676471 0.4109244 0.5745098 0.2764706 8 0.5100840 0.4544118 0.6789916 0.3327731 0.5705882 0.6563025 0.4932773 9 0.5808824 0.5084034 0.5252101 0.8257353 0.3882353 0.6100840 0.6756303 10 0.6323529 0.5067227 0.5235294 0.5522059 0.4722689 0.4739496 0.6941176 11 0.3389706 0.7117647 0.6014706 0.6588235 0.4066176 0.4919118 0.5742647 12 0.4441176 0.5816176 0.5963235 0.5139706 0.5264706 0.5220588 0.6544118 13 0.5286765 0.6252101 0.6420168 0.7735294 0.3336134 0.5504202 0.6159664 14 0.3044118 0.5963235 0.6110294 0.3742647 0.5411765 0.3573529 0.5147059 15 0.6242647 0.4588235 0.6184874 0.5691176 0.5386555 0.6025210 0.3823529 16 0.6845588 0.3831933 0.6857143 0.3147059 0.8344538 0.5504202 0.4848739 17 0.7897059 0.2176471 0.6630252 0.4198529 0.8117647 0.6705882 0.6050420 18 0.5268908 0.4647059 0.8336134 0.5210084 0.5537815 0.7588235 0.5386555 8 9 10 11 12 13 14 2 3 4 5 6 7 8 9 0.6595588 10 0.6639706 0.5126050 11 0.5073529 0.4419118 0.4066176 12 0.4272059 0.4367647 0.3867647 0.2698529 13 0.6073529 0.2596639 0.4529412 0.3647059 0.2595588 14 0.4669118 0.4514706 0.3720588 0.2845588 0.1647059 0.3992647 15 0.4720588 0.2932773 0.5050420 0.4897059 0.4448529 0.3764706 0.4448529 16 0.6058824 0.7319328 0.3621849 0.7235294 0.5786765 0.6722689 0.4389706 17 0.4610294 0.7092437 0.3394958 0.7036765 0.5588235 0.6495798 0.5441176 18 0.1882353 0.5198529 0.8286765 0.5470588 0.5669118 0.5823529 0.5816176 15 16 17 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 0.4386555 17 0.4159664 0.1655462 18 0.5117647 0.7705882 0.6257353 Metric : mixed ; Types = A, N, A, N, O, O, T, I Number of objects : 18 > (dfl3 <- daisy(flower, type = list(asymm = 1:3))) Dissimilarities : 1 2 3 4 5 6 7 2 0.8875408 3 0.6025677 0.5882353 4 0.4020542 0.6290850 0.6458917 5 0.4703548 0.7115780 0.4968410 0.7295518 6 0.2593371 0.7549953 0.4004357 0.4788515 0.4591503 7 0.3287115 0.7998911 0.6528322 0.4581155 0.5596950 0.2523965 8 0.4838936 0.5304388 0.6901027 0.3947168 0.5340803 0.6531279 0.5477124 9 0.5808824 0.4933240 0.5101307 0.8076797 0.3779178 0.5870682 0.6732493 10 0.6094363 0.5178338 0.5346405 0.5570670 0.4357610 0.4707750 0.6703081 11 0.3278595 0.7096814 0.5993873 0.6518791 0.3864788 0.4828840 0.5652369 12 0.4267565 0.5857843 0.6004902 0.5132761 0.5000817 0.5248366 0.6391340 13 0.5196487 0.5998133 0.6166200 0.7464461 0.3336134 0.5170868 0.6032680 14 0.2926062 0.5949346 0.6096405 0.3680147 0.5203431 0.3656863 0.5049837 15 0.6221814 0.5204793 0.6057890 0.6321662 0.5259570 0.5818861 0.4460784 16 0.6935866 0.4766885 0.7111111 0.3906162 0.8344538 0.5837535 0.5805011 17 0.7765114 0.2539216 0.6630252 0.4853875 0.7863679 0.6785247 0.6910675 18 0.5268908 0.5160131 0.8185341 0.5837691 0.5434641 0.7358077 0.6256536 8 9 10 11 12 13 14 2 3 4 5 6 7 8 9 0.6366422 10 0.6639706 0.4864146 11 0.4955474 0.4308007 0.3948121 12 0.4216503 0.4194036 0.3812092 0.2636029 13 0.5754085 0.2493464 0.4164332 0.3445670 0.2331699 14 0.4558007 0.4396650 0.3609477 0.2838644 0.1591503 0.3784314 15 0.5156863 0.2908964 0.4812325 0.4806781 0.4295752 0.3637722 0.4351307 16 0.7289449 0.7422502 0.3986928 0.7436683 0.6050654 0.6722689 0.4598039 17 0.5380019 0.6941643 0.3506069 0.7015931 0.5629902 0.6241830 0.5427288 18 0.1890523 0.5198529 0.8057598 0.5359477 0.5495507 0.5733252 0.5698121 15 16 17 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 0.5265795 17 0.4704793 0.2227669 18 0.5824930 0.8909897 0.7000467 Metric : mixed ; Types = A, A, A, N, O, O, I, I Number of objects : 18 > > ## --- animals > data(animals) > d0 <- daisy(animals) Warning message: In daisy(animals) : binary variable(s) 1, 2, 3, 4, 5, 6 treated as interval scaled > > d1 <- daisy(animals - 1, type=list(asymm=c(2,4))) Warning message: In daisy(animals - 1, type = list(asymm = c(2, 4))) : binary variable(s) 1, 3, 5, 6 treated as interval scaled > (d2 <- daisy(animals - 1, type=list(symm = c(1,3,5,6), asymm=c(2,4)))) Dissimilarities : ant bee cat cpl chi cow duc bee 0.4000000 cat 1.0000000 0.8000000 cpl 0.5000000 0.4000000 0.5000000 chi 0.8000000 0.6666667 0.4000000 0.8000000 cow 0.7500000 0.6000000 0.2500000 0.7500000 0.2000000 duc 0.6000000 0.6000000 0.6000000 1.0000000 0.5000000 0.4000000 eag 0.8333333 0.8333333 0.5000000 0.8333333 0.5000000 0.6666667 0.3333333 ele 0.6000000 0.8333333 0.6000000 1.0000000 0.2000000 0.4000000 0.3333333 fly 0.4000000 0.4000000 0.8000000 0.4000000 1.0000000 1.0000000 0.6000000 fro 0.5000000 0.8000000 0.7500000 0.7500000 0.5000000 0.7500000 0.6000000 her 0.2500000 0.6000000 0.7500000 0.7500000 0.6000000 0.5000000 0.4000000 lio 0.7500000 0.6000000 0.2500000 0.7500000 0.0000000 0.0000000 0.4000000 liz 0.5000000 0.8000000 0.5000000 0.5000000 0.8000000 0.7500000 0.6000000 lob 0.0000000 0.5000000 1.0000000 0.3333333 1.0000000 1.0000000 0.7500000 man 0.8000000 0.6666667 0.4000000 0.8000000 0.0000000 0.2000000 0.5000000 rab 0.7500000 0.6000000 0.2500000 0.7500000 0.2000000 0.0000000 0.4000000 sal 0.3333333 0.7500000 0.6666667 0.6666667 0.7500000 0.6666667 0.5000000 spi 0.5000000 0.4000000 0.5000000 0.0000000 0.7500000 0.7500000 1.0000000 wha 0.6000000 0.8333333 0.6000000 1.0000000 0.2000000 0.4000000 0.3333333 eag ele fly fro her lio liz bee cat cpl chi cow duc eag ele 0.3333333 fly 0.5000000 0.8333333 fro 0.4000000 0.2500000 0.6000000 her 0.6666667 0.4000000 0.6000000 0.2500000 lio 0.6000000 0.2500000 1.0000000 0.6666667 0.5000000 liz 0.5000000 0.6000000 0.4000000 0.2500000 0.2500000 0.7500000 lob 0.8000000 0.7500000 0.2500000 0.5000000 0.3333333 1.0000000 0.3333333 man 0.5000000 0.2000000 1.0000000 0.5000000 0.6000000 0.0000000 0.8000000 rab 0.6666667 0.4000000 1.0000000 0.7500000 0.5000000 0.0000000 0.7500000 sal 0.6000000 0.5000000 0.5000000 0.2500000 0.0000000 0.6666667 0.0000000 spi 0.8000000 1.0000000 0.4000000 0.6666667 0.7500000 0.7500000 0.5000000 wha 0.3333333 0.0000000 0.8333333 0.2500000 0.4000000 0.2500000 0.6000000 lob man rab sal spi bee cat cpl chi cow duc eag ele fly fro her lio liz lob man 1.0000000 rab 1.0000000 0.2000000 sal 0.3333333 0.7500000 0.6666667 spi 0.3333333 0.7500000 0.7500000 0.6666667 wha 0.7500000 0.2000000 0.4000000 0.5000000 1.0000000 Metric : mixed ; Types = S, A, S, A, S, S Number of objects : 20 > stopifnot(c(d1) == c(d2)) > > d3 <- daisy(2 - animals, type=list(asymm=c(2,4))) Warning message: In daisy(2 - animals, type = list(asymm = c(2, 4))) : binary variable(s) 1, 3, 5, 6 treated as interval scaled > (d4 <- daisy(2 - animals, type=list(symm = c(1,3,5,6), asymm=c(2,4)))) Dissimilarities : ant bee cat cpl chi cow duc bee 0.3333333 cat 0.6666667 0.6666667 cpl 0.3333333 0.3333333 0.3333333 chi 0.6666667 0.6666667 0.3333333 0.6666667 cow 0.5000000 0.5000000 0.1666667 0.5000000 0.1666667 duc 0.5000000 0.6000000 0.5000000 0.8333333 0.5000000 0.3333333 eag 0.8333333 1.0000000 0.5000000 0.8333333 0.6000000 0.6666667 0.4000000 ele 0.5000000 0.8333333 0.5000000 0.8333333 0.2000000 0.3333333 0.3333333 fly 0.3333333 0.4000000 0.6666667 0.3333333 1.0000000 0.8333333 0.6000000 fro 0.4000000 0.8000000 0.6000000 0.6000000 0.5000000 0.6000000 0.6000000 her 0.1666667 0.5000000 0.5000000 0.5000000 0.5000000 0.3333333 0.3333333 lio 0.6000000 0.6000000 0.2000000 0.6000000 0.0000000 0.0000000 0.4000000 liz 0.3333333 0.6666667 0.3333333 0.3333333 0.6666667 0.5000000 0.5000000 lob 0.0000000 0.4000000 0.6000000 0.2000000 0.8000000 0.6000000 0.6000000 man 0.6666667 0.6666667 0.3333333 0.6666667 0.0000000 0.1666667 0.5000000 rab 0.5000000 0.5000000 0.1666667 0.5000000 0.1666667 0.0000000 0.3333333 sal 0.2000000 0.6000000 0.4000000 0.4000000 0.6000000 0.4000000 0.4000000 spi 0.4000000 0.4000000 0.4000000 0.0000000 0.6000000 0.6000000 1.0000000 wha 0.5000000 0.8333333 0.5000000 0.8333333 0.2000000 0.3333333 0.3333333 eag ele fly fro her lio liz bee cat cpl chi cow duc eag ele 0.4000000 fly 0.6000000 0.8333333 fro 0.5000000 0.2500000 0.6000000 her 0.6666667 0.3333333 0.5000000 0.2000000 lio 0.6000000 0.2000000 1.0000000 0.5000000 0.4000000 liz 0.5000000 0.5000000 0.3333333 0.2000000 0.1666667 0.6000000 lob 0.8000000 0.6000000 0.2000000 0.4000000 0.2000000 0.7500000 0.2000000 man 0.6000000 0.2000000 1.0000000 0.5000000 0.5000000 0.0000000 0.6666667 rab 0.6666667 0.3333333 0.8333333 0.6000000 0.3333333 0.0000000 0.5000000 sal 0.6000000 0.4000000 0.4000000 0.2000000 0.0000000 0.5000000 0.0000000 spi 0.8000000 0.8000000 0.4000000 0.5000000 0.6000000 0.6000000 0.4000000 wha 0.4000000 0.0000000 0.8333333 0.2500000 0.3333333 0.2000000 0.5000000 lob man rab sal spi bee cat cpl chi cow duc eag ele fly fro her lio liz lob man 0.8000000 rab 0.6000000 0.1666667 sal 0.2000000 0.6000000 0.4000000 spi 0.2500000 0.6000000 0.6000000 0.5000000 wha 0.6000000 0.2000000 0.3333333 0.4000000 0.8000000 Metric : mixed ; Types = S, A, S, A, S, S Number of objects : 20 > stopifnot(c(d3) == c(d4)) > > pairs(cbind(d0,d2,d4), + main = "Animals -- symmetric and asymm. dissimilarities") > > proc.time() user system elapsed 0.518 0.113 0.905 cluster/tests/clusplot-out.Rout.save0000644000176200001440000000623513257174710017374 0ustar liggesusers R version 3.5.0 alpha (2018-03-28 r74481) Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) 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. > library(cluster) > > ### clusplot() & pam() RESULT checking ... > > ## plotting votes.diss(dissimilarity) in a bivariate plot and > ## partitioning into 2 clusters > data(votes.repub) > votes.diss <- daisy(votes.repub) > for(k in 2:4) { + votes.clus <- pam(votes.diss, k, diss = TRUE)$clustering + print(clusplot(votes.diss, votes.clus, diss = TRUE, shade = TRUE)) + } $Distances [,1] [,2] [1,] 0.0000 154.8601 [2,] 154.8601 0.0000 $Shading [1] 22.12103 20.87897 $Distances [,1] [,2] [,3] [1,] 0.0000 NA 140.8008 [2,] NA 0 NA [3,] 140.8008 NA 0.0000 $Shading [1] 25.602967 5.292663 15.104370 $Distances [,1] [,2] [,3] [,4] [1,] 0.0000 NA 117.2287 280.7259 [2,] NA 0 NA NA [3,] 117.2287 NA 0.0000 NA [4,] 280.7259 NA NA 0.0000 $Shading [1] 15.431339 3.980743 10.145454 19.442464 > > ## plotting iris (dataframe) in a 2-dimensional plot and partitioning > ## into 3 clusters. > data(iris) > iris.x <- iris[, 1:4] > > for(k in 2:5) + print(clusplot(iris.x, pam(iris.x, k)$clustering, diss = FALSE)) $Distances [,1] [,2] [1,] 0.0000000 0.5452161 [2,] 0.5452161 0.0000000 $Shading [1] 18.93861 24.06139 $Distances [,1] [,2] [,3] [1,] 0.000000 1.433071 2.851715 [2,] 1.433071 0.000000 NA [3,] 2.851715 NA 0.000000 $Shading [1] 18.987588 17.166940 9.845472 $Distances [,1] [,2] [,3] [,4] [1,] 0.000000 2.24157 1.6340329 3.0945887 [2,] 2.241570 0.00000 NA NA [3,] 1.634033 NA 0.0000000 0.9461858 [4,] 3.094589 NA 0.9461858 0.0000000 $Shading [1] 12.881766 14.912379 13.652381 7.553474 $Distances [,1] [,2] [,3] [,4] [,5] [1,] 0.000000 1.9899160 1.552387 3.11516148 3.96536391 [2,] 1.989916 0.0000000 NA NA 0.94713417 [3,] 1.552387 NA 0.000000 1.17348334 2.22769309 [4,] 3.115161 NA 1.173483 0.00000000 0.04539385 [5,] 3.965364 0.9471342 2.227693 0.04539385 0.00000000 $Shading [1] 10.369738 11.560147 10.088431 14.857590 5.124093 > > > .Random.seed <- c(0L,rep(7654L,3)) > ## generate 25 objects, divided into 2 clusters. > x <- rbind(cbind(rnorm(10,0,0.5), rnorm(10,0,0.5)), + cbind(rnorm(15,5,0.5), rnorm(15,5,0.5))) > print.default(clusplot(px2 <- pam(x, 2))) $Distances [,1] [,2] [1,] 0.000000 5.516876 [2,] 5.516876 0.000000 $Shading [1] 20.18314 22.81686 > > clusplot(px2, labels = 2, col.p = 1 + px2$clustering) > > proc.time() user system elapsed 0.320 0.070 0.449 cluster/tests/clara-NAs.R0000644000176200001440000000564114532110372014765 0ustar liggesuserslibrary(cluster) x <- cbind(c(0, -4, -22, -14, 0, NA, -28, 1, 10, -1, 100 + c(13, 0, 2, 4, 7, 8, 1)), c(-5, -14, NA, -35, -30, NA, 7, 2, -18, 13, 47, 64, 48, NA, NA, 44, 65)) x (d <- dist(x,'manhattan')) summary(d, na.rm = TRUE) # max = 270 ## First call with "trace" (seg.fault typically later ...): try( clara(x, k=2, metric="manhattan", sampsize=10, trace = 3) ) ## Originally:already shows the problem: nbest[] = c(0,0,...,0) must be WRONG!! ## Now: gives the proper error message. ## S-plus 6.1.2 (rel.2 for Linux, 2002) gives ##> cc <- clara(x, k=2, metric="manhattan", samples=2, sampsize=10) ## Problem in .Fortran("clara",: Internal error: data for decrementing ## ref.count didn't point to a valid arena (0x0), while calling subroutine clara ## The large example from clara.R -- made small enough to still provoke ## the "** dysta2() ... OUT" problem {no longer!} x <- matrix(c(0, 3, -4, 62, 1, 3, -7, 45, 36, 46, 45, 54, -10, 51, 49, -5, 13, -6, 49, 52, 57, 39, -1, 55, 68, -3, 51, 11, NA, 9, -3, 50, NA, 58, 9, 52, 12, NA, 47, -12, -6, -9, 5, 30, 38, 54, -5, 39, 50, 50, 54, 43, 7, 64, 55, 4, 0, 72, 54, 37, 59, -1, 8, 43, 50, -2, 56, -8, 43, 6, 4, 48, -2, 14, 45, 49, 56, 51, 45, 11, 10, 42, 50, 2, -12, 3, 1, 2, 2, -14, -4, 8, 0, 3, -11, 8, 5, 14, -1, 9, 0, 19, 10, -2, -9, 9, 2, 16, 10, 4, 1, 12, 7, -4, 27, -8, -9, -9, 2, 8, NA, 13, -23, -3, -5, 1, 15, -3, 5, -9, -5, 14, 8, 7, -4, 26, 20, 10, 8, 17, 4, 14, 23, -2, 23, 2, 16, 5, 5, -3, 12, 5, 14, -2, 4, 2, -2, 7, 9, 1, -15, -1, 9, 23, 1, 7, 13, 2, -11, 16, 12, -11, -14, 2, 6, -8), ncol = 2) str(x) # 88 x 2 try(clara(x, 2, samples = 20, trace = 3))# 2nd sample did show dysta2() problem ## To see error message for > 1 missing: try(clara(rbind(NA,x), 2)) x <- x[-33,] ## still had the ** dysta2() .. OUT" problem {no longer!} c2 <- clara(x, 2, samples = 12, trace = 3) c2. <- clara(x, 2, samples = 12, trace = 1, correct.d=TRUE) p2g <- pam(daisy(x,"gower"), k=2, trace = 3) if(FALSE) { ## disabled clara(*, "gower") for now (2023-11-30): c2g <- clara(x, 2, samples = 12, sampsize=nrow(x), trace = 2, metric = "gower", pamLike=TRUE, correct.d=TRUE) (icall <- which(names(c2) == "call")) ## c2g and p2g are *quite* different ! table(c2g$clustering, p2g$clustering) ## 1 2 ## 1 40 32 ## 2 15 0 << not *one* pair of {2,2} !?! stopifnot(exprs = { all.equal(c2[-icall], c2.[-icall]) }) }# no "gower" for now data(xclara) suppressWarnings(RNGversion("3.5.0")) # back compatibility of results set.seed(123) xclara[sample(nrow(xclara), 50),] <- NA try( clara(xclara, k = 3) ) #-> "nice" error message {.. first 12 missing obs} : ## Error in clara(xclara, k = 3) : ## 50 observations (74,126,137,308,411,423,438,451,642,686,689,735 ...) have *only* NAs ## --> omit them for clustering! cluster/tests/agnes-ex.R0000644000176200001440000000624214764134052014741 0ustar liggesuserslibrary(cluster) options(digits = 6) data(votes.repub) ## IGNORE_RDIFF_BEGIN source(system.file("test-tools.R", package = "cluster"), keep.source = FALSE) ## IGNORE_RDIFF_END ## -> showProc.time() ... & doExtras agn1 <- agnes(votes.repub, metric = "manhattan", stand = TRUE) summary(agn1) Dvr <- daisy(votes.repub) agn2 <- agnes(Dvr, method = "complete") summary(agn2) ## almost same: (ag2. <- agnes(Dvr, method= "complete", keep.diss=FALSE)) ag22 <- agnes(votes.repub, method= "complete", keep.diss=FALSE,keep.data=FALSE) stopifnot(identical(agn2[-5:-6], ag2.[-5:-6]), identical(Dvr, daisy(votes.repub)), # DUP=FALSE (!) identical(ag2.[-6], ag22[-6]) ) data(agriculture) summary(agnes(agriculture)) data(ruspini) summary(ar0 <- agnes(ruspini, keep.diss=FALSE, keep.data=FALSE)) summary(ar1 <- agnes(ruspini, metric = "manhattan")) str(ar1) showProc.time() summary(ar2 <- agnes(ruspini, metric="manhattan", method = "weighted")) print (ar3 <- agnes(ruspini, metric="manhattan", method = "flexible", par.method = 0.5)) stopifnot(all.equal(ar2[1:4], ar3[1:4], tol=1e-12)) showProc.time() ## Small example, testing "flexible" vs "single" i8 <- -c(1:2, 9:10) dim(agr8 <- agriculture[i8, ]) i5 <- -c(1:2, 8:12) dim(agr5 <- agriculture[i5, ]) ##' Check equivalence of method "flexible" (par=...) with one ##' of ("single", "complete", "weighted") chk <- function(d, method=c("single", "complete", "weighted"), trace.lev = 1, iC = -(6:7), # <- not using 'call' and 'method' for comparisons doplot = FALSE, tol = 1e-12) { if(!inherits(d, "dist")) d <- daisy(d, "manhattan") method <- match.arg(method) par.meth <- list("single" = c(.5, .5, 0, -.5), "complete"= c(.5, .5, 0, +.5), "weighted"= c(0.5)) a.s <- agnes(d, method=method, trace.lev=trace.lev) ## From theory, this should give the same, but it does not --- why ??? a.f <- agnes(d, method="flex", par.method = par.meth[[method]], trace.lev=trace.lev) if(doplot) { op <- par(mfrow = c(2,2), mgp = c(1.6, 0.6, 0), mar = .1 + c(4,4,2,1)) on.exit(par(op)) plot(a.s) plot(a.f) } structure(all.equal(a.s[iC], a.f[iC], tolerance = tol), fits = list(s = a.s, f = a.f)) } chk(agr5, trace = 3) stopifnot(chk(agr5), chk(agr5, "complete", trace = 2), chk(agr5, "weighted"), chk(agr8), chk(agr8, "complete"), chk(agr8, "weighted", trace.lev=2), chk(agriculture), chk(agriculture, "complete"), chk(ruspini), chk(ruspini, "complete"), chk(ruspini, "weighted")) showProc.time() ## an invalid "flexible" case - now must give error early: x <- rbind(c( -6, -9), c( 0, 13), c(-15, 6), c(-14, 0), c(12,-10)) (dx <- daisy(x, "manhattan")) a.x <- tryCatch(agnes(dx, method="flexible", par = -.2), error = function(e)e) ## agnes(method=6, par.method=*) lead to invalid merge; step 4, D(.,.)=-26.1216 if(!inherits(a.x, "error")) stop("invalid 'par' in \"flexible\" did not give error") if(!all(vapply(c("par[.]method", "merge"), grepl, NA, x=a.x$message))) stop("error message did not contain expected words") cluster/tests/silhouette-default.Rout.save0000644000176200001440000004660414402062116020522 0ustar liggesusers R Under development (unstable) (2023-03-07 r83950) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) 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 came from a bug report on R-help by ge yreyt > ## Date: Mon, 9 Jun 2003 16:06:53 -0400 (EDT) > library(cluster) > if(FALSE) # manual testing + library(cluster, lib="~/R/Pkgs/cluster.Rcheck") > > data(iris) > > .proctime00 <- proc.time() > > mdist <- as.dist(1 - cor(t(iris[,1:4])))#dissimlarity > ## this is always the same: > hc <- diana(mdist, diss = TRUE, stand = FALSE) > > maxk <- 15 # at most 15 clusters > silh.wid <- numeric(maxk) # myind[k] := the silh.value for k clusters > silh.wid[1] <- NA # 1-cluster: silhouette not defined > > op <- par(mfrow = c(4,4), mar = .1+ c(2,1,2,1), mgp=c(1.5, .6,0)) > for(k in 2:maxk) { + cat("\n", k,":\n==\n") + k.gr <- cutree(as.hclust(hc), k = k) + cat("grouping table: "); print(table(k.gr)) + si <- silhouette(k.gr, mdist) + cat("silhouette:\n"); print(summary(si)) + plot(si, main = paste("k =",k), + col = 2:(k+1), do.n.k=FALSE, do.clus.stat=FALSE) + silh.wid[k] <- summary(si)$avg.width + ## === + } 2 : == grouping table: k.gr 1 2 50 100 silhouette: Silhouette of 150 units in 2 clusters from silhouette.default(x = k.gr, dist = mdist) : Cluster sizes and average silhouette widths: 50 100 0.9829965 0.9362626 Individual silhouette widths: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.5884 0.9437 0.9611 0.9518 0.9815 0.9918 3 : == grouping table: k.gr 1 2 3 50 50 50 silhouette: Silhouette of 150 units in 3 clusters from silhouette.default(x = k.gr, dist = mdist) : Cluster sizes and average silhouette widths: 50 50 50 0.9773277 0.6926798 0.7467236 Individual silhouette widths: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.03353 0.76937 0.86121 0.80558 0.97564 0.98919 4 : == grouping table: k.gr 1 2 3 4 35 15 50 50 silhouette: Silhouette of 150 units in 4 clusters from silhouette.default(x = k.gr, dist = mdist) : Cluster sizes and average silhouette widths: 35 15 50 50 0.5653722 0.5226372 0.6926798 0.7467236 Individual silhouette widths: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.03353 0.56621 0.75102 0.66399 0.84240 0.89390 5 : == grouping table: k.gr 1 2 3 4 5 35 15 29 21 50 silhouette: Silhouette of 150 units in 5 clusters from silhouette.default(x = k.gr, dist = mdist) : Cluster sizes and average silhouette widths: 35 15 29 21 50 0.5653722 0.5226372 0.5776362 0.4625437 0.5296735 Individual silhouette widths: Min. 1st Qu. Median Mean 3rd Qu. Max. -0.5404 0.3937 0.6252 0.5372 0.7392 0.8136 6 : == grouping table: k.gr 1 2 3 4 5 6 35 15 29 21 29 21 silhouette: Silhouette of 150 units in 6 clusters from silhouette.default(x = k.gr, dist = mdist) : Cluster sizes and average silhouette widths: 35 15 29 21 29 21 0.5653722 0.5226372 0.5776362 0.3732981 0.3383135 0.5945444 Individual silhouette widths: Min. 1st Qu. Median Mean 3rd Qu. Max. -0.1094 0.3351 0.5257 0.4968 0.6938 0.8136 7 : == grouping table: k.gr 1 2 3 4 5 6 7 35 14 1 29 21 29 21 silhouette: Silhouette of 150 units in 7 clusters from silhouette.default(x = k.gr, dist = mdist) : Cluster sizes and average silhouette widths: 35 14 1 29 21 29 21 0.4165289 0.6671435 0.0000000 0.5776362 0.3732981 0.3383135 0.5945444 Individual silhouette widths: Min. 1st Qu. Median Mean 3rd Qu. Max. -0.3264 0.3001 0.5234 0.4720 0.6970 0.8301 8 : == grouping table: k.gr 1 2 3 4 5 6 7 8 35 14 1 29 10 11 29 21 silhouette: Silhouette of 150 units in 8 clusters from silhouette.default(x = k.gr, dist = mdist) : Cluster sizes and average silhouette widths: 35 14 1 29 10 11 29 21 0.4165289 0.6671435 0.0000000 0.4209012 0.6943265 0.7262601 0.2053018 0.5945444 Individual silhouette widths: Min. 1st Qu. Median Mean 3rd Qu. Max. -0.6258 0.2576 0.5842 0.4633 0.7132 0.8887 9 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 35 14 1 26 10 11 3 29 21 silhouette: Silhouette of 150 units in 9 clusters from silhouette.default(x = k.gr, dist = mdist) : Cluster sizes and average silhouette widths: 35 14 1 26 10 11 3 29 0.4165289 0.6671435 0.0000000 0.5318152 0.6673269 0.6944652 0.7957279 0.2053018 21 0.5945444 Individual silhouette widths: Min. 1st Qu. Median Mean 3rd Qu. Max. -0.6258 0.3150 0.5896 0.4859 0.7263 0.8870 10 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 35 14 1 26 10 11 3 16 13 21 silhouette: Silhouette of 150 units in 10 clusters from silhouette.default(x = k.gr, dist = mdist) : Cluster sizes and average silhouette widths: 35 14 1 26 10 11 3 16 0.4165289 0.6671435 0.0000000 0.5318152 0.6319149 0.6145837 0.7957279 0.4640123 13 21 0.6615431 0.4228530 Individual silhouette widths: Min. 1st Qu. Median Mean 3rd Qu. Max. -0.5870 0.3535 0.6068 0.5208 0.7349 0.8803 11 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 35 14 1 26 10 11 3 16 13 11 10 silhouette: Silhouette of 150 units in 11 clusters from silhouette.default(x = k.gr, dist = mdist) : Cluster sizes and average silhouette widths: 35 14 1 26 10 11 3 16 0.4165289 0.6671435 0.0000000 0.5318152 0.6319149 0.6145837 0.7957279 0.4064279 13 11 10 0.5866228 0.4297258 0.6590274 Individual silhouette widths: Min. 1st Qu. Median Mean 3rd Qu. Max. -0.3264 0.3730 0.5984 0.5244 0.7302 0.8505 12 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 35 11 3 1 26 10 11 3 16 13 11 10 silhouette: Silhouette of 150 units in 12 clusters from silhouette.default(x = k.gr, dist = mdist) : Cluster sizes and average silhouette widths: 35 11 3 1 26 10 11 3 0.2883758 0.7044155 0.4092330 0.0000000 0.5318152 0.6319149 0.6145837 0.7957279 16 13 11 10 0.4064279 0.5866228 0.4297258 0.6590274 Individual silhouette widths: Min. 1st Qu. Median Mean 3rd Qu. Max. -0.6007 0.3395 0.5817 0.4921 0.7216 0.8700 13 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 28 11 3 7 1 26 10 11 3 16 13 11 10 silhouette: Silhouette of 150 units in 13 clusters from silhouette.default(x = k.gr, dist = mdist) : Cluster sizes and average silhouette widths: 28 11 3 7 1 26 10 11 0.3783869 0.6827810 0.4092330 0.4285753 0.0000000 0.5318152 0.6319149 0.6145837 3 16 13 11 10 0.7957279 0.4064279 0.5866228 0.4297258 0.6590274 Individual silhouette widths: Min. 1st Qu. Median Mean 3rd Qu. Max. -0.4013 0.3314 0.5704 0.5138 0.7274 0.8531 14 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 19 11 3 9 7 1 26 10 11 3 16 13 11 10 silhouette: Silhouette of 150 units in 14 clusters from silhouette.default(x = k.gr, dist = mdist) : Cluster sizes and average silhouette widths: 19 11 3 9 7 1 26 10 0.5419530 0.6171802 0.3959926 0.4525348 0.1669077 0.0000000 0.5318152 0.6319149 11 3 16 13 11 10 0.6145837 0.7957279 0.4064279 0.5866228 0.4297258 0.6590274 Individual silhouette widths: Min. 1st Qu. Median Mean 3rd Qu. Max. -0.5929 0.3795 0.5875 0.5217 0.7263 0.8505 15 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 19 11 3 9 7 1 18 10 11 8 3 16 13 11 10 silhouette: Silhouette of 150 units in 15 clusters from silhouette.default(x = k.gr, dist = mdist) : Cluster sizes and average silhouette widths: 19 11 3 9 7 1 18 10 0.5419530 0.6171802 0.3959926 0.4525348 0.1669077 0.0000000 0.6616381 0.5871805 11 8 3 16 13 11 10 0.5171407 0.6705138 0.7444822 0.4064279 0.5866228 0.4297258 0.6590274 Individual silhouette widths: Min. 1st Qu. Median Mean 3rd Qu. Max. -0.5929 0.3859 0.6211 0.5335 0.7478 0.8551 > par(op) > > summary(si.p <- silhouette(50 - k.gr, mdist)) Silhouette of 150 units in 15 clusters from silhouette.default(x = 50 - k.gr, dist = mdist) : Cluster sizes, ids = (35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49), and average silhouette widths: 10 11 13 16 3 8 11 10 0.6590274 0.4297258 0.5866228 0.4064279 0.7444822 0.6705138 0.5171407 0.5871805 18 1 7 9 3 11 19 0.6616381 0.0000000 0.1669077 0.4525348 0.3959926 0.6171802 0.5419530 Individual silhouette widths: Min. 1st Qu. Median Mean 3rd Qu. Max. -0.5929 0.3859 0.6211 0.5335 0.7478 0.8551 > stopifnot(identical(si.p[,3], si[,3]), + identical(si.p[, 1:2], 50 - si[, 1:2])) > > # the widths: > silh.wid [1] NA 0.9518406 0.8055770 0.6639850 0.5371742 0.4967654 0.4720384 [8] 0.4633064 0.4858965 0.5207776 0.5243911 0.4920638 0.5138220 0.5217026 [15] 0.5335255 > #select the number of k clusters with the largest si value : > (myk <- which.min(silh.wid)) # -> 8 (here) [1] 8 > > postscript(file="silhouette-ex.ps") > ## MM: plot to see how the decision is made > plot(silh.wid, type = 'b', col= "blue", xlab = "k") > axis(1, at=myk, col.axis= "red", font.axis= 2) > > ##--- PAM()'s silhouette should give same as silh*.default()! > Eq <- function(x,y, tol = 1e-12) x == y | abs(x - y) < tol * abs((x+y)/2) > > for(k in 2:40) { + cat("\n", k,":\n==\n") + p.k <- pam(mdist, k = k) + k.gr <- p.k$clustering + si.p <- silhouette(p.k) + si.g <- silhouette(k.gr, mdist) + ## since the obs.order may differ (within cluster): + si.g <- si.g[ as.integer(rownames(si.p)), ] + cat("grouping table: "); print(table(k.gr)) + if(!isTRUE(all.equal(c(si.g), c(si.p)))) { + cat("silhouettes differ:") + if(any(neq <- !Eq(si.g[,3], si.p[,3]))) { + cat("\n") + print( cbind(si.p[], si.g[,2:3])[ neq, ] ) + } else cat(" -- but not in col.3 !\n") + } + } 2 : == grouping table: k.gr 1 2 50 100 3 : == grouping table: k.gr 1 2 3 50 50 50 4 : == grouping table: k.gr 1 2 3 4 50 43 37 20 5 : == grouping table: k.gr 1 2 3 4 5 50 25 35 20 20 6 : == grouping table: k.gr 1 2 3 4 5 6 33 17 25 35 20 20 7 : == grouping table: k.gr 1 2 3 4 5 6 7 33 17 17 14 18 31 20 8 : == grouping table: k.gr 1 2 3 4 5 6 7 8 21 13 16 17 14 18 31 20 9 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 21 13 16 12 20 11 19 17 21 10 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 21 13 16 18 10 15 14 7 16 20 11 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 21 13 16 19 10 14 7 6 15 13 16 12 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 21 13 16 17 10 12 9 3 5 15 13 16 13 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 21 12 16 1 18 11 12 9 3 15 13 4 15 14 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 20 10 7 13 18 10 12 9 3 7 10 13 4 14 15 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 20 11 5 13 1 18 10 12 9 3 7 10 13 4 14 16 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 20 11 5 13 1 12 8 9 11 9 3 7 10 13 4 14 17 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 20 11 5 13 1 12 8 7 9 10 3 3 9 13 4 13 9 18 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 20 11 5 9 4 1 12 8 7 9 10 3 3 9 13 4 13 9 19 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 11 5 9 4 1 10 8 8 9 8 3 3 9 13 3 4 13 9 20 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 20 11 5 9 4 1 10 8 8 9 8 3 3 9 12 3 4 6 9 8 21 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 20 11 5 9 4 1 10 8 8 7 8 3 3 7 11 3 4 6 9 8 5 22 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 9 11 5 9 11 4 1 10 8 8 7 8 3 3 7 11 3 4 6 9 8 5 23 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 9 11 5 9 11 4 1 10 8 8 7 8 3 3 7 11 3 4 6 8 8 5 1 24 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 15 10 5 10 3 3 3 1 10 8 8 7 8 3 3 7 11 3 4 6 8 8 5 1 25 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 8 4 5 9 11 7 2 3 1 10 8 8 7 8 3 3 7 11 3 4 6 8 8 5 1 26 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 8 4 5 9 11 7 2 3 1 10 8 8 7 8 3 3 7 7 3 4 6 8 8 4 5 1 27 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 8 4 5 9 11 7 2 3 1 10 8 7 7 8 3 2 7 7 3 2 4 6 8 8 4 5 27 1 28 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 8 4 4 9 11 7 2 3 1 1 10 8 7 7 8 3 2 7 7 3 2 4 6 8 8 4 27 28 5 1 29 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 8 4 4 9 11 7 2 3 1 1 10 8 7 7 8 2 2 7 7 3 2 1 4 6 8 8 27 28 29 4 5 1 30 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 8 4 11 10 6 3 2 3 1 1 1 10 8 7 7 8 2 2 7 7 3 2 1 4 6 8 27 28 29 30 8 4 5 1 31 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 8 4 11 10 6 3 2 3 1 1 1 10 8 7 7 8 2 2 7 7 3 2 1 4 6 7 27 28 29 30 31 7 4 5 1 2 32 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 7 4 3 10 10 6 2 2 3 1 1 1 10 8 7 7 8 2 2 7 7 3 2 1 4 6 27 28 29 30 31 32 7 7 4 5 1 2 33 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 7 4 3 10 10 6 2 2 3 1 1 1 10 8 7 7 8 2 2 7 7 3 2 1 1 6 27 28 29 30 31 32 33 7 3 7 4 5 1 2 34 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 7 4 3 8 9 6 2 3 3 1 1 2 1 10 8 7 7 8 2 2 7 7 3 2 1 1 27 28 29 30 31 32 33 34 6 7 3 7 4 5 1 2 35 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 7 4 3 8 9 6 2 3 3 1 1 2 1 10 8 7 7 8 2 2 5 7 3 2 1 1 27 28 29 30 31 32 33 34 35 6 5 3 7 4 4 5 1 2 36 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 7 4 3 8 9 6 2 3 3 1 1 2 1 10 8 7 6 8 2 2 5 7 1 3 2 1 27 28 29 30 31 32 33 34 35 36 1 6 5 3 7 4 4 5 1 2 37 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 7 4 3 8 9 6 2 3 3 1 1 2 1 10 8 3 5 6 8 2 2 5 7 1 3 2 27 28 29 30 31 32 33 34 35 36 37 1 1 6 5 3 7 4 5 1 3 2 38 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 7 4 3 8 9 6 2 3 3 1 1 2 1 10 8 3 5 6 5 2 2 5 3 7 1 3 27 28 29 30 31 32 33 34 35 36 37 38 2 1 1 6 5 3 7 4 5 1 3 2 39 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 7 4 3 8 9 6 2 3 3 1 1 2 1 7 3 8 3 5 6 5 2 2 5 3 7 1 27 28 29 30 31 32 33 34 35 36 37 38 39 3 2 1 1 6 5 3 7 4 5 1 3 2 40 : == grouping table: k.gr 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 5 4 3 7 10 6 2 2 3 3 1 1 2 1 7 3 8 3 5 6 5 2 2 5 3 7 27 28 29 30 31 32 33 34 35 36 37 38 39 40 1 3 2 1 1 6 5 3 7 4 5 1 3 2 > > > ## "pathological" case where a_i == b_i == 0 : > D6 <- structure(c(0, 0, 0, 0.4, 1, 0.05, 1, 1, 0, 1, 1, 0, 0.25, 1, 1), + Labels = LETTERS[1:6], Size = 6, call = as.name("manually"), + class = "dist", Diag = FALSE, Upper = FALSE) > D6 A B C D E B 0.00 C 0.00 0.05 D 0.00 1.00 1.00 E 0.40 1.00 1.00 0.25 F 1.00 0.00 0.00 1.00 1.00 > kl6 <- c(1,1, 2,2, 3,3) > (skD6 <- silhouette(kl6, D6))# had one NaN cluster neighbor sil_width [1,] 1 2 0.000 [2,] 1 3 1.000 [3,] 2 1 -0.975 [4,] 2 1 -0.500 [5,] 3 2 -0.375 [6,] 3 1 -0.500 attr(,"Ordered") [1] FALSE attr(,"call") silhouette.default(x = kl6, dist = D6) attr(,"class") [1] "silhouette" > summary(skD6) Silhouette of 6 units in 3 clusters from silhouette.default(x = kl6, dist = D6) : Cluster sizes and average silhouette widths: 2 2 2 0.5000 -0.7375 -0.4375 Individual silhouette widths: Min. 1st Qu. Median Mean 3rd Qu. Max. -0.97500 -0.50000 -0.43750 -0.22500 -0.09375 1.00000 > plot(silhouette(kl6, D6))# gives error in earlier cluster versions > dev.off() pdf 2 > > ## checking compatibility with R-only version > silhouetteR <- asNamespace("cluster")$silhouetteR > noCall <- function(si) `attr<-`(si, "call", NULL) # only 'call' is different: > stopifnot(all.equal(noCall(skD6), noCall(silhouetteR(kl6, D6)))) > > ## k=1 : pam(*, k=1) works, but silhouette() is not defined; > ## --- FIXME: silhouette.partition() fails: "invalid partition .."; (which is not strictly true > ## ------ -> give something like NA ((or a *different* error message) > ## the other methods just give NA (no object!) > ## drop "call" *and* "iOrd" > noCliO <- function(si) noCall(`attr<-`(si, "iOrd", NULL)) > for(k in 2:7) { + p.k <- pam(ruspini, k=k) + ## order the silhouette to be *as* the default: + ## spk <- silhouette(p.k); opk <- spk[order(as.numeric(rownames(spk))), ] + ## rather sort*() the other: + stopifnot(all.equal(noCall(silhouette(p.k)), + noCliO(sortSilhouette(silhouetteR(p.k$clustering, p.k$diss))))) + } > > ## Last Line: > cat('Time elapsed: ', proc.time() - .proctime00,'\n') Time elapsed: 1.607 0.036 1.651 0 0 > > > proc.time() user system elapsed 1.722 0.084 1.859 cluster/tests/clara-NAs.Rout.save0000644000176200001440000007760514532110372016463 0ustar liggesusers R Under development (unstable) (2023-11-29 r85646) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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. > library(cluster) > > x <- cbind(c(0, -4, -22, -14, 0, NA, -28, 1, 10, -1, + 100 + c(13, 0, 2, 4, 7, 8, 1)), + c(-5, -14, NA, -35, -30, NA, 7, 2, -18, 13, + 47, 64, 48, NA, NA, 44, 65)) > x [,1] [,2] [1,] 0 -5 [2,] -4 -14 [3,] -22 NA [4,] -14 -35 [5,] 0 -30 [6,] NA NA [7,] -28 7 [8,] 1 2 [9,] 10 -18 [10,] -1 13 [11,] 113 47 [12,] 100 64 [13,] 102 48 [14,] 104 NA [15,] 107 NA [16,] 108 44 [17,] 101 65 > (d <- dist(x,'manhattan')) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 2 13 3 44 36 4 44 31 16 5 25 20 44 19 6 NA NA NA NA NA 7 40 45 12 56 65 NA 8 8 21 46 52 33 NA 34 9 23 18 64 41 22 NA 63 29 10 19 30 42 61 44 NA 33 13 42 11 165 178 270 209 190 NA 181 157 168 148 12 169 182 244 213 194 NA 185 161 172 152 30 13 155 168 248 199 180 NA 171 147 158 138 12 18 14 208 216 252 236 208 NA 264 206 188 210 18 8 4 15 214 222 258 242 214 NA 270 212 194 216 12 14 10 6 16 157 170 260 201 182 NA 173 149 160 140 8 28 10 8 2 17 171 184 246 215 196 NA 187 163 174 154 30 2 18 6 12 28 > summary(d, na.rm = TRUE) # max = 270 Min. 1st Qu. Median Mean 3rd Qu. Max. NA's 2.00 27.25 147.50 114.55 188.50 270.00 16 > ## First call with "trace" (seg.fault typically later ...): > try( clara(x, k=2, metric="manhattan", sampsize=10, trace = 3) ) C clara(): (nsam,nran,n) = (10,5,17); 'large_sample', - clara sample 1 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 1 [ntt=7, nunfs=0] .. nsel[1:10]= 6 7 8 9 10 12 13 14 16 17 -> dysta2() gave dyst_toomany_NA --> new sample. - clara sample 2 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 3 [ntt=7, nunfs=1] .. nsel[1:10]= 1 4 7 9 11 12 13 15 16 17 -> dysta2(); clara -> s:= max{dys[1..45]} = 270; bswap2(*, s=270), 1. BUILD: new repr. 7 new repr. 1 after build: medoids are 1 7 and min.dist dysma[1:n] are 0 44 40 23 12 18 0 10 10 18 --> sky = sum_j D_j= 175 swp new 8 <-> 7 old; decreasing diss. by -18 Last swap: new 8 <-> 7 old; decreasing diss. by 1 end{bswap2}: sky = 157 selec() -> 'NAfs' obj= 7.41176 - clara sample 3 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 6 [ntt=7, nunfs=2] .. nsel[1:10]= 1 2 3 5 8 9 10 11 13 17 -> dysta2(); clara -> s:= max{dys[1..45]} = 270; bswap2(*, s=270), 1. BUILD: new repr. 5 new repr. 9 after build: medoids are 5 9 and min.dist dysma[1:n] are 8 21 46 33 0 29 13 12 0 18 --> sky = sum_j D_j= 180 swp new 1 <-> 5 old; decreasing diss. by -18 Last swap: new 1 <-> 5 old; decreasing diss. by 1 end{bswap2}: sky = 162 selec() -> 'NAfs' obj= 7.41176 - clara sample 4 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 5 [ntt=7, nunfs=3] .. nsel[1:10]= 1 2 3 4 7 8 9 10 13 14 -> dysta2(); clara -> s:= max{dys[1..45]} = 264; bswap2(*, s=264), 1. BUILD: new repr. 1 new repr. 10 after build: medoids are 1 10 and min.dist dysma[1:n] are 0 13 44 44 40 8 23 19 4 0 --> sky = sum_j D_j= 195 Last swap: new 9 <-> 10 old; decreasing diss. by 0 end{bswap2}: sky = 195 selec() -> 'NAfs' obj= 7.41176 - clara sample 5 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 16 [ntt=7, nunfs=4] .. nsel[1:10]= 2 3 4 6 7 8 9 10 11 17 -> dysta2() gave dyst_toomany_NA --> new sample. C clara() -> best sample _found_ ; nbest[1:10] = c(0,0,0,0,0,0,0,0,0,0) Error in clara(x, k = 2, metric = "manhattan", sampsize = 10, trace = 3) : Observation 6 has *only* NAs --> omit it for clustering In addition: Warning message: In clara(x, k = 2, metric = "manhattan", sampsize = 10, trace = 3) : Distance computations with NAs: using correct instead of pre-2016 wrong formula. Use 'correct.d=FALSE' to get previous results or set 'correct.d=TRUE' explicitly to suppress this warning. > ## Originally:already shows the problem: nbest[] = c(0,0,...,0) must be WRONG!! > ## Now: gives the proper error message. > > ## S-plus 6.1.2 (rel.2 for Linux, 2002) gives > ##> cc <- clara(x, k=2, metric="manhattan", samples=2, sampsize=10) > ## Problem in .Fortran("clara",: Internal error: data for decrementing > ## ref.count didn't point to a valid arena (0x0), while calling subroutine clara > > ## The large example from clara.R -- made small enough to still provoke > ## the "** dysta2() ... OUT" problem {no longer!} > x <- matrix(c(0, 3, -4, 62, 1, 3, -7, 45, 36, 46, 45, 54, -10, + 51, 49, -5, 13, -6, 49, 52, 57, 39, -1, 55, 68, -3, 51, 11, NA, + 9, -3, 50, NA, 58, 9, 52, 12, NA, 47, -12, -6, -9, 5, 30, 38, + 54, -5, 39, 50, 50, 54, 43, 7, 64, 55, 4, 0, 72, 54, 37, 59, + -1, 8, 43, 50, -2, 56, -8, 43, 6, 4, 48, -2, 14, 45, 49, 56, + 51, 45, 11, 10, 42, 50, 2, -12, 3, 1, 2, 2, -14, -4, 8, 0, 3, + -11, 8, 5, 14, -1, 9, 0, 19, 10, -2, -9, 9, 2, 16, 10, 4, 1, + 12, 7, -4, 27, -8, -9, -9, 2, 8, NA, 13, -23, -3, -5, 1, 15, + -3, 5, -9, -5, 14, 8, 7, -4, 26, 20, 10, 8, 17, 4, 14, 23, -2, + 23, 2, 16, 5, 5, -3, 12, 5, 14, -2, 4, 2, -2, 7, 9, 1, -15, -1, + 9, 23, 1, 7, 13, 2, -11, 16, 12, -11, -14, 2, 6, -8), + ncol = 2) > str(x) # 88 x 2 num [1:88, 1:2] 0 3 -4 62 1 3 -7 45 36 46 ... > try(clara(x, 2, samples = 20, trace = 3))# 2nd sample did show dysta2() problem C clara(): (nsam,nran,n) = (44,20,88); - clara sample 1 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 2 [ntt=44, nunfs=0] .. nsel[1:44]= 2 3 4 6 9 10 12 14 15 18 19 20 24 25 26 28 31 35 38 42 47 48 51 53 54 57 60 61 64 66 68 70 71 73 74 75 76 77 78 79 80 81 82 88 -> dysta2(); clara -> s:= max{dys[1..946]} = 78.6448; bswap2(*, s=78.6448), 1. BUILD: new repr. 19 new repr. 9 after build: medoids are 9 19 and min.dist dysma[1:n] are 21.2 7.07 9.9 2.83 5.66 5 5.1 9.22 0 11.3 1.41 6.71 6.32 8.49 7.07 12.7 1.41 33.9 0 14.1 7.07 18.9 5.39 4.24 15.5 31.1 5.66 5.66 5.66 4.24 1.41 8.49 11.3 22.6 2.83 4.12 13 0 3.61 5 1.41 17 9.22 12.7 --> sky = sum_j D_j= 385.677 Last swap: new 6 <-> 9 old; decreasing diss. by 0.939294 end{bswap2}: sky = 385.677 selec() -> 'NAfs' obj= 2.59347 - clara sample 2 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 12 [ntt=44, nunfs=1] .. nsel[1:44]= 1 2 3 5 6 7 9 12 17 19 26 27 28 29 30 38 39 42 43 45 47 50 52 54 55 56 58 59 60 61 62 64 67 68 71 74 75 76 77 79 80 81 83 84 -> dysta2(); clara -> s:= max{dys[1..946]} = 81.7435; bswap2(*, s=81.7435), 1. BUILD: new repr. 16 new repr. 43 after build: medoids are 16 43 and min.dist dysma[1:n] are 1.41 21.2 7.07 1.41 2.83 17 5.66 5 14.1 1.41 7.07 15 12.7 14.1 14.1 0 4.24 14.1 8.49 9.9 7.07 2 8.6 14.1 12.1 4.24 1.41 5.66 5.66 5.66 5.66 5.66 4.24 1.41 11.3 2.83 5.83 11 0 5.1 1.41 17 0 17 --> sky = sum_j D_j= 331.98 Last swap: new 17 <-> 43 old; decreasing diss. by 0.492109 end{bswap2}: sky = 331.98 selec() -> 'NAfs' obj= 2.55701 - clara sample 3 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 14 [ntt=44, nunfs=2] .. nsel[1:44]= 1 3 4 6 7 9 12 14 15 16 18 19 20 29 30 31 32 36 38 39 40 44 46 47 48 49 51 53 54 56 57 60 62 64 65 66 67 73 75 77 79 81 82 87 -> dysta2(); clara -> s:= max{dys[1..946]} = 77.8781; bswap2(*, s=77.8781), 1. BUILD: new repr. 19 new repr. 35 after build: medoids are 19 35 and min.dist dysma[1:n] are 1.41 7.07 9.9 2.83 17 5.66 6.4 5.1 4.12 4.24 11.3 1.41 2.83 14.1 14.1 1.41 6 5.66 0 3.16 5.66 18.4 8.06 7.07 16.3 6 7.21 4.24 14 4.24 31.1 5.66 5.66 5.66 0 4.24 4.24 22.6 7.07 0 5.1 17 8.25 7.07 --> sky = sum_j D_j= 338.587 end{bswap2}: sky = 338.587 selec() -> 'NAfs' obj= 2.57726 - clara sample 4 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 70 [ntt=44, nunfs=3] .. nsel[1:44]= 1 3 8 9 14 15 16 17 19 20 22 23 28 30 31 32 34 35 36 37 38 39 40 41 45 46 47 49 54 56 57 65 66 67 69 70 71 74 76 77 78 84 86 88 -> dysta2(); clara -> s:= max{dys[1..946]} = 77.8781; bswap2(*, s=77.8781), 1. BUILD: new repr. 21 new repr. 32 after build: medoids are 21 32 and min.dist dysma[1:n] are 1.41 7.07 7.81 5.66 5.1 4.12 4.24 14.1 1.41 2.83 4.24 0 12.7 14.1 1.41 6 8.06 33.9 5.66 8.49 0 3.16 5.66 5.66 9.9 8.06 7.07 6 14 4.24 31.1 0 4.24 4.24 4.24 8.49 11.3 2.83 9.06 0 7.07 17 1.41 12.7 --> sky = sum_j D_j= 325.933 end{bswap2}: sky = 325.933 selec() -> 'NAfs' obj= 2.57726 - clara sample 5 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 80 [ntt=44, nunfs=4] .. nsel[1:44]= 1 2 3 5 7 8 11 13 14 20 22 23 26 28 30 31 33 34 37 38 39 41 45 46 47 50 51 52 57 59 61 64 67 71 76 77 79 80 81 82 85 86 87 88 -> dysta2() gave dyst_toomany_NA --> new sample. - clara sample 6 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 5 [ntt=44, nunfs=5] .. nsel[1:44]= 2 3 4 5 6 8 10 12 19 20 21 23 24 25 29 30 31 32 33 37 39 41 42 45 46 48 50 53 54 59 61 66 68 69 71 72 73 79 80 82 84 85 86 87 -> dysta2() gave dyst_toomany_NA --> new sample. - clara sample 7 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 17 [ntt=44, nunfs=6] .. nsel[1:44]= 2 3 6 7 8 12 14 16 17 18 20 22 26 27 29 30 31 32 33 35 36 37 42 44 45 46 49 52 54 58 59 61 62 63 65 67 70 74 75 77 78 79 87 88 -> dysta2() gave dyst_toomany_NA --> new sample. - clara sample 8 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 67 [ntt=44, nunfs=7] .. nsel[1:44]= 2 3 6 7 8 9 11 13 14 18 30 31 32 34 35 37 38 40 43 44 47 48 49 52 54 55 56 58 59 60 66 67 68 70 71 72 73 75 80 83 84 85 87 88 -> dysta2(); clara -> s:= max{dys[1..946]} = 85.5102; bswap2(*, s=85.5102), 1. BUILD: new repr. 17 new repr. 9 after build: medoids are 9 17 and min.dist dysma[1:n] are 21.2 7.07 2.83 17 9.9 5.66 2.83 1.41 0 11.3 14.1 1.41 9.9 9.22 33.9 8.49 0 5.66 8.49 18.4 7.07 13.9 1.41 8.25 13.9 5.66 4.24 1.41 4.24 5.66 4.24 4.24 1.41 8.49 11.3 0 22.6 11.3 1.41 7.07 17 21.2 7.07 12.7 --> sky = sum_j D_j= 384.698 end{bswap2}: sky = 384.698 selec() -> 'NAfs' obj= 2.73432 - clara sample 9 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 67 [ntt=44, nunfs=8] .. nsel[1:44]= 2 4 6 7 8 11 12 13 14 15 17 19 20 21 24 27 29 30 31 33 34 35 36 39 42 45 46 48 50 51 52 54 55 58 60 61 62 65 67 78 80 84 86 88 -> dysta2() gave dyst_toomany_NA --> new sample. - clara sample 10 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 5 [ntt=44, nunfs=9] .. nsel[1:44]= 1 3 5 6 7 9 10 14 15 16 17 18 19 20 21 23 28 29 30 32 33 36 37 39 40 44 46 47 51 53 54 55 56 57 65 69 70 74 76 81 82 84 86 87 -> dysta2() gave dyst_toomany_NA --> new sample. - clara sample 11 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 66 [ntt=44, nunfs=10] .. nsel[1:44]= 1 3 4 5 6 11 13 14 15 18 19 21 28 30 31 32 33 34 39 40 41 42 43 46 47 57 58 59 63 65 66 67 71 72 73 74 75 78 79 80 83 84 87 88 -> dysta2() gave dyst_toomany_NA --> new sample. - clara sample 12 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 21 [ntt=44, nunfs=11] .. nsel[1:44]= 4 5 6 8 9 10 13 14 15 16 17 21 23 25 27 28 30 35 36 41 44 46 47 49 50 54 55 56 57 59 61 62 64 65 66 68 71 72 74 75 76 81 83 84 -> dysta2(); clara -> s:= max{dys[1..946]} = 78.3135; bswap2(*, s=78.3135), 1. BUILD: new repr. 5 new repr. 2 after build: medoids are 2 5 and min.dist dysma[1:n] are 26.2 0 3.61 9.49 0 13.5 11 20.5 13.9 6.32 15 21.6 2.24 32.1 26.6 12.8 12 24.4 17.9 8.6 10.8 18.1 7.21 20.5 14.9 29.4 26.2 3.61 23 21.1 23 3.61 7 16.6 3.61 9.22 9.49 12.6 13 9.85 22.2 14.2 15.7 11 --> sky = sum_j D_j= 623.732 swp new 43 <-> 5 old; decreasing diss. by -205.358 Last swap: new 43 <-> 5 old; decreasing diss. by 1 end{bswap2}: sky = 418.375 selec() -> 'NAfs' obj= 3.17257 - clara sample 13 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 4 [ntt=44, nunfs=12] .. nsel[1:44]= 3 4 5 14 15 16 17 19 20 21 24 25 26 29 30 31 34 35 38 40 41 43 47 49 50 52 55 57 58 60 61 63 64 65 66 68 72 73 74 79 81 83 86 88 -> dysta2(); clara -> s:= max{dys[1..946]} = 84.1487; bswap2(*, s=84.1487), 1. BUILD: new repr. 19 new repr. 34 after build: medoids are 19 34 and min.dist dysma[1:n] are 7.07 9.9 1.41 5.1 4.12 4.24 14.1 1.41 2.83 8.06 5.39 8.49 7.07 14.1 14.1 1.41 8.06 33.9 0 5.66 5.66 8.49 7.07 6 4 7.62 10.3 31.1 1.41 5.66 5.66 15.6 5.66 0 4.24 1.41 0 22.6 2.83 5.1 17 2 1.41 12.7 --> sky = sum_j D_j= 340.1 end{bswap2}: sky = 340.1 selec() -> 'NAfs' obj= 2.57726 - clara sample 14 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 78 [ntt=44, nunfs=13] .. nsel[1:44]= 5 7 8 9 10 11 12 18 19 21 23 27 28 29 31 32 33 35 36 38 39 46 50 51 52 56 57 58 59 60 64 65 66 68 72 73 75 77 78 80 84 86 87 88 -> dysta2() gave dyst_toomany_NA --> new sample. - clara sample 15 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 73 [ntt=44, nunfs=14] .. nsel[1:44]= 2 3 8 10 18 25 26 27 29 31 33 34 35 41 42 43 44 46 47 48 49 53 54 56 57 58 59 60 63 69 70 71 72 73 75 76 77 79 81 84 85 86 87 88 -> dysta2() gave dyst_toomany_NA --> new sample. - clara sample 16 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 43 [ntt=44, nunfs=15] .. nsel[1:44]= 5 6 7 8 9 12 14 16 18 22 23 24 27 28 29 30 34 35 36 39 40 41 43 45 56 57 59 60 62 64 65 67 69 70 71 73 74 75 79 81 83 85 86 87 -> dysta2(); clara -> s:= max{dys[1..946]} = 75.1665; bswap2(*, s=75.1665), 1. BUILD: new repr. 15 new repr. 41 after build: medoids are 15 41 and min.dist dysma[1:n] are 12.7 17 2.83 6.4 15.7 5 7.07 9.9 25.5 13.6 14.1 5 15 1.41 0 0 8.06 19.8 8.49 4.24 8.49 19.8 5.66 12.6 9.9 45.3 5.66 14.8 8.49 9.9 2 10 9.9 22.6 25.5 8.49 11.3 5.83 5.1 2.83 0 7.07 15.6 21.2 --> sky = sum_j D_j= 479.721 end{bswap2}: sky = 479.721 selec() -> 'NAfs' obj= 3.31146 - clara sample 17 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 22 [ntt=44, nunfs=16] .. nsel[1:44]= 4 6 9 10 11 12 13 16 19 22 26 27 29 30 33 34 37 38 39 42 43 48 51 54 55 57 60 61 62 63 64 66 69 72 73 75 76 77 78 81 82 85 86 87 -> dysta2() gave dyst_toomany_NA --> new sample. - clara sample 18 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 39 [ntt=44, nunfs=17] .. nsel[1:44]= 1 4 8 13 15 19 20 23 25 26 27 28 30 31 33 34 36 37 39 41 42 43 44 45 46 47 50 54 55 57 59 60 62 64 65 66 67 72 73 78 79 81 82 85 -> dysta2() gave dyst_toomany_NA --> new sample. - clara sample 19 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 72 [ntt=44, nunfs=18] .. nsel[1:44]= 1 4 5 6 10 12 13 14 17 18 19 22 23 25 27 30 31 32 33 38 39 40 41 42 44 45 46 48 55 57 58 59 60 61 66 67 69 70 72 74 83 84 85 86 -> dysta2() gave dyst_toomany_NA --> new sample. - clara sample 20 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 48 [ntt=44, nunfs=19] .. nsel[1:44]= 1 3 4 5 7 10 11 13 14 20 22 23 31 32 33 34 35 36 37 40 41 42 43 44 48 50 52 53 55 56 62 63 68 71 72 73 74 75 81 82 83 84 86 88 -> dysta2() gave dyst_toomany_NA --> new sample. C clara() -> best sample _found_ ; nbest[1:44] = c(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0) Error in clara(x, 2, samples = 20, trace = 3) : Observation 33 has *only* NAs --> omit it for clustering In addition: Warning message: In clara(x, 2, samples = 20, trace = 3) : Distance computations with NAs: using correct instead of pre-2016 wrong formula. Use 'correct.d=FALSE' to get previous results or set 'correct.d=TRUE' explicitly to suppress this warning. > ## To see error message for > 1 missing: > try(clara(rbind(NA,x), 2)) Error in clara(rbind(NA, x), 2) : Observations 1,34 have *only* NAs --> omit them for clustering! In addition: Warning message: In clara(rbind(NA, x), 2) : Distance computations with NAs: using correct instead of pre-2016 wrong formula. Use 'correct.d=FALSE' to get previous results or set 'correct.d=TRUE' explicitly to suppress this warning. > > x <- x[-33,] > ## still had the ** dysta2() .. OUT" problem {no longer!} > c2 <- clara(x, 2, samples = 12, trace = 3) C clara(): (nsam,nran,n) = (44,12,87); 'large_sample', - clara sample 1 finding 1st... new k{ran}: .. kall: FALSE, ... nrx [0:1]= 0 0 ... nsel[0:0]= 2 [ntt=43, nunfs=0] .. nsel[1:44]= 1 7 8 11 14 16 17 21 22 26 29 30 32 33 34 36 37 39 40 41 43 44 45 46 48 49 51 52 54 55 56 58 62 64 66 68 69 71 74 82 83 84 85 86 -> dysta2(); clara -> s:= max{dys[1..946]} = 76.5376; bswap2(*, s=76.5376), 1. BUILD: new repr. 17 new repr. 40 after build: medoids are 17 40 and min.dist dysma[1:n] are 1.41 17 6.4 2.83 7.07 4.24 14.1 7.28 4.24 7.07 14.1 14.1 4 8.06 33.9 8.49 0 5.66 5.66 14.1 18.4 9.9 6.4 7.07 8 2 8.6 4.24 12.1 4.24 31.1 5.66 15.6 2 4.24 4.24 8.49 0 5.83 0 17 21.2 1.41 7.07 --> sky = sum_j D_j= 384.62 end{bswap2}: sky = 384.62 1st proper sample obj= 7.92464 - clara sample 2 finding 1st... new k{ran}: .. kall: T, ... nrx [0:1]= 37 82 ... nsel[0:0]= 70 [ntt=43, nunfs=0] .. nsel[1:44]= 4 8 10 11 13 15 16 18 20 21 22 23 24 25 31 32 33 34 35 36 37 40 41 43 45 46 48 50 52 55 62 64 65 68 69 71 72 77 81 82 84 85 86 87 -> dysta2(); clara -> s:= max{dys[1..946]} = 82.7103; bswap2(*, s=82.7103), 1. BUILD: new repr. 21 new repr. 40 after build: medoids are 21 40 and min.dist dysma[1:n] are 9.9 6.4 4.47 2.83 1.41 2.24 4.24 11.3 4.47 7.28 4.24 0 5 8.49 1.41 4 8.06 33.9 5.66 8.49 0 5.66 14.1 18.4 6.4 7.07 8 5.66 4.24 4.24 15.6 2 4.24 4.24 8.49 0 22.6 5.1 8.94 0 21.2 1.41 7.07 12.7 --> sky = sum_j D_j= 321.274 end{bswap2}: sky = 321.274 obj= 7.92464 - clara sample 3 finding 1st... new k{ran}: .. kall: T, ... nrx [0:1]= 37 82 ... nsel[0:0]= 38 [ntt=43, nunfs=0] .. nsel[1:44]= 2 5 10 11 14 18 21 22 23 24 25 26 27 29 33 34 36 37 39 41 42 43 45 47 49 50 55 57 58 60 62 64 67 68 71 73 75 77 79 82 83 84 85 87 -> dysta2(); clara -> s:= max{dys[1..946]} = 85.5102; bswap2(*, s=85.5102), 1. BUILD: new repr. 18 new repr. 32 after build: medoids are 18 32 and min.dist dysma[1:n] are 21.2 1.41 4 2.83 5.1 11.3 8.06 4.24 0 5.39 8.49 7.07 13 14.1 8.06 33.9 8.49 0 5.66 14.1 8.49 18.4 8.06 16.3 4 7.21 4.24 1.41 4.47 5.66 15.6 0 1.41 4.24 0 2.83 9.06 7.07 1.41 2 17 21.2 1.41 12.7 --> sky = sum_j D_j= 350.699 Last swap: new 40 <-> 32 old; decreasing diss. by 0.7867 end{bswap2}: sky = 350.699 new best obj= 7.91099 - clara sample 4 finding 1st... new k{ran}: .. kall: T, ... nrx [0:1]= 37 64 ... nsel[0:0]= 85 [ntt=43, nunfs=0] .. nsel[1:44]= 2 4 5 6 8 10 11 12 15 18 21 24 25 26 28 31 33 37 40 42 43 47 49 50 52 54 55 57 58 59 60 61 62 63 64 71 72 73 74 78 79 81 82 86 -> dysta2(); clara -> s:= max{dys[1..946]} = 78.3135; bswap2(*, s=78.3135), 1. BUILD: new repr. 18 new repr. 43 after build: medoids are 18 43 and min.dist dysma[1:n] are 21.2 9.9 1.41 2.83 6.4 4.47 2.83 5 2.24 11.3 7.28 5 8.49 7.07 12.7 1.41 8.06 0 5.66 8.49 18.4 17.8 2 5.66 4.24 12.1 4.24 1.41 5.66 5.66 5.66 5.66 15.6 5.66 2 0 22.6 2.83 5.83 5.1 1.41 8.94 0 7.07 --> sky = sum_j D_j= 297.276 end{bswap2}: sky = 297.276 obj= 7.92464 - clara sample 5 finding 1st... new k{ran}: .. kall: T, ... nrx [0:1]= 37 64 ... nsel[0:0]= 84 [ntt=43, nunfs=0] .. nsel[1:44]= 4 6 9 10 12 13 15 16 17 18 20 21 24 26 27 31 34 35 36 37 40 41 42 43 45 51 52 53 54 55 56 62 64 65 67 68 69 71 72 73 74 77 79 82 -> dysta2(); clara -> s:= max{dys[1..946]} = 76.5376; bswap2(*, s=76.5376), 1. BUILD: new repr. 20 new repr. 44 after build: medoids are 20 44 and min.dist dysma[1:n] are 9.9 2.83 5.66 4.47 5 1.41 2.24 4.24 14.1 11.3 4.47 7.28 5 7.07 15 1.41 33.9 5.66 8.49 0 5.66 14.1 8.49 18.4 6.4 8.6 4.24 14.1 12.1 4.24 31.1 15.6 2 4.24 1.41 4.24 8.49 0 22.6 2.83 5.83 5.1 1.41 0 --> sky = sum_j D_j= 350.799 end{bswap2}: sky = 350.799 obj= 7.92464 - clara sample 6 finding 1st... new k{ran}: .. kall: T, ... nrx [0:1]= 37 64 ... nsel[0:0]= 33 [ntt=43, nunfs=0] .. nsel[1:44]= 1 5 7 9 11 13 14 15 17 18 22 26 27 28 34 35 36 37 38 43 46 47 48 50 51 54 55 56 57 61 63 64 66 69 71 73 74 75 76 77 78 80 81 82 -> dysta2(); clara -> s:= max{dys[1..946]} = 82.0244; bswap2(*, s=82.0244), 1. BUILD: new repr. 18 new repr. 19 after build: medoids are 18 19 and min.dist dysma[1:n] are 1.41 1.41 17 5.66 2.83 1.41 5.66 5.39 14.1 11.3 4.24 7.07 12.6 12.7 33.9 5.66 8.49 0 0 17 7.07 13.6 5.83 9.9 4.47 11.3 4.24 31.1 1.41 5.66 5.66 3.16 4.24 8.49 0 2.83 6.32 8.25 0 8.49 2.83 17 5.1 4.24 --> sky = sum_j D_j= 339.187 end{bswap2}: sky = 339.187 obj= 8.0873 - clara sample 7 finding 1st... new k{ran}: .. kall: T, ... nrx [0:1]= 37 64 ... nsel[0:0]= 26 [ntt=43, nunfs=0] .. nsel[1:44]= 1 3 4 5 9 10 11 18 19 21 23 24 25 30 37 38 39 40 46 47 50 54 55 56 59 62 64 65 66 67 68 70 71 72 75 76 79 80 81 82 83 84 85 86 -> dysta2(); clara -> s:= max{dys[1..946]} = 82.7103; bswap2(*, s=82.7103), 1. BUILD: new repr. 15 new repr. 27 after build: medoids are 15 27 and min.dist dysma[1:n] are 1.41 7.07 9.9 1.41 5.66 4 2.83 11.3 1.41 8.06 0 5.39 8.49 14.1 0 3.16 5.66 5.66 7.07 16.3 7.21 10.3 4.24 31.1 5.66 15.6 0 4.24 4.24 1.41 4.24 11.3 0 22.6 9.06 0 1.41 17 8.25 2 17 21.2 1.41 7.07 --> sky = sum_j D_j= 325.427 end{bswap2}: sky = 325.427 obj= 7.91099 - clara sample 8 finding 1st... new k{ran}: .. kall: T, ... nrx [0:1]= 37 64 ... nsel[0:0]= 3 [ntt=43, nunfs=0] .. nsel[1:44]= 4 5 6 10 12 15 16 17 19 20 21 22 23 24 25 26 27 28 29 31 37 39 41 42 44 45 46 49 50 51 56 57 61 62 63 64 68 73 75 77 78 80 81 85 -> dysta2(); clara -> s:= max{dys[1..946]} = 84.1487; bswap2(*, s=84.1487), 1. BUILD: new repr. 21 new repr. 36 after build: medoids are 21 36 and min.dist dysma[1:n] are 9.9 1.41 2.83 4 6.4 4.12 4.24 14.1 1.41 2.83 8.06 4.24 0 5.39 8.49 7.07 13 12.7 14.1 1.41 0 5.66 14.1 8.49 9.9 8.06 7.07 4 7.21 7.62 31.1 1.41 5.66 15.6 5.66 0 4.24 2.83 9.06 7.07 5.1 17 8.25 1.41 --> sky = sum_j D_j= 312.333 end{bswap2}: sky = 312.333 obj= 7.91099 - clara sample 9 finding 1st... new k{ran}: .. kall: T, ... nrx [0:1]= 37 64 ... nsel[0:0]= 59 [ntt=43, nunfs=0] .. nsel[1:44]= 1 3 5 9 11 13 17 22 23 25 29 31 32 34 37 38 40 42 43 44 47 49 53 55 56 58 62 63 64 66 68 69 70 71 72 73 74 75 76 78 81 82 84 86 -> dysta2(); clara -> s:= max{dys[1..946]} = 82.7103; bswap2(*, s=82.7103), 1. BUILD: new repr. 15 new repr. 29 after build: medoids are 15 29 and min.dist dysma[1:n] are 1.41 7.07 1.41 5.66 2.83 1.41 14.1 4.24 0 8.49 14.1 1.41 6 33.9 0 3.16 5.66 8.49 18.4 9.9 16.3 4 14 4.24 31.1 4.47 15.6 5.66 0 4.24 4.24 8.49 11.3 0 22.6 2.83 7.07 9.06 0 5.1 8.25 2 21.2 7.07 --> sky = sum_j D_j= 356.571 Last swap: new 16 <-> 29 old; decreasing diss. by 0.311473 end{bswap2}: sky = 356.571 obj= 7.91099 - clara sample 10 finding 1st... new k{ran}: .. kall: T, ... nrx [0:1]= 37 64 ... nsel[0:0]= 5 [ntt=43, nunfs=0] .. nsel[1:44]= 2 4 8 11 12 13 22 24 25 26 27 29 31 34 36 37 39 41 42 44 47 48 49 50 53 57 58 59 60 61 62 63 64 66 67 70 71 72 75 77 79 82 84 87 -> dysta2(); clara -> s:= max{dys[1..946]} = 85.5102; bswap2(*, s=85.5102), 1. BUILD: new repr. 16 new repr. 33 after build: medoids are 16 33 and min.dist dysma[1:n] are 21.2 9.9 7.81 2.83 6.4 1.41 4.24 5.39 8.49 7.07 13 14.1 1.41 33.9 8.49 0 5.66 14.1 8.49 9.9 16.3 6 4 7.21 14 1.41 4.47 5.66 5.66 5.66 15.6 5.66 0 4.24 1.41 11.3 0 22.6 9.06 7.07 1.41 2 21.2 12.7 --> sky = sum_j D_j= 368.598 Last swap: new 42 <-> 33 old; decreasing diss. by 0.115684 end{bswap2}: sky = 368.598 obj= 7.91099 - clara sample 11 finding 1st... new k{ran}: .. kall: T, ... nrx [0:1]= 37 64 ... nsel[0:0]= 30 [ntt=43, nunfs=0] .. nsel[1:44]= 2 7 8 9 10 16 17 20 22 23 24 26 27 29 34 35 36 37 38 41 44 47 48 49 50 51 52 53 54 59 60 61 63 64 67 68 69 75 76 78 80 81 84 85 -> dysta2(); clara -> s:= max{dys[1..946]} = 80.9938; bswap2(*, s=80.9938), 1. BUILD: new repr. 18 new repr. 19 after build: medoids are 18 19 and min.dist dysma[1:n] are 21.2 17 7.28 5.66 1.41 4.24 14.1 5.1 4.24 0 8.54 7.07 12.6 14.1 33.9 5.66 8.49 0 0 14.1 9.9 13.6 5.83 5.83 9.9 4.47 4.24 17 11.3 5.66 5.66 5.66 5.66 3.16 1.41 4.24 8.49 8.25 0 2.83 17 5.1 21.2 1.41 --> sky = sum_j D_j= 362.717 end{bswap2}: sky = 362.717 obj= 8.0873 - clara sample 12 finding 1st... new k{ran}: .. kall: T, ... nrx [0:1]= 37 64 ... nsel[0:0]= 44 [ntt=43, nunfs=0] .. nsel[1:44]= 1 2 3 7 11 12 14 18 19 20 21 28 30 31 32 33 34 37 38 39 40 42 49 51 52 53 55 59 63 64 68 69 70 72 74 76 77 78 79 81 84 85 86 87 -> dysta2(); clara -> s:= max{dys[1..946]} = 80.9938; bswap2(*, s=80.9938), 1. BUILD: new repr. 18 new repr. 30 after build: medoids are 18 30 and min.dist dysma[1:n] are 1.41 21.2 7.07 17 2.83 6.4 5.1 11.3 1.41 2.83 8.06 12.7 14.1 1.41 6 8.06 33.9 0 3.16 5.66 5.66 8.49 4 7.62 4.24 14 4.24 5.66 5.66 0 4.24 8.49 11.3 22.6 7.07 0 7.07 5.1 1.41 8.25 21.2 1.41 7.07 12.7 --> sky = sum_j D_j= 347.279 end{bswap2}: sky = 347.279 obj= 7.91099 C clara() -> best sample _found_ ; nbest[1:44] = c(2,5,10,11,14,18,21,22,23,24,25,26,27,29,33,34,36,37,39,41, 42,43,45,47,49,50,55,57,58,60,62,64,67,68,71,73,75,77,79,82, 83,84,85,87) resul(), black() and return() from C. Warning message: In clara(x, 2, samples = 12, trace = 3) : Distance computations with NAs: using correct instead of pre-2016 wrong formula. Use 'correct.d=FALSE' to get previous results or set 'correct.d=TRUE' explicitly to suppress this warning. > c2. <- clara(x, 2, samples = 12, trace = 1, correct.d=TRUE) C clara(): (nsam,nran,n) = (44,12,87); 'large_sample', - clara sample 1 [ntt=43, nunfs=0] -> dysta2(); obj= 7.92464 - clara sample 2 [ntt=43, nunfs=0] -> dysta2(); obj= 7.92464 - clara sample 3 [ntt=43, nunfs=0] -> dysta2(); obj= 7.91099 - clara sample 4 [ntt=43, nunfs=0] -> dysta2(); obj= 7.92464 - clara sample 5 [ntt=43, nunfs=0] -> dysta2(); obj= 7.92464 - clara sample 6 [ntt=43, nunfs=0] -> dysta2(); obj= 8.0873 - clara sample 7 [ntt=43, nunfs=0] -> dysta2(); obj= 7.91099 - clara sample 8 [ntt=43, nunfs=0] -> dysta2(); obj= 7.91099 - clara sample 9 [ntt=43, nunfs=0] -> dysta2(); obj= 7.91099 - clara sample 10 [ntt=43, nunfs=0] -> dysta2(); obj= 7.91099 - clara sample 11 [ntt=43, nunfs=0] -> dysta2(); obj= 8.0873 - clara sample 12 [ntt=43, nunfs=0] -> dysta2(); obj= 7.91099 C clara() -> best sample _found_ resul(), black() and return() from C. > p2g <- pam(daisy(x,"gower"), k=2, trace = 3) pam()'s bswap(*, s=0.785, pamonce=0): build 2 medoids: new repr. 37 new repr. 64 after build: medoids are 37 64 and min.dist dysma[1:n] are 0.02 0.3 0.1 0.131 0.02 0.04 0.24 0.0898 0.08 0.0238 0.04 0.0738 0.02 0.056 0.046 0.06 0.2 0.16 0.02 0.0319 0.0817 0.06 0 0.0498 0.12 0.1 0.136 0.18 0.2 0.2 0.02 0.06 0.0576 0.48 0.08 0.12 0 0.0279 0.08 0.08 0.2 0.12 0.119 0.131 0.0938 0.1 0.185 0.06 0.04 0.0838 0.0717 0.06 0.0833 0.12 0.06 0.388 0.02 0.0438 0.08 0.08 0.08 0.22 0.08 0 0.06 0.06 0.02 0.06 0.12 0.16 0 0.32 0.04 0.0798 0.096 0 0.076 0.0398 0.02 0.24 0.0676 0.02 0.24 0.3 0.02 0.1 0.18 end{bswap()}, end{cstat()} > if(FALSE) { ## disabled clara(*, "gower") for now (2023-11-30): + c2g <- clara(x, 2, samples = 12, sampsize=nrow(x), trace = 2, metric = "gower", pamLike=TRUE, correct.d=TRUE) + (icall <- which(names(c2) == "call")) + ## c2g and p2g are *quite* different ! + table(c2g$clustering, + p2g$clustering) + ## 1 2 + ## 1 40 32 + ## 2 15 0 << not *one* pair of {2,2} !?! + + stopifnot(exprs = { + all.equal(c2[-icall], c2.[-icall]) + }) + }# no "gower" for now > > data(xclara) > suppressWarnings(RNGversion("3.5.0")) # back compatibility of results > set.seed(123) > xclara[sample(nrow(xclara), 50),] <- NA > try( clara(xclara, k = 3) ) #-> "nice" error message {.. first 12 missing obs} : Error in clara(xclara, k = 3) : 50 observations (74,126,137,308,411,423,438,451,642,686,689,735 ...) have *only* NAs --> omit them for clustering! In addition: Warning message: In clara(xclara, k = 3) : Distance computations with NAs: using correct instead of pre-2016 wrong formula. Use 'correct.d=FALSE' to get previous results or set 'correct.d=TRUE' explicitly to suppress this warning. > ## Error in clara(xclara, k = 3) : > ## 50 observations (74,126,137,308,411,423,438,451,642,686,689,735 ...) have *only* NAs > ## --> omit them for clustering! > > proc.time() user system elapsed 0.149 0.039 0.205 cluster/tests/diana-boots.R0000644000176200001440000000172713450632521015430 0ustar liggesuserslibrary(cluster) ## Kind of a bootstrap -- calling many diana()s dianaBoot <- function(data, B = 500, frac.sub = c(0.7, min = 0.2), digits = 4) { stopifnot((n <- nrow(data)) >= 10, B >= 10, frac.sub > 0, (m <- round(frac.sub[["min"]]*n)) >= 2, (mm <- round(frac.sub[1]*n)) > m) for(b in 1:B) { d.r <- data[sample(n, max(m, min(n, rpois(1, lambda = mm)))) ,] dia. <- diana(d.r, keep.diss=FALSE, keep.data=FALSE) print(dia.[1:3], digits = digits) } } .p0 <- proc.time() data(ruspini) suppressWarnings(RNGversion("3.5.0")) # << as long as we don't have R >= 3.6.0 set.seed(134) dianaBoot(ruspini) cat('Time elapsed: ', (.p1 <- proc.time()) - .p0,'\n') data(agriculture) set.seed(707) dianaBoot(agriculture) cat('Time elapsed: ', (.p2 <- proc.time()) - .p1,'\n') data(swiss); swiss.x <- as.matrix(swiss[,-1]) set.seed(312) dianaBoot(swiss.x) cat('Time elapsed: ', (.p3 <- proc.time()) - .p2,'\n') cluster/tests/clara.Rout.save0000644000176200001440000011751014514447446016011 0ustar liggesusers R Under development (unstable) (2023-10-19 r85354) -- "Unsuffered Consequences" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu 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. > library(cluster) > > ## generate 1500 objects, divided into 2 clusters. > suppressWarnings(RNGversion("3.5.0")) # << as long as we don't have R >= 3.6.0 > set.seed(144) > x <- rbind(cbind(rnorm(700, 0,8), rnorm(700, 0,8)), + cbind(rnorm(800,50,8), rnorm(800,10,8))) > > isEq <- function(x,y, epsF = 100) + is.logical(r <- all.equal(x,y, tol = epsF * .Machine$double.eps)) && r > > .proctime00 <- proc.time() > > ## full size sample {should be = pam()}: > n0 <- length(iSml <- c(1:70, 701:720)) > summary(clara0 <- clara(x[iSml,], k = 2, sampsize = n0)) Object of class 'clara' from call: clara(x = x[iSml, ], k = 2, sampsize = n0) Medoids: [,1] [,2] [1,] -1.499522 -1.944452 [2,] 48.629631 12.998515 Objective function: 10.23588 Numerical information per cluster: size max_diss av_diss isolation [1,] 70 24.81995 10.25745 0.4744879 [2,] 20 19.07782 10.16040 0.3647145 Average silhouette width per cluster: [1] 0.7144587 0.7090915 Average silhouette width of best sample: 0.713266 Best sample: [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 [26] 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 [51] 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 [76] 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 Clustering vector: [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [39] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 [77] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Silhouette plot information for best sample: cluster neighbor sil_width 45 1 2 0.8033727 60 1 2 0.8021017 55 1 2 0.8005931 66 1 2 0.8002776 58 1 2 0.7991899 11 1 2 0.7991773 41 1 2 0.7973302 26 1 2 0.7962397 63 1 2 0.7962229 13 1 2 0.7949705 67 1 2 0.7942590 54 1 2 0.7936184 17 1 2 0.7916087 16 1 2 0.7913570 39 1 2 0.7912755 6 1 2 0.7840455 34 1 2 0.7833568 49 1 2 0.7819733 9 1 2 0.7789087 23 1 2 0.7785009 32 1 2 0.7757325 22 1 2 0.7655369 61 1 2 0.7639754 12 1 2 0.7639644 5 1 2 0.7606436 18 1 2 0.7579145 56 1 2 0.7566307 3 1 2 0.7537894 24 1 2 0.7531180 50 1 2 0.7517817 48 1 2 0.7501998 25 1 2 0.7499655 59 1 2 0.7472022 19 1 2 0.7445038 65 1 2 0.7398395 28 1 2 0.7377377 38 1 2 0.7370935 7 1 2 0.7335940 40 1 2 0.7310012 14 1 2 0.7294895 62 1 2 0.7254478 70 1 2 0.7163214 4 1 2 0.7157257 21 1 2 0.7148663 64 1 2 0.7108496 2 1 2 0.7062831 15 1 2 0.7015120 52 1 2 0.6978313 37 1 2 0.6954023 31 1 2 0.6932905 33 1 2 0.6888478 10 1 2 0.6805028 20 1 2 0.6766854 43 1 2 0.6761461 8 1 2 0.6749706 27 1 2 0.6671817 35 1 2 0.6632888 68 1 2 0.6587599 30 1 2 0.6554989 36 1 2 0.6228481 53 1 2 0.6203313 57 1 2 0.6191666 42 1 2 0.6142020 47 1 2 0.6024151 1 1 2 0.5814464 69 1 2 0.5091186 46 1 2 0.4961302 44 1 2 0.4849961 29 1 2 0.4569316 51 1 2 0.4230181 81 2 1 0.7965942 71 2 1 0.7961971 85 2 1 0.7919593 74 2 1 0.7869047 82 2 1 0.7795304 78 2 1 0.7788873 79 2 1 0.7729041 72 2 1 0.7492980 88 2 1 0.7447973 87 2 1 0.7404399 76 2 1 0.7352351 77 2 1 0.7216838 86 2 1 0.7165677 84 2 1 0.6952406 73 2 1 0.6942882 83 2 1 0.6621568 80 2 1 0.6368446 90 2 1 0.5743228 75 2 1 0.5597232 89 2 1 0.4482549 4005 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 0.1865 11.5850 20.0580 27.8150 45.5780 85.2320 Metric : euclidean Number of objects : 90 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > pam0 <- pam (x[iSml,], k = 2) > stopifnot(identical(clara0$clustering, pam0$clustering) + , isEq(clara0$objective, unname(pam0$objective[2])) + ) > > summary(clara2 <- clara(x, 2)) Object of class 'clara' from call: clara(x = x, k = 2) Medoids: [,1] [,2] [1,] 2.012828 -1.896095 [2,] 51.494628 10.274769 Objective function: 10.23445 Numerical information per cluster: size max_diss av_diss isolation [1,] 700 36.84408 10.49814 0.7230478 [2,] 800 30.89896 10.00373 0.6063775 Average silhouette width per cluster: [1] 0.7562366 0.7203254 Average silhouette width of best sample: 0.733384 Best sample: [1] 21 23 50 97 142 168 191 192 197 224 325 328 433 458 471 [16] 651 712 714 722 797 805 837 909 919 926 999 1006 1018 1019 1049 [31] 1081 1084 1132 1144 1150 1201 1207 1250 1291 1307 1330 1374 1426 1428 Clustering vector: [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [112] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [149] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [186] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [223] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [260] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [297] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [334] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [371] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [408] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [445] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [482] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [519] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [556] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [593] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [630] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [667] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 [704] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [741] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [778] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [815] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [852] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [889] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [926] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [963] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [1000] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [1037] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [1074] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [1111] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [1148] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [1185] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [1222] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [1259] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [1296] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [1333] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [1370] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [1407] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [1444] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [1481] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Silhouette plot information for best sample: cluster neighbor sil_width 325 1 2 0.8261589 191 1 2 0.8206687 23 1 2 0.8149640 97 1 2 0.8048084 433 1 2 0.8017745 458 1 2 0.8008324 471 1 2 0.7958547 328 1 2 0.7689099 142 1 2 0.7619508 21 1 2 0.7607528 197 1 2 0.7606641 50 1 2 0.7509131 192 1 2 0.7098473 651 1 2 0.7035969 224 1 2 0.6843886 168 1 2 0.5337006 1084 2 1 0.8180447 1081 2 1 0.8171686 1201 2 1 0.8170847 1291 2 1 0.8167148 1307 2 1 0.8166841 1144 2 1 0.8159947 999 2 1 0.8135303 1426 2 1 0.8023538 1049 2 1 0.8022891 1250 2 1 0.8014300 712 2 1 0.7859324 837 2 1 0.7792784 1018 2 1 0.7764837 919 2 1 0.7651939 1374 2 1 0.7648534 1428 2 1 0.7516819 1330 2 1 0.7505861 1006 2 1 0.7368113 714 2 1 0.7237565 1150 2 1 0.7046060 1132 2 1 0.6940608 909 2 1 0.6859682 926 2 1 0.6725631 722 2 1 0.6572791 797 2 1 0.6395698 1019 2 1 0.6083662 805 2 1 0.2814164 1207 2 1 0.2694097 946 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 0.4846 12.3230 26.4990 32.2130 52.3910 77.1750 Metric : euclidean Number of objects : 44 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > > clInd <- c("objective", "i.med", "medoids", "clusinfo") > clInS <- c(clInd, "sample") > ## clara() {as original code} always draws the *same* random samples !!!! > clara(x, 2, samples = 50)[clInd] $objective [1] 10.06735 $i.med [1] 177 1115 $medoids [,1] [,2] [1,] -0.2538744 -1.209148 [2,] 50.0372683 9.501125 $clusinfo size max_diss av_diss isolation [1,] 700 34.67208 10.193945 0.6743054 [2,] 800 29.51964 9.956571 0.5741003 > for(i in 1:20) + print(clara(x[sample(nrow(x)),], 2, samples = 50)[clInd]) $objective [1] 10.05727 $i.med [1] 936 192 $medoids [,1] [,2] [1,] 50.03726827 9.501124850 [2,] -0.03900399 -0.009078886 $clusinfo size max_diss av_diss isolation [1,] 800 29.51964 9.956571 0.5791419 [2,] 700 34.06055 10.172348 0.6682295 $objective [1] 10.05296 $i.med [1] 468 1394 $medoids [,1] [,2] [1,] -0.3292826 -0.2398794 [2,] 50.0372683 9.5011249 $clusinfo size max_diss av_diss isolation [1,] 700 33.98451 10.163128 0.6624677 [2,] 800 29.51964 9.956571 0.5754330 $objective [1] 10.05852 $i.med [1] 1171 379 $medoids [,1] [,2] [1,] 50.9444060 9.6723175 [2,] -0.3292826 -0.2398794 $clusinfo size max_diss av_diss isolation [1,] 800 30.10388 9.966988 0.5764486 [2,] 700 33.98451 10.163128 0.6507574 $objective [1] 10.07051 $i.med [1] 75 1254 $medoids [,1] [,2] [1,] -0.9493373 0.3552542 [2,] 50.5455985 9.3904972 $clusinfo size max_diss av_diss isolation [1,] 700 33.12704 10.191999 0.6336273 [2,] 800 29.66384 9.964205 0.5673860 $objective [1] 10.0613 $i.med [1] 199 134 $medoids [,1] [,2] [1,] -0.03900399 -0.009078886 [2,] 49.59384120 9.792964832 $clusinfo size max_diss av_diss isolation [1,] 700 34.06055 10.172348 0.6732466 [2,] 800 29.57491 9.964138 0.5845827 $objective [1] 10.06101 $i.med [1] 1453 1122 $medoids [,1] [,2] [1,] 50.0372683 9.50112485 [2,] -0.9691441 0.03342515 $clusinfo size max_diss av_diss isolation [1,] 800 29.51964 9.956571 0.5690241 [2,] 700 33.31923 10.180359 0.6422655 $objective [1] 10.08603 $i.med [1] 613 318 $medoids [,1] [,2] [1,] 50.0627056 9.478225 [2,] -0.2902194 1.026496 $clusinfo size max_diss av_diss isolation [1,] 800 29.51131 9.957225 0.5780037 [2,] 700 33.21560 10.233240 0.6505552 $objective [1] 10.07293 $i.med [1] 618 406 $medoids [,1] [,2] [1,] 50.3621263 9.0207185 [2,] -0.2092816 -0.5916053 $clusinfo size max_diss av_diss isolation [1,] 800 29.25143 9.990206 0.5682446 [2,] 700 34.30301 10.167473 0.6663777 $objective [1] 10.0592 $i.med [1] 1279 1349 $medoids [,1] [,2] [1,] 50.1502433 10.60358224 [2,] -0.9691441 0.03342515 $clusinfo size max_diss av_diss isolation [1,] 800 30.54975 9.953191 0.5852356 [2,] 700 33.31923 10.180359 0.6382900 $objective [1] 10.06241 $i.med [1] 1293 21 $medoids [,1] [,2] [1,] 50.5809098 9.7418386 [2,] -0.9493373 0.3552542 $clusinfo size max_diss av_diss isolation [1,] 800 29.98892 9.949013 0.5725461 [2,] 700 33.12704 10.191999 0.6324587 $objective [1] 10.0592 $i.med [1] 337 675 $medoids [,1] [,2] [1,] -0.9691441 0.03342515 [2,] 50.1502433 10.60358224 $clusinfo size max_diss av_diss isolation [1,] 700 33.31923 10.180359 0.6382900 [2,] 800 30.54975 9.953191 0.5852356 $objective [1] 10.05697 $i.med [1] 22 574 $medoids [,1] [,2] [1,] 50.5809098 9.74183863 [2,] -0.9691441 0.03342515 $clusinfo size max_diss av_diss isolation [1,] 800 29.98892 9.949013 0.5716937 [2,] 700 33.31923 10.180359 0.6351809 $objective [1] 10.05096 $i.med [1] 739 808 $medoids [,1] [,2] [1,] 50.5809098 9.7418386 [2,] -0.2092816 -0.5916053 $clusinfo size max_diss av_diss isolation [1,] 800 29.98892 9.949013 0.5785936 [2,] 700 34.30301 10.167473 0.6618278 $objective [1] 10.06135 $i.med [1] 1431 485 $medoids [,1] [,2] [1,] 50.0627056 9.47822525 [2,] -0.9691441 0.03342515 $clusinfo size max_diss av_diss isolation [1,] 800 29.51131 9.957225 0.5686352 [2,] 700 33.31923 10.180359 0.6420076 $objective [1] 10.05324 $i.med [1] 10 1221 $medoids [,1] [,2] [1,] 50.58090982 9.741838628 [2,] -0.03900399 -0.009078886 $clusinfo size max_diss av_diss isolation [1,] 800 29.98892 9.949013 0.5817385 [2,] 700 34.06055 10.172348 0.6607218 $objective [1] 10.06101 $i.med [1] 1249 1411 $medoids [,1] [,2] [1,] -0.9691441 0.03342515 [2,] 50.0372683 9.50112485 $clusinfo size max_diss av_diss isolation [1,] 700 33.31923 10.180359 0.6422655 [2,] 800 29.51964 9.956571 0.5690241 $objective [1] 10.05296 $i.med [1] 610 21 $medoids [,1] [,2] [1,] -0.3292826 -0.2398794 [2,] 50.0372683 9.5011249 $clusinfo size max_diss av_diss isolation [1,] 700 33.98451 10.163128 0.6624677 [2,] 800 29.51964 9.956571 0.5754330 $objective [1] 10.06486 $i.med [1] 1101 397 $medoids [,1] [,2] [1,] -0.9691441 0.03342515 [2,] 50.1066826 9.35514422 $clusinfo size max_diss av_diss isolation [1,] 700 33.31923 10.180359 0.6417479 [2,] 800 29.42336 9.963794 0.5667111 $objective [1] 10.07521 $i.med [1] 838 356 $medoids [,1] [,2] [1,] 50.36212634 9.020718482 [2,] -0.03900399 -0.009078886 $clusinfo size max_diss av_diss isolation [1,] 800 29.25143 9.990206 0.5712766 [2,] 700 34.06055 10.172348 0.6651980 $objective [1] 10.05906 $i.med [1] 1270 1024 $medoids [,1] [,2] [1,] 50.5455985 9.3904972 [2,] -0.2092816 -0.5916053 $clusinfo size max_diss av_diss isolation [1,] 800 29.66384 9.964205 0.5734673 [2,] 700 34.30301 10.167473 0.6631526 > > clara(x, 2, samples = 101)[clInd] $objective [1] 10.05727 $i.med [1] 286 1115 $medoids [,1] [,2] [1,] -0.03900399 -0.009078886 [2,] 50.03726827 9.501124850 $clusinfo size max_diss av_diss isolation [1,] 700 34.06055 10.172348 0.6682295 [2,] 800 29.51964 9.956571 0.5791419 > clara(x, 2, samples = 149)[clInd] $objective [1] 10.05319 $i.med [1] 238 1272 $medoids [,1] [,2] [1,] -0.2092816 -0.5916053 [2,] 50.1502433 10.6035822 $clusinfo size max_diss av_diss isolation [1,] 700 34.30301 10.167473 0.6649301 [2,] 800 30.54975 9.953191 0.5921768 > clara(x, 2, samples = 200)[clInd] $objective [1] 10.05319 $i.med [1] 238 1272 $medoids [,1] [,2] [1,] -0.2092816 -0.5916053 [2,] 50.1502433 10.6035822 $clusinfo size max_diss av_diss isolation [1,] 700 34.30301 10.167473 0.6649301 [2,] 800 30.54975 9.953191 0.5921768 > ## Note that this last one is practically identical to the slower pam() one > > (ii <- sample(length(x), 20)) [1] 249 452 2663 2537 2235 2421 1004 1834 2602 397 717 2805 1575 1281 283 [16] 1657 1749 820 269 519 > ## This was bogous (and lead to seg.faults); now properly gives error. > ## but for these, now see ./clara-NAs.R > if(FALSE) { ## ~~~~~~~~~~~~~ + x[ii] <- NA + try( clara(x, 2, samples = 50) ) + } > > ###-- Larger example: 2000 objects, divided into 5 clusters. > x5 <- rbind(cbind(rnorm(400, 0,4), rnorm(400, 0,4)), + cbind(rnorm(400,10,8), rnorm(400,40,6)), + cbind(rnorm(400,30,4), rnorm(400, 0,4)), + cbind(rnorm(400,40,4), rnorm(400,20,2)), + cbind(rnorm(400,50,4), rnorm(400,50,4))) > ## plus 1 random dimension > x5 <- cbind(x5, rnorm(nrow(x5))) > > clara(x5, 5) Call: clara(x = x5, k = 5) Medoids: [,1] [,2] [,3] [1,] 0.5850466 -2.222194 -0.63631241 [2,] 8.0131143 42.708122 -0.31693240 [3,] 42.6657812 21.123133 -0.62411426 [4,] 50.6470292 48.480686 -0.09146223 [5,] 28.6470950 -2.544131 -0.22186047 Objective function: 6.100721 Clustering vector: int [1:2000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Cluster sizes: 400 396 408 401 395 Best sample: [1] 23 130 178 202 267 297 338 357 376 387 439 441 638 647 662 [16] 719 723 802 874 880 994 1038 1056 1097 1184 1215 1225 1268 1271 1282 [31] 1346 1442 1446 1474 1496 1515 1585 1590 1605 1641 1680 1687 1696 1728 1742 [46] 1761 1857 1909 1951 1956 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > summary(clara(x5, 5, samples = 50)) Object of class 'clara' from call: clara(x = x5, k = 5, samples = 50) Medoids: [,1] [,2] [,3] [1,] -0.8427864 0.1606105 -0.70362181 [2,] 12.0389703 39.0303445 0.19158023 [3,] 39.6341676 20.7182868 0.43978514 [4,] 50.6470292 48.4806864 -0.09146223 [5,] 30.6814242 -0.1072177 -0.25861548 Objective function: 5.743812 Numerical information per cluster: size max_diss av_diss isolation [1,] 400 15.20728 5.207177 0.4823345 [2,] 397 24.25898 8.677062 0.7324727 [3,] 406 18.39064 4.369617 0.8109074 [4,] 401 18.28050 5.260543 0.6119680 [5,] 396 12.69653 5.243478 0.5598344 Average silhouette width per cluster: [1] 0.7433532 0.6956424 0.7315944 0.7336104 0.7079360 Average silhouette width of best sample: 0.7188531 Best sample: [1] 106 130 145 213 275 316 434 444 486 501 630 693 713 739 773 [16] 804 808 821 823 899 914 948 961 972 980 987 1076 1114 1126 1127 [31] 1169 1175 1203 1225 1228 1242 1269 1397 1405 1421 1595 1606 1658 1703 1777 [46] 1834 1857 1881 1937 1999 Clustering vector: [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [112] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [149] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [186] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [223] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [260] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [297] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [334] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [371] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 [408] 2 3 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [445] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [482] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [519] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [556] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [593] 2 2 2 2 3 2 2 2 2 2 2 2 2 2 2 4 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [630] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [667] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [704] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [741] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [778] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 5 5 5 5 5 5 5 5 5 5 5 5 5 5 [815] 5 3 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 [852] 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 3 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 [889] 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 [926] 5 5 5 5 5 5 5 5 5 3 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 [963] 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 [1000] 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 [1037] 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 [1074] 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 3 5 5 5 5 5 5 5 5 5 5 5 5 5 5 [1111] 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 [1148] 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 [1185] 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 [1222] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 [1259] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 [1296] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 [1333] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 [1370] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 [1407] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 [1444] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 [1481] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 [1518] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 [1555] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 [1592] 3 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 [1629] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 [1666] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 [1703] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 [1740] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 [1777] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 [1814] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 [1851] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 [1888] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 [1925] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 [1962] 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 [1999] 4 4 Silhouette plot information for best sample: cluster neighbor sil_width 130 1 5 0.8123353 275 1 5 0.7945197 316 1 5 0.7561799 213 1 5 0.7459412 106 1 5 0.6869957 145 1 5 0.6641473 630 2 3 0.7819320 739 2 3 0.7774128 486 2 3 0.7559683 713 2 3 0.7316982 444 2 3 0.7204625 501 2 3 0.7091146 773 2 1 0.6886472 693 2 3 0.5855803 434 2 3 0.5099654 1225 3 5 0.8105776 1203 3 5 0.7965773 1595 3 5 0.7842711 1269 3 5 0.7799931 1242 3 5 0.7625442 1397 3 5 0.7315512 1228 3 5 0.7262025 1421 3 5 0.6011616 1405 3 5 0.5914707 1999 4 3 0.8050046 1857 4 3 0.8030709 1658 4 3 0.7941141 1777 4 3 0.7865209 1937 4 3 0.7831996 1881 4 3 0.7504779 1834 4 3 0.6614223 1606 4 3 0.6373808 1703 4 3 0.5813025 804 5 3 0.8021043 987 5 3 0.7999064 1076 5 3 0.7907769 948 5 3 0.7905304 961 5 3 0.7716289 823 5 3 0.7657693 808 5 3 0.7510670 914 5 3 0.7358231 1175 5 3 0.7337485 1169 5 3 0.7254812 972 5 3 0.7118795 821 5 3 0.7101558 899 5 1 0.6580927 1114 5 3 0.6552887 1127 5 3 0.6292428 1126 5 3 0.5362475 980 5 1 0.4671695 1225 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 0.6968 19.3160 34.0920 33.0700 46.2540 92.2530 Metric : euclidean Number of objects : 50 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > ## 3 "half" samples: > clara(x5, 5, samples = 999) Call: clara(x = x5, k = 5, samples = 999) Medoids: [,1] [,2] [,3] [1,] 0.2143499 0.3891695 0.45577894 [2,] 10.9779485 39.6788652 -0.23487762 [3,] 40.2944064 20.2221253 0.21417849 [4,] 50.7170411 49.7645642 -0.43318939 [5,] 29.7257398 -0.5981739 -0.05616701 Objective function: 5.659041 Clustering vector: int [1:2000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Cluster sizes: 400 397 407 401 395 Best sample: [1] 1 2 103 147 155 176 179 247 262 288 365 369 372 470 486 [16] 573 759 779 785 791 797 822 875 883 913 954 1107 1114 1154 1156 [31] 1171 1175 1206 1213 1218 1233 1243 1394 1439 1444 1512 1741 1777 1798 1800 [46] 1818 1845 1946 1948 1973 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > clara(x5, 5, samples = 1000) Call: clara(x = x5, k = 5, samples = 1000) Medoids: [,1] [,2] [,3] [1,] 0.2143499 0.3891695 0.45577894 [2,] 10.9779485 39.6788652 -0.23487762 [3,] 40.2944064 20.2221253 0.21417849 [4,] 50.7170411 49.7645642 -0.43318939 [5,] 29.7257398 -0.5981739 -0.05616701 Objective function: 5.659041 Clustering vector: int [1:2000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Cluster sizes: 400 397 407 401 395 Best sample: [1] 1 2 103 147 155 176 179 247 262 288 365 369 372 470 486 [16] 573 759 779 785 791 797 822 875 883 913 954 1107 1114 1154 1156 [31] 1171 1175 1206 1213 1218 1233 1243 1394 1439 1444 1512 1741 1777 1798 1800 [46] 1818 1845 1946 1948 1973 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > clara(x5, 5, samples = 1001) Call: clara(x = x5, k = 5, samples = 1001) Medoids: [,1] [,2] [,3] [1,] 0.2143499 0.3891695 0.45577894 [2,] 10.9779485 39.6788652 -0.23487762 [3,] 40.2944064 20.2221253 0.21417849 [4,] 50.7170411 49.7645642 -0.43318939 [5,] 29.7257398 -0.5981739 -0.05616701 Objective function: 5.659041 Clustering vector: int [1:2000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Cluster sizes: 400 397 407 401 395 Best sample: [1] 1 2 103 147 155 176 179 247 262 288 365 369 372 470 486 [16] 573 759 779 785 791 797 822 875 883 913 954 1107 1114 1154 1156 [31] 1171 1175 1206 1213 1218 1233 1243 1394 1439 1444 1512 1741 1777 1798 1800 [46] 1818 1845 1946 1948 1973 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > > clara(x5, 5, samples = 2000)#full sample Call: clara(x = x5, k = 5, samples = 2000) Medoids: [,1] [,2] [,3] [1,] 0.2143499 0.3891695 0.45577894 [2,] 10.5993345 39.8970536 -0.39199265 [3,] 40.3370139 20.3148331 -0.06033818 [4,] 50.7170411 49.7645642 -0.43318939 [5,] 29.7257398 -0.5981739 -0.05616701 Objective function: 5.65785 Clustering vector: int [1:2000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Cluster sizes: 400 397 407 401 395 Best sample: [1] 84 106 164 226 284 288 329 423 430 450 469 593 603 654 742 [16] 887 929 970 974 1035 1043 1096 1171 1187 1192 1302 1307 1327 1371 1431 [31] 1433 1439 1440 1452 1513 1522 1525 1548 1565 1593 1620 1639 1654 1688 1740 [46] 1761 1832 1845 1895 1899 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > > ###--- Start a version of example(clara) ------- > > ## xclara : artificial data with 3 clusters of 1000 bivariate objects each. > data(xclara) > (clx3 <- clara(xclara, 3)) Call: clara(x = xclara, k = 3) Medoids: V1 V2 [1,] 5.553391 13.306260 [2,] 43.198760 60.360720 [3,] 74.591890 -6.969018 Objective function: 13.225 Clustering vector: int [1:3000] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... Cluster sizes: 900 1148 952 Best sample: [1] 20 30 46 91 92 169 179 187 209 223 382 450 555 971 1004 [16] 1025 1058 1277 1281 1302 1319 1361 1362 1513 1591 1623 1628 1729 1752 1791 [31] 1907 1917 1946 2064 2089 2498 2527 2537 2545 2591 2672 2722 2729 2790 2797 [46] 2852 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > ## Plot similar to Figure 5 in Struyf et al (1996) > plot(clx3) > > ## The rngR = TRUE case is currently in the non-strict tests > ## ./clara-ex.R > ## ~~~~~~~~~~~~ > > ###--- End version of example(clara) ------- > > ## small example(s): > data(ruspini) > > clara(ruspini,4) Call: clara(x = ruspini, k = 4) Medoids: x y 10 19 65 32 44 149 52 99 119 67 66 18 Objective function: 11.51066 Clustering vector: Named int [1:75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... - attr(*, "names")= chr [1:75] "1" "2" "3" "4" "5" "6" "7" ... Cluster sizes: 20 23 17 15 Best sample: [1] 2 3 4 5 6 7 8 9 10 16 18 19 20 21 22 23 25 29 30 32 34 35 36 37 41 [26] 42 43 44 46 47 49 50 52 53 54 58 59 60 61 63 65 66 67 69 71 72 73 75 Available components: [1] "sample" "medoids" "i.med" "clustering" "objective" [6] "clusinfo" "diss" "call" "silinfo" "data" > > rus <- data.matrix(ruspini); storage.mode(rus) <- "double" > ru2 <- rus[c(1:7,21:28, 45:51, 61:69),] > ru3 <- rus[c(1:4,21:25, 45:48, 61:63),] > ru4 <- rus[c(1:2,21:22, 45:47),] > ru5 <- rus[c(1:2,21, 45),] > daisy(ru5, "manhattan") Dissimilarities : 1 2 21 2 11 21 118 107 45 143 132 89 Metric : manhattan Number of objects : 4 > ## Dissimilarities : 11 118 143 107 132 89 > > ## no problem anymore, since 2002-12-28: > ## sampsize >= k+1 is now enforced: > ## clara(ru5, k=3, met="manhattan", sampsize=3,trace=2)[clInS] > clara(ru5, k=3, met="manhattan", sampsize=4,trace=1)[clInS] C clara(): (nsam,nran,n) = (4,5,4); 'full_sample', -> dysta2(); obj= 2.75 resul(), black() and return() from C. $objective [1] 2.75 $i.med [1] 2 3 4 $medoids x y 2 5 63 21 28 147 45 85 115 $clusinfo size max_diss av_diss isolation [1,] 2 11 5.5 0.1028037 [2,] 1 0 0.0 0.0000000 [3,] 1 0 0.0 0.0000000 $sample [1] "1" "2" "21" "45" > > daisy(ru4, "manhattan") Dissimilarities : 1 2 21 22 45 46 2 11 21 118 107 22 124 113 6 45 143 132 89 87 46 124 113 108 106 19 47 115 104 103 101 28 9 Metric : manhattan Number of objects : 7 > ## this one (k=3) gave problems, from ss = 6 on ___ still after 2002-12-28 ___ : > for(ss in 4:nrow(ru4)){ + cat("---\n\nsample size = ",ss,"\n") + print(clara(ru4,k=3,met="manhattan",sampsize=ss)[clInS]) + } --- sample size = 4 $objective [1] 7.714286 $i.med [1] 1 4 7 $medoids x y 1 4 53 22 32 149 47 78 94 $clusinfo size max_diss av_diss isolation [1,] 2 11 5.50000 0.09565217 [2,] 2 6 3.00000 0.05940594 [3,] 3 28 12.33333 0.27722772 $sample [1] "1" "22" "45" "47" --- sample size = 5 $objective [1] 7.714286 $i.med [1] 2 3 7 $medoids x y 2 5 63 21 28 147 47 78 94 $clusinfo size max_diss av_diss isolation [1,] 2 11 5.50000 0.10576923 [2,] 2 6 3.00000 0.05825243 [3,] 3 28 12.33333 0.27184466 $sample [1] "2" "21" "22" "45" "47" --- sample size = 6 $objective [1] 6.428571 $i.med [1] 2 4 6 $medoids x y 2 5 63 22 32 149 46 85 96 $clusinfo size max_diss av_diss isolation [1,] 2 11 5.500000 0.09734513 [2,] 2 6 3.000000 0.05660377 [3,] 3 19 9.333333 0.17924528 $sample [1] "2" "21" "22" "45" "46" "47" --- sample size = 7 $objective [1] 6.428571 $i.med [1] 2 4 6 $medoids x y 2 5 63 22 32 149 46 85 96 $clusinfo size max_diss av_diss isolation [1,] 2 11 5.500000 0.09734513 [2,] 2 6 3.000000 0.05660377 [3,] 3 19 9.333333 0.17924528 $sample [1] "1" "2" "21" "22" "45" "46" "47" > for(ss in 5:nrow(ru3)){ + cat("---\n\nsample size = ",ss,"\n") + print(clara(ru3,k=4,met="manhattan",sampsize=ss)[clInS]) + } --- sample size = 5 $objective [1] 13.625 $i.med [1] 4 5 10 15 $medoids x y 4 9 77 21 28 147 45 85 115 62 77 12 $clusinfo size max_diss av_diss isolation [1,] 4 29 16.50 0.3258427 [2,] 5 14 9.00 0.1573034 [3,] 4 30 19.25 0.3370787 [4,] 3 15 10.00 0.1351351 $sample [1] "3" "4" "21" "45" "62" --- sample size = 6 $objective [1] 9.0625 $i.med [1] 3 7 13 15 $medoids x y 3 10 59 23 35 153 48 74 96 62 77 12 $clusinfo size max_diss av_diss isolation [1,] 4 19 10.00 0.1881188 [2,] 5 13 5.60 0.1354167 [3,] 4 30 11.75 0.3448276 [4,] 3 15 10.00 0.1724138 $sample [1] "3" "21" "23" "45" "48" "62" --- sample size = 7 $objective [1] 9.0625 $i.med [1] 3 7 13 15 $medoids x y 3 10 59 23 35 153 48 74 96 62 77 12 $clusinfo size max_diss av_diss isolation [1,] 4 19 10.00 0.1881188 [2,] 5 13 5.60 0.1354167 [3,] 4 30 11.75 0.3448276 [4,] 3 15 10.00 0.1724138 $sample [1] "2" "3" "21" "23" "45" "48" "62" --- sample size = 8 $objective [1] 8.8125 $i.med [1] 3 7 12 15 $medoids x y 3 10 59 23 35 153 47 78 94 62 77 12 $clusinfo size max_diss av_diss isolation [1,] 4 19 10.00 0.1844660 [2,] 5 13 5.60 0.1274510 [3,] 4 28 10.75 0.3373494 [4,] 3 15 10.00 0.1807229 $sample [1] "3" "21" "23" "46" "47" "48" "61" "62" --- sample size = 9 $objective [1] 9.3125 $i.med [1] 2 6 11 16 $medoids x y 2 5 63 22 32 149 46 85 96 63 83 21 $clusinfo size max_diss av_diss isolation [1,] 4 18 9.50 0.1592920 [2,] 5 8 5.40 0.0754717 [3,] 4 19 9.75 0.2467532 [4,] 3 30 15.00 0.3896104 $sample [1] "2" "21" "22" "23" "45" "46" "47" "61" "63" --- sample size = 10 $objective [1] 8.5625 $i.med [1] 3 7 11 15 $medoids x y 3 10 59 23 35 153 46 85 96 62 77 12 $clusinfo size max_diss av_diss isolation [1,] 4 19 10.00 0.1696429 [2,] 5 13 5.60 0.1214953 [3,] 4 19 9.75 0.2065217 [4,] 3 15 10.00 0.1630435 $sample [1] "2" "3" "22" "23" "45" "46" "47" "61" "62" "63" --- sample size = 11 $objective [1] 8.6875 $i.med [1] 2 7 12 15 $medoids x y 2 5 63 23 35 153 47 78 94 62 77 12 $clusinfo size max_diss av_diss isolation [1,] 4 18 9.50 0.1730769 [2,] 5 13 5.60 0.1274510 [3,] 4 28 10.75 0.3373494 [4,] 3 15 10.00 0.1807229 $sample [1] "1" "2" "3" "4" "23" "24" "25" "45" "47" "48" "62" --- sample size = 12 $objective [1] 8.8125 $i.med [1] 3 7 12 15 $medoids x y 3 10 59 23 35 153 47 78 94 62 77 12 $clusinfo size max_diss av_diss isolation [1,] 4 19 10.00 0.1844660 [2,] 5 13 5.60 0.1274510 [3,] 4 28 10.75 0.3373494 [4,] 3 15 10.00 0.1807229 $sample [1] "2" "3" "22" "23" "24" "25" "46" "47" "48" "61" "62" "63" --- sample size = 13 $objective [1] 8.4375 $i.med [1] 2 7 11 15 $medoids x y 2 5 63 23 35 153 46 85 96 62 77 12 $clusinfo size max_diss av_diss isolation [1,] 4 18 9.50 0.1592920 [2,] 5 13 5.60 0.1214953 [3,] 4 19 9.75 0.2065217 [4,] 3 15 10.00 0.1630435 $sample [1] "1" "2" "4" "22" "23" "24" "25" "45" "46" "47" "61" "62" "63" --- sample size = 14 $objective [1] 8.4375 $i.med [1] 2 7 11 15 $medoids x y 2 5 63 23 35 153 46 85 96 62 77 12 $clusinfo size max_diss av_diss isolation [1,] 4 18 9.50 0.1592920 [2,] 5 13 5.60 0.1214953 [3,] 4 19 9.75 0.2065217 [4,] 3 15 10.00 0.1630435 $sample [1] "2" "3" "4" "22" "23" "24" "25" "45" "46" "47" "48" "61" "62" "63" --- sample size = 15 $objective [1] 8.375 $i.med [1] 2 6 11 15 $medoids x y 2 5 63 22 32 149 46 85 96 62 77 12 $clusinfo size max_diss av_diss isolation [1,] 4 18 9.50 0.1592920 [2,] 5 8 5.40 0.0754717 [3,] 4 19 9.75 0.2065217 [4,] 3 15 10.00 0.1630435 $sample [1] "2" "3" "4" "21" "22" "23" "24" "25" "45" "46" "47" "48" "61" "62" "63" --- sample size = 16 $objective [1] 8.375 $i.med [1] 2 6 11 15 $medoids x y 2 5 63 22 32 149 46 85 96 62 77 12 $clusinfo size max_diss av_diss isolation [1,] 4 18 9.50 0.1592920 [2,] 5 8 5.40 0.0754717 [3,] 4 19 9.75 0.2065217 [4,] 3 15 10.00 0.1630435 $sample [1] "1" "2" "3" "4" "21" "22" "23" "24" "25" "45" "46" "47" "48" "61" "62" [16] "63" > > ## Last Line: > cat('Time elapsed: ', proc.time() - .proctime00,'\n') Time elapsed: 1.4 0.013 1.433 0 0 > ## Lynne (P IV, 1.6 GHz): 18.81; then (no NA; R 1.9.0-alpha): 15.07 > ## nb-mm (P III,700 MHz): 27.97 > > proc.time() user system elapsed 1.674 0.102 1.917 cluster/tests/pam.R0000644000176200001440000002274714005347470014015 0ustar liggesuserslibrary(cluster) ## Compare on these: nms <- c("clustering", "objective", "isolation", "clusinfo", "silinfo") nm2 <- c("medoids", "id.med", nms) nm3 <- nm2[- pmatch("obj", nm2)] (x <- x0 <- cbind(V1 = (-3:4)^2, V2 = c(0:6,NA), V3 = c(1,2,NA,7,NA,8:9,8))) (px <- pam(x,2, metric="manhattan")) stopifnot(identical(x,x0))# DUP=FALSE .. pd <- pam(dist(x,"manhattan"), 2) px2 <- pam(x,2, metric="manhattan", keep.diss=FALSE, keep.data=FALSE) pdC <- pam(x,2, metric="manhattan", cluster.only = TRUE) p1 <- pam(x,1, metric="manhattan") stopifnot(identical(px[nms], pd[nms]), identical(px[nms], px2[nms]), identical(pdC, px2$clustering), ## and for default dist "euclidean": identical(pam(x, 2)[nms], pam(dist(x),2)[nms]), identical(p1[c("id.med", "objective", "clusinfo")], list(id.med = 6L, objective = c(build=9.25, swap=9.25), clusinfo = array(c(8, 18, 9.25, 45, 0), dim = c(1, 5), dimnames=list(NULL, c("size", "max_diss", "av_diss", "diameter", "separation"))))), p1$clustering == 1, is.null(p1$silinfo) ) set.seed(253) ## generate 250 objects, divided into 2 clusters. x <- rbind(cbind(rnorm(120, 0,8), rnorm(120, 0,8)), cbind(rnorm(130,50,8), rnorm(130,10,8))) .proctime00 <- proc.time() summary(px2 <- pam(x, 2)) pdx <- pam(dist(x), 2) all.equal(px2[nms], pdx[nms], tol = 1e-12) ## TRUE pdxK <- pam(dist(x), 2, keep.diss = TRUE) stopifnot(identical(pdx[nm2], pdxK[nm2])) spdx <- silhouette(pdx) summary(spdx) spdx postscript("pam-tst.ps") if(FALSE) plot(spdx)# the silhouette ## is now identical : plot(pdx)# failed in 1.7.0 -- now only does silhouette par(mfrow = 2:1) ## new 'dist' argument for clusplot(): plot(pdx, dist=dist(x)) ## but this should work automagically (via eval()) as well: plot(pdx) ## or this clusplot(pdx) data(ruspini) summary(pr4 <- pam(ruspini, 4)) (pr3 <- pam(ruspini, 3)) (pr5 <- pam(ruspini, 5)) data(votes.repub) summary(pv3 <- pam(votes.repub, 3)) (pv4 <- pam(votes.repub, 4)) (pv6 <- pam(votes.repub, 6, trace = 3)) cat('Time elapsed: ', proc.time() - .proctime00,'\n') ## re-starting with medoids from pv6 shouldn't change: pv6. <- pam(votes.repub, 6, medoids = pv6$id.med, trace = 3) identical(pv6[nm3], pv6.[nm3]) ## This example seg.faulted at some point: d.st <- data.frame(V1= c(9, 12, 12, 15, 9, 9, 13, 11, 15, 10, 13, 13, 13, 15, 8, 13, 13, 10, 7, 9, 6, 11, 3), V2= c(5, 9, 3, 5, 1, 1, 2, NA, 10, 1, 4, 7, 4, NA, NA, 5, 2, 4, 3, 3, 6, 1, 1), V3 = c(63, 41, 59, 50, 290, 226, 60, 36, 32, 121, 70, 51, 79, 32, 42, 39, 76, 60, 56, 88, 57, 309, 254), V4 = c(146, 43, 78, 88, 314, 149, 78, NA, 238, 153, 159, 222, 203, NA, NA, 74, 100, 111, 9, 180, 50, 256, 107)) dd <- daisy(d.st, stand = TRUE) (r0 <- pam(dd, 5))# cluster 5 = { 23 } -- on single observation ## pam doing the "daisy" computation internally: r0s <- pam(d.st, 5, stand=TRUE, keep.diss=FALSE, keep.data=FALSE) (ii <- which(names(r0) %in% c("call","medoids"))) stopifnot(all.equal(r0[-ii], r0s[-ii], tol=1e-14), identical(r0s$medoids, data.matrix(d.st)[r0$medoids, ])) ## This gave only 3 different medoids -> and seg.fault: (r5 <- pam(dd, 5, medoids = c(1,3,20,2,5), trace = 2)) # now "fine" dev.off() ##------------------------ Testing pam() with new "pamonce" argument: ## This is from "next version of Matrix" test-tools-1.R: showSys.time <- function(expr) { ## prepend 'Time' for R CMD Rdiff st <- system.time(expr) writeLines(paste("Time", capture.output(print(st)))) invisible(st) } show6Ratios <- function(...) { stopifnot(length(rgs <- list(...)) == 6, nchar(ns <- names(rgs)) > 0) r <- round(cbind(..1, ..2, ..3, ..4, ..5, ..6)[c(1,5),], 5) dimnames(r) <- list(paste("Time ", rownames(r)), ns) r } n <- 1000 ## If not enough cases, all CPU times equals 0. n <- 500 # for now, and automatic testing sd <- 0.5 set.seed(13) n2 <- as.integer(round(n * 1.5)) x <- rbind(cbind(rnorm( n,0,sd), rnorm( n,0,sd)), cbind(rnorm(n2,5,sd), rnorm(n2,5,sd)), cbind(rnorm(n2,7,sd), rnorm(n2,7,sd)), cbind(rnorm(n2,9,sd), rnorm(n2,9,sd))) ## original algorithm st0 <- showSys.time(pamx <- pam(x, 4, trace.lev=2))# 8.157 0.024 8.233 ## bswapPamOnce algorithm st1 <- showSys.time(pamxonce <- pam(x, 4, pamonce=TRUE, trace.lev=2))# 6.122 0.024 6.181 ## bswapPamOnceDistIndice st2 <- showSys.time(pamxonce2 <- pam(x, 4, pamonce = 2, trace.lev=2))# 4.101 0.024 4.151 ## bswapPamSchubert FastPAM1 st3 <- showSys.time(pamxonce3 <- pam(x, 4, pamonce = 3, trace.lev=2))# ## bswapPamSchubert FastPAM2 st4 <- showSys.time(pamxonce4 <- pam(x, 4, pamonce = 4, trace.lev=2))# ## bswapPamSchubert FastPAM2 with linearized memory access st5 <- showSys.time(pamxonce5 <- pam(x, 4, pamonce = 5, trace.lev=2))# ## bswapPamSchubert FasterPAM st6 <- showSys.time(pamxonce6 <- pam(x, 4, pamonce = 6, trace.lev=2))# show6Ratios('6:orig' = st6/st0, '5:orig' = st5/st0, '4:orig' = st4/st0, '3:orig' = st3/st0, '2:orig' = st2/st0, '1:orig' = st1/st0) ## only call element is not equal (icall <- which(names(pamx) == "call")) pamx[[icall]] stopifnot(all.equal(pamx [-icall], pamxonce [-icall]), all.equal(pamxonce[-icall], pamxonce2[-icall]), all.equal(pamxonce[-icall], pamxonce3[-icall]), all.equal(pamxonce[-icall], pamxonce4[-icall]), all.equal(pamxonce[-icall], pamxonce5[-icall]), all.equal(pamxonce[-icall], pamxonce6[-icall])) ## Same using specified medoids (med0 <- 1 + round(n* c(0,1, 2.5, 4)))# lynne (~ 2010, AMD Phenom II X4 925) st0 <- showSys.time(pamxst <- pam(x, 4, medoids = med0, trace.lev=2))# 13.071 0.024 13.177 st1 <- showSys.time(pamxoncest <- pam(x, 4, medoids = med0, pamonce=TRUE, trace.lev=2))# 8.503 0.024 8.578 st2 <- showSys.time(pamxonce2st <- pam(x, 4, medoids = med0, pamonce=2, trace.lev=2))# 5.587 0.025 5.647 st3 <- showSys.time(pamxonce3st <- pam(x, 4, medoids = med0, pamonce=3, trace.lev=2))# st4 <- showSys.time(pamxonce4st <- pam(x, 4, medoids = med0, pamonce=4, trace.lev=2))# st5 <- showSys.time(pamxonce5st <- pam(x, 4, medoids = med0, pamonce=5, trace.lev=2))# st6 <- showSys.time(pamxonce6st <- pam(x, 4, medoids = med0, pamonce=6, trace.lev=2))# show6Ratios('6:orig' = st6/st0, '5:orig' = st5/st0, '4:orig' = st4/st0, '3:orig' = st3/st0, '2:orig' = st2/st0, '1:orig' = st1/st0) ## only call element is not equal stopifnot(all.equal(pamxst [-icall], pamxoncest [-icall]), all.equal(pamxoncest[-icall], pamxonce2st[-icall]), all.equal(pamxoncest[-icall], pamxonce3st[-icall]), all.equal(pamxoncest[-icall], pamxonce4st[-icall]), all.equal(pamxoncest[-icall], pamxonce5st[-icall]), all.equal(pamxoncest[-icall], pamxonce6st[-icall])) ## Different starting values med0 <- 1:4 # lynne (~ 2010, AMD Phenom II X4 925) st0 <- showSys.time(pamxst <- pam(x, 4, medoids = med0, trace.lev=2))# 13.416 0.023 13.529 st1 <- showSys.time(pamxoncest <- pam(x, 4, medoids = med0, pamonce=TRUE, trace.lev=2))# 8.384 0.024 8.459 st2 <- showSys.time(pamxonce2st <- pam(x, 4, medoids = med0, pamonce=2, trace.lev=2))# 5.455 0.030 5.520 st3 <- showSys.time(pamxonce3st <- pam(x, 4, medoids = med0, pamonce=3, trace.lev=2))# st4 <- showSys.time(pamxonce4st <- pam(x, 4, medoids = med0, pamonce=4, trace.lev=2))# st5 <- showSys.time(pamxonce5st <- pam(x, 4, medoids = med0, pamonce=5, trace.lev=2))# st6 <- showSys.time(pamxonce6st <- pam(x, 4, medoids = med0, pamonce=6, trace.lev=2))# show6Ratios('6:orig' = st6/st0, '5:orig' = st5/st0, '4:orig' = st4/st0, '3:orig' = st3/st0, '2:orig' = st2/st0, '1:orig' = st1/st0) ## only call element is not equal stopifnot(all.equal(pamxst [-icall], pamxoncest [-icall]), all.equal(pamxoncest[-icall], pamxonce2st[-icall]), all.equal(pamxoncest[-icall], pamxonce3st[-icall]), all.equal(pamxoncest[-icall], pamxonce4st[-icall]), all.equal(pamxoncest[-icall], pamxonce5st[-icall]), all.equal(pamxoncest[-icall], pamxonce6st[-icall])) ## Medoid bug --- MM: Fixed, well "0L+ hack", in my pam.q, on 2012-01-31 ## ---------- med0 <- (1:6) st0 <- showSys.time(pamxst <- pam(x, 6, medoids = med0 , trace.lev=2)) stopifnot(identical(med0, 1:6)) med0 <- (1:6) st1 <- showSys.time(pamxst.1 <- pam(x, 6, medoids = med0 , pamonce=1, trace.lev=2)) stopifnot(identical(med0, 1:6)) med0 <- (1:6) st2 <- showSys.time(pamxst.2 <- pam(x, 6, medoids = med0 , pamonce=2, trace.lev=2)) stopifnot(identical(med0, 1:6)) med0 <- (1:6) st3 <- showSys.time(pamxst.3 <- pam(x, 6, medoids = med0 , pamonce=3, trace.lev=2)) stopifnot(identical(med0, 1:6)) med0 <- (1:6) st4 <- showSys.time(pamxst.4 <- pam(x, 6, medoids = med0 , pamonce=4, trace.lev=2)) stopifnot(identical(med0, 1:6)) med0 <- (1:6) st5 <- showSys.time(pamxst.5 <- pam(x, 6, medoids = med0 , pamonce=5, trace.lev=2)) stopifnot(identical(med0, 1:6)) med0 <- (1:6) st6 <- showSys.time(pamxst.6 <- pam(x, 6, medoids = med0 , pamonce=6, trace.lev=2)) stopifnot(identical(med0, 1:6)) stopifnot(all.equal(pamxst[-icall], pamxst.1 [-icall]), all.equal(pamxst[-icall], pamxst.2 [-icall]), all.equal(pamxst[-icall], pamxst.3 [-icall]), all.equal(pamxst[-icall], pamxst.4 [-icall]), all.equal(pamxst[-icall], pamxst.5 [-icall])) # FasterPAM finds a better solution here, by chance stopifnot(pamxst$objective >= pamxst.6$objective) ## Last Line: cat('Time elapsed: ', proc.time() - .proctime00,'\n') cluster/tests/mona.R0000644000176200001440000000461414466000052014154 0ustar liggesuserslibrary(cluster) data(animals) (mani <- mona(animals, trace=TRUE)) str(mani) ## version of the data withOUT missing: animal.F <- mani$data (maniF <- mona(animal.F, trace=TRUE)) data(plantTraits) ## Now construct 'plantT2' which has *all* binary variables not2 <- vapply(plantTraits, function(var) !(is.factor(var) && nlevels(var) == 2), NA) names(plantTraits)[not2] plantT2 <- plantTraits for(n in names(plantTraits)[not2]) { v <- plantTraits[,n] if(is.factor(v)) { lv <- as.integer(levels(v))# ok for this data v <- as.integer(v) M <- median(lv) } else M <- median(v, na.rm = TRUE) stopifnot(is.finite(M)) plantT2[,n] <- (v <= M) } summary(plantT2) (mon.pl2 <- mona(plantT2, trace = TRUE)) suppressWarnings(RNGversion("3.5.0")) # back compatibility of results set.seed(1) ani.N1 <- animals; ani.N1[cbind(sample.int(20, 10), sample.int(6, 10, replace=TRUE))] <- NA (maniN <- mona(ani.N1, trace=TRUE)) for(seed in c(2:20)) { set.seed(seed); cat("seed = ", seed,"\n") ani.N2 <- animals ani.N2[cbind(sample.int(20, 9), sample.int( 6, 9, replace=TRUE))] <- NA try(print(maniN2 <- mona(ani.N2, trace=TRUE))) } ## Check all "too many NA" and other illegal cases ani.NA <- animals; ani.NA[4,] <- NA aniNA <- within(animals, { end[2:9] <- NA }) aniN2 <- animals; aniN2[cbind(1:6, c(3, 1, 4:6, 2))] <- NA ani.non2 <- within(animals, end[7] <- 3 ) ani.idNA <- within(animals, end[!is.na(end)] <- 1 ) ## use tools::assertError() {once you don't use *.Rout.save anymore} try( mona(ani.NA) ) try( mona(aniNA) ) try( mona(aniN2) ) try( mona(ani.non2) ) try( mona(ani.idNA) ) if(require(MASS, lib.loc=.Library)) withAutoprint({ set.seed(253) n <- 512; p <- 3 Sig <- diag(p); Sig[] <- 0.8 ^ abs(col(Sig) - row(Sig)) x3 <- mvrnorm(n, rep(0,p), Sig) >= 0 x <- cbind(x3, rbinom(n, size=1, prob = 1/2)) sapply(as.data.frame(x), table) mx <- mona(x) str(mx) lapply(mx[c(1,3,4)], table) mx # (too much, but still) }) try( mona(cbind(1:0), trace=2) ) -> et ## error: need p >= 2 stopifnot(inherits(et, "try-error"), grepl("needs at least p >= 2", et)) ## in the past, gave ## Loop npass = 1: (ka,kb) = (1,2) ## for(j ..) -> jma=1, jtel(.,z) = (17952088, 8) --> splitting: (nel; jres, ka, km) = (1; -17952086, 1, 17952089) ## inner loop: for(k in ka:km) use ner[k]: 1 2 2 2 2 2 2 2 2 2 ..... [infinite loop] cluster/tests/pam.Rout.save0000644000176200001440000024051414005347470015474 0ustar liggesusers R version 4.0.3 Patched (2021-01-18 r79850) -- "Bunny-Wunnies Freak Out" Copyright (C) 2021 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) 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. > library(cluster) > ## Compare on these: > nms <- c("clustering", "objective", "isolation", "clusinfo", "silinfo") > nm2 <- c("medoids", "id.med", nms) > nm3 <- nm2[- pmatch("obj", nm2)] > > (x <- x0 <- cbind(V1 = (-3:4)^2, V2 = c(0:6,NA), V3 = c(1,2,NA,7,NA,8:9,8))) V1 V2 V3 [1,] 9 0 1 [2,] 4 1 2 [3,] 1 2 NA [4,] 0 3 7 [5,] 1 4 NA [6,] 4 5 8 [7,] 9 6 9 [8,] 16 NA 8 > (px <- pam(x,2, metric="manhattan")) Medoids: ID V1 V2 V3 [1,] 2 4 1 2 [2,] 6 4 5 8 Clustering vector: [1] 1 1 1 2 2 2 2 2 Objective function: build swap 6.375 6.375 Available components: [1] "medoids" "id.med" "clustering" "objective" "isolation" [6] "clusinfo" "silinfo" "diss" "call" "data" > stopifnot(identical(x,x0))# DUP=FALSE .. > pd <- pam(dist(x,"manhattan"), 2) > px2 <- pam(x,2, metric="manhattan", keep.diss=FALSE, keep.data=FALSE) > pdC <- pam(x,2, metric="manhattan", cluster.only = TRUE) > p1 <- pam(x,1, metric="manhattan") > > stopifnot(identical(px[nms], pd[nms]), + identical(px[nms], px2[nms]), + identical(pdC, px2$clustering), + ## and for default dist "euclidean": + identical(pam(x, 2)[nms], + pam(dist(x),2)[nms]), + identical(p1[c("id.med", "objective", "clusinfo")], + list(id.med = 6L, objective = c(build=9.25, swap=9.25), + clusinfo = array(c(8, 18, 9.25, 45, 0), dim = c(1, 5), + dimnames=list(NULL, c("size", "max_diss", "av_diss", + "diameter", "separation"))))), + p1$clustering == 1, is.null(p1$silinfo) + ) > > set.seed(253) > ## generate 250 objects, divided into 2 clusters. > x <- rbind(cbind(rnorm(120, 0,8), rnorm(120, 0,8)), + cbind(rnorm(130,50,8), rnorm(130,10,8))) > > .proctime00 <- proc.time() > > summary(px2 <- pam(x, 2)) Medoids: ID [1,] 61 -0.7697828 -0.2330187 [2,] 163 49.1392167 9.4097259 Clustering vector: [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [38] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [75] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [112] 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [149] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [186] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 [223] 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 Objective function: build swap 13.25843 10.20817 Numerical information per cluster: size max_diss av_diss diameter separation [1,] 120 31.04843 10.18584 53.22082 9.419035 [2,] 130 26.94337 10.22878 47.86442 9.419035 Isolated clusters: L-clusters: character(0) L*-clusters: character(0) Silhouette plot information: cluster neighbor sil_width 117 1 2 0.80638966 75 1 2 0.80600824 81 1 2 0.80556624 107 1 2 0.80535252 6 1 2 0.80526675 100 1 2 0.80385505 68 1 2 0.80369702 113 1 2 0.80331774 61 1 2 0.80315322 57 1 2 0.80313945 12 1 2 0.80161573 59 1 2 0.80047745 82 1 2 0.79630964 67 1 2 0.79559589 63 1 2 0.79488886 47 1 2 0.79458809 21 1 2 0.79379540 9 1 2 0.79343081 95 1 2 0.79332153 4 1 2 0.79136081 3 1 2 0.79130879 39 1 2 0.79052367 120 1 2 0.78877423 90 1 2 0.78767224 85 1 2 0.78588359 106 1 2 0.78504452 92 1 2 0.78303000 83 1 2 0.78245915 19 1 2 0.78228359 14 1 2 0.78139236 10 1 2 0.77825678 49 1 2 0.77597087 64 1 2 0.77482761 44 1 2 0.77397394 89 1 2 0.77297318 119 1 2 0.77238705 108 1 2 0.77137189 104 1 2 0.76871378 32 1 2 0.76856251 115 1 2 0.76843312 27 1 2 0.76811698 88 1 2 0.76810713 109 1 2 0.76681303 62 1 2 0.76655954 36 1 2 0.76547988 66 1 2 0.76535606 74 1 2 0.76491406 26 1 2 0.76441455 24 1 2 0.76436188 65 1 2 0.76381352 40 1 2 0.76061109 52 1 2 0.75748679 54 1 2 0.75746436 13 1 2 0.75594073 56 1 2 0.75353784 96 1 2 0.75268786 116 1 2 0.75267215 110 1 2 0.75266614 112 1 2 0.75150872 78 1 2 0.75083708 7 1 2 0.74905187 86 1 2 0.74190424 18 1 2 0.74162144 111 1 2 0.74085474 69 1 2 0.74044653 76 1 2 0.73911707 50 1 2 0.73847075 93 1 2 0.73616384 31 1 2 0.73462007 33 1 2 0.73455252 43 1 2 0.73396232 102 1 2 0.72930751 118 1 2 0.72778023 15 1 2 0.72588122 53 1 2 0.72542363 8 1 2 0.72535191 77 1 2 0.72467809 16 1 2 0.72446952 48 1 2 0.72331213 105 1 2 0.72325095 37 1 2 0.72055248 101 1 2 0.71783562 22 1 2 0.71217552 23 1 2 0.71078375 84 1 2 0.70573352 17 1 2 0.70221946 38 1 2 0.69947240 2 1 2 0.69718780 98 1 2 0.69601237 1 1 2 0.69373841 35 1 2 0.69179546 70 1 2 0.69074915 28 1 2 0.68434091 97 1 2 0.68351978 5 1 2 0.67662675 72 1 2 0.67420722 34 1 2 0.67315267 11 1 2 0.67226046 103 1 2 0.67188668 87 1 2 0.67172802 58 1 2 0.67090513 46 1 2 0.66835116 60 1 2 0.66565445 80 1 2 0.65983842 73 1 2 0.65093947 55 1 2 0.64709226 20 1 2 0.64439401 45 1 2 0.63403361 51 1 2 0.63303101 42 1 2 0.62906268 94 1 2 0.60916406 91 1 2 0.59905996 41 1 2 0.57245485 29 1 2 0.55594781 99 1 2 0.55035955 79 1 2 0.50808544 71 1 2 0.46663954 25 1 2 0.43797346 114 1 2 0.16645003 30 1 2 0.08928664 121 2 1 0.80353953 137 2 1 0.80253721 146 2 1 0.80106653 173 2 1 0.80039417 216 2 1 0.79969919 124 2 1 0.79964913 163 2 1 0.79901674 157 2 1 0.79779188 242 2 1 0.79744315 227 2 1 0.79708130 207 2 1 0.79653829 130 2 1 0.79574204 188 2 1 0.79496670 250 2 1 0.79302877 145 2 1 0.79190501 126 2 1 0.79156003 166 2 1 0.79068795 222 2 1 0.78986170 232 2 1 0.78839216 176 2 1 0.78819086 198 2 1 0.78782877 225 2 1 0.78747329 230 2 1 0.78689375 205 2 1 0.78683641 160 2 1 0.78643596 150 2 1 0.78484046 136 2 1 0.78455577 228 2 1 0.78198238 206 2 1 0.78137390 152 2 1 0.78044944 200 2 1 0.77843458 149 2 1 0.77822272 221 2 1 0.77758324 226 2 1 0.77611981 129 2 1 0.77531368 199 2 1 0.77491451 154 2 1 0.77136276 241 2 1 0.77076783 179 2 1 0.77010597 174 2 1 0.76893758 214 2 1 0.76776510 181 2 1 0.76763087 213 2 1 0.76683151 215 2 1 0.76639087 236 2 1 0.76637552 218 2 1 0.76563050 182 2 1 0.76450873 219 2 1 0.76370712 208 2 1 0.76090426 151 2 1 0.75957536 164 2 1 0.75914844 248 2 1 0.75849775 224 2 1 0.75826151 168 2 1 0.75782023 189 2 1 0.75555083 128 2 1 0.75550519 125 2 1 0.75510766 177 2 1 0.75128941 147 2 1 0.75086382 158 2 1 0.75029192 245 2 1 0.74993652 186 2 1 0.74741247 165 2 1 0.74681005 156 2 1 0.74478894 122 2 1 0.74315425 247 2 1 0.74107328 220 2 1 0.74054057 183 2 1 0.73818743 184 2 1 0.73743259 169 2 1 0.73712431 180 2 1 0.73419669 240 2 1 0.73390938 134 2 1 0.73382823 190 2 1 0.73379720 217 2 1 0.73311931 171 2 1 0.73110365 143 2 1 0.72986022 153 2 1 0.72891371 223 2 1 0.72887340 238 2 1 0.72789416 175 2 1 0.72311665 138 2 1 0.72290131 235 2 1 0.72157157 237 2 1 0.71591233 132 2 1 0.71549875 204 2 1 0.71381083 201 2 1 0.71263881 170 2 1 0.70812568 191 2 1 0.70747428 243 2 1 0.70588929 193 2 1 0.70499170 141 2 1 0.70489885 161 2 1 0.70303117 249 2 1 0.69300988 229 2 1 0.69231982 196 2 1 0.69162302 211 2 1 0.69128644 246 2 1 0.68757678 159 2 1 0.68619850 133 2 1 0.68605444 194 2 1 0.68538064 155 2 1 0.68278455 234 2 1 0.68202095 127 2 1 0.68111027 144 2 1 0.67559517 131 2 1 0.65959281 139 2 1 0.65895024 209 2 1 0.65844942 148 2 1 0.65180336 185 2 1 0.64989675 212 2 1 0.63954685 192 2 1 0.63470144 123 2 1 0.63005333 202 2 1 0.61735843 135 2 1 0.61493992 210 2 1 0.60680456 140 2 1 0.58410004 187 2 1 0.58193543 239 2 1 0.57088679 203 2 1 0.56761998 244 2 1 0.55321123 231 2 1 0.55043439 197 2 1 0.52364031 195 2 1 0.51955678 142 2 1 0.47466260 162 2 1 0.46155841 172 2 1 0.45167576 178 2 1 0.42686872 233 2 1 0.37013099 167 2 1 0.32442373 Average silhouette width per cluster: [1] 0.7196104 0.7148520 Average silhouette width of total data set: [1] 0.717136 Available components: [1] "medoids" "id.med" "clustering" "objective" "isolation" [6] "clusinfo" "silinfo" "diss" "call" "data" > pdx <- pam(dist(x), 2) > all.equal(px2[nms], pdx[nms], tol = 1e-12) ## TRUE [1] TRUE > pdxK <- pam(dist(x), 2, keep.diss = TRUE) > stopifnot(identical(pdx[nm2], pdxK[nm2])) > > spdx <- silhouette(pdx) > summary(spdx) Silhouette of 250 units in 2 clusters from pam(x = dist(x), k = 2) : Cluster sizes and average silhouette widths: 120 130 0.7196104 0.7148520 Individual silhouette widths: Min. 1st Qu. Median Mean 3rd Qu. Max. 0.08929 0.69137 0.74397 0.71714 0.77806 0.80639 > spdx cluster neighbor sil_width 117 1 2 0.80638966 75 1 2 0.80600824 81 1 2 0.80556624 107 1 2 0.80535252 6 1 2 0.80526675 100 1 2 0.80385505 68 1 2 0.80369702 113 1 2 0.80331774 61 1 2 0.80315322 57 1 2 0.80313945 12 1 2 0.80161573 59 1 2 0.80047745 82 1 2 0.79630964 67 1 2 0.79559589 63 1 2 0.79488886 47 1 2 0.79458809 21 1 2 0.79379540 9 1 2 0.79343081 95 1 2 0.79332153 4 1 2 0.79136081 3 1 2 0.79130879 39 1 2 0.79052367 120 1 2 0.78877423 90 1 2 0.78767224 85 1 2 0.78588359 106 1 2 0.78504452 92 1 2 0.78303000 83 1 2 0.78245915 19 1 2 0.78228359 14 1 2 0.78139236 10 1 2 0.77825678 49 1 2 0.77597087 64 1 2 0.77482761 44 1 2 0.77397394 89 1 2 0.77297318 119 1 2 0.77238705 108 1 2 0.77137189 104 1 2 0.76871378 32 1 2 0.76856251 115 1 2 0.76843312 27 1 2 0.76811698 88 1 2 0.76810713 109 1 2 0.76681303 62 1 2 0.76655954 36 1 2 0.76547988 66 1 2 0.76535606 74 1 2 0.76491406 26 1 2 0.76441455 24 1 2 0.76436188 65 1 2 0.76381352 40 1 2 0.76061109 52 1 2 0.75748679 54 1 2 0.75746436 13 1 2 0.75594073 56 1 2 0.75353784 96 1 2 0.75268786 116 1 2 0.75267215 110 1 2 0.75266614 112 1 2 0.75150872 78 1 2 0.75083708 7 1 2 0.74905187 86 1 2 0.74190424 18 1 2 0.74162144 111 1 2 0.74085474 69 1 2 0.74044653 76 1 2 0.73911707 50 1 2 0.73847075 93 1 2 0.73616384 31 1 2 0.73462007 33 1 2 0.73455252 43 1 2 0.73396232 102 1 2 0.72930751 118 1 2 0.72778023 15 1 2 0.72588122 53 1 2 0.72542363 8 1 2 0.72535191 77 1 2 0.72467809 16 1 2 0.72446952 48 1 2 0.72331213 105 1 2 0.72325095 37 1 2 0.72055248 101 1 2 0.71783562 22 1 2 0.71217552 23 1 2 0.71078375 84 1 2 0.70573352 17 1 2 0.70221946 38 1 2 0.69947240 2 1 2 0.69718780 98 1 2 0.69601237 1 1 2 0.69373841 35 1 2 0.69179546 70 1 2 0.69074915 28 1 2 0.68434091 97 1 2 0.68351978 5 1 2 0.67662675 72 1 2 0.67420722 34 1 2 0.67315267 11 1 2 0.67226046 103 1 2 0.67188668 87 1 2 0.67172802 58 1 2 0.67090513 46 1 2 0.66835116 60 1 2 0.66565445 80 1 2 0.65983842 73 1 2 0.65093947 55 1 2 0.64709226 20 1 2 0.64439401 45 1 2 0.63403361 51 1 2 0.63303101 42 1 2 0.62906268 94 1 2 0.60916406 91 1 2 0.59905996 41 1 2 0.57245485 29 1 2 0.55594781 99 1 2 0.55035955 79 1 2 0.50808544 71 1 2 0.46663954 25 1 2 0.43797346 114 1 2 0.16645003 30 1 2 0.08928664 121 2 1 0.80353953 137 2 1 0.80253721 146 2 1 0.80106653 173 2 1 0.80039417 216 2 1 0.79969919 124 2 1 0.79964913 163 2 1 0.79901674 157 2 1 0.79779188 242 2 1 0.79744315 227 2 1 0.79708130 207 2 1 0.79653829 130 2 1 0.79574204 188 2 1 0.79496670 250 2 1 0.79302877 145 2 1 0.79190501 126 2 1 0.79156003 166 2 1 0.79068795 222 2 1 0.78986170 232 2 1 0.78839216 176 2 1 0.78819086 198 2 1 0.78782877 225 2 1 0.78747329 230 2 1 0.78689375 205 2 1 0.78683641 160 2 1 0.78643596 150 2 1 0.78484046 136 2 1 0.78455577 228 2 1 0.78198238 206 2 1 0.78137390 152 2 1 0.78044944 200 2 1 0.77843458 149 2 1 0.77822272 221 2 1 0.77758324 226 2 1 0.77611981 129 2 1 0.77531368 199 2 1 0.77491451 154 2 1 0.77136276 241 2 1 0.77076783 179 2 1 0.77010597 174 2 1 0.76893758 214 2 1 0.76776510 181 2 1 0.76763087 213 2 1 0.76683151 215 2 1 0.76639087 236 2 1 0.76637552 218 2 1 0.76563050 182 2 1 0.76450873 219 2 1 0.76370712 208 2 1 0.76090426 151 2 1 0.75957536 164 2 1 0.75914844 248 2 1 0.75849775 224 2 1 0.75826151 168 2 1 0.75782023 189 2 1 0.75555083 128 2 1 0.75550519 125 2 1 0.75510766 177 2 1 0.75128941 147 2 1 0.75086382 158 2 1 0.75029192 245 2 1 0.74993652 186 2 1 0.74741247 165 2 1 0.74681005 156 2 1 0.74478894 122 2 1 0.74315425 247 2 1 0.74107328 220 2 1 0.74054057 183 2 1 0.73818743 184 2 1 0.73743259 169 2 1 0.73712431 180 2 1 0.73419669 240 2 1 0.73390938 134 2 1 0.73382823 190 2 1 0.73379720 217 2 1 0.73311931 171 2 1 0.73110365 143 2 1 0.72986022 153 2 1 0.72891371 223 2 1 0.72887340 238 2 1 0.72789416 175 2 1 0.72311665 138 2 1 0.72290131 235 2 1 0.72157157 237 2 1 0.71591233 132 2 1 0.71549875 204 2 1 0.71381083 201 2 1 0.71263881 170 2 1 0.70812568 191 2 1 0.70747428 243 2 1 0.70588929 193 2 1 0.70499170 141 2 1 0.70489885 161 2 1 0.70303117 249 2 1 0.69300988 229 2 1 0.69231982 196 2 1 0.69162302 211 2 1 0.69128644 246 2 1 0.68757678 159 2 1 0.68619850 133 2 1 0.68605444 194 2 1 0.68538064 155 2 1 0.68278455 234 2 1 0.68202095 127 2 1 0.68111027 144 2 1 0.67559517 131 2 1 0.65959281 139 2 1 0.65895024 209 2 1 0.65844942 148 2 1 0.65180336 185 2 1 0.64989675 212 2 1 0.63954685 192 2 1 0.63470144 123 2 1 0.63005333 202 2 1 0.61735843 135 2 1 0.61493992 210 2 1 0.60680456 140 2 1 0.58410004 187 2 1 0.58193543 239 2 1 0.57088679 203 2 1 0.56761998 244 2 1 0.55321123 231 2 1 0.55043439 197 2 1 0.52364031 195 2 1 0.51955678 142 2 1 0.47466260 162 2 1 0.46155841 172 2 1 0.45167576 178 2 1 0.42686872 233 2 1 0.37013099 167 2 1 0.32442373 attr(,"Ordered") [1] TRUE attr(,"call") pam(x = dist(x), k = 2) attr(,"class") [1] "silhouette" > postscript("pam-tst.ps") > if(FALSE) + plot(spdx)# the silhouette > ## is now identical : > plot(pdx)# failed in 1.7.0 -- now only does silhouette > > par(mfrow = 2:1) > ## new 'dist' argument for clusplot(): > plot(pdx, dist=dist(x)) > ## but this should work automagically (via eval()) as well: > plot(pdx) > ## or this > clusplot(pdx) > > data(ruspini) > summary(pr4 <- pam(ruspini, 4)) Medoids: ID x y 10 10 19 65 32 32 44 149 52 52 99 119 70 70 69 21 Clustering vector: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 3 3 3 3 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 Objective function: build swap 17.22898 11.48637 Numerical information per cluster: size max_diss av_diss diameter separation [1,] 20 24.04163 12.55362 40.24922 40.49691 [2,] 23 26.92582 10.44238 36.61967 24.04163 [3,] 17 33.97058 13.84800 47.63402 24.04163 [4,] 15 17.02939 8.98767 27.07397 40.49691 Isolated clusters: L-clusters: character(0) L*-clusters: [1] 1 4 Silhouette plot information: cluster neighbor sil_width 10 1 4 0.8056096 6 1 4 0.7954977 9 1 4 0.7923048 11 1 4 0.7831672 8 1 2 0.7811793 12 1 4 0.7658171 3 1 4 0.7587961 14 1 4 0.7569107 2 1 4 0.7456150 16 1 4 0.7436018 13 1 4 0.7398841 4 1 2 0.7361533 18 1 4 0.7080079 15 1 4 0.7006854 19 1 4 0.7000938 1 1 4 0.6798381 5 1 4 0.6646571 20 1 4 0.6619626 17 1 4 0.6148541 7 1 2 0.5900575 26 2 3 0.8357433 32 2 3 0.8332753 27 2 3 0.8290271 25 2 3 0.8285547 28 2 3 0.8192636 35 2 3 0.8186309 33 2 3 0.8175087 23 2 3 0.8089969 22 2 3 0.8025389 34 2 3 0.8013310 31 2 3 0.7949677 36 2 3 0.7943536 24 2 3 0.7930770 29 2 3 0.7897346 30 2 3 0.7892027 21 2 3 0.7698024 37 2 3 0.7684502 39 2 3 0.7631648 38 2 3 0.7438848 40 2 3 0.7083130 42 2 3 0.5291270 43 2 3 0.4931623 41 2 3 0.4290814 54 3 2 0.7741745 57 3 2 0.7703455 55 3 2 0.7641810 50 3 2 0.7619943 52 3 2 0.7616220 56 3 2 0.7575313 59 3 2 0.7327828 49 3 2 0.7317002 51 3 2 0.7209864 60 3 2 0.7206840 58 3 2 0.7019611 53 3 2 0.6775322 45 3 2 0.5974787 46 3 2 0.5740823 47 3 2 0.4835635 48 3 2 0.4247331 44 3 2 0.4196093 70 4 1 0.8548947 67 4 1 0.8527439 65 4 1 0.8503105 69 4 1 0.8391810 71 4 1 0.8381065 66 4 1 0.8229841 62 4 1 0.8153092 64 4 1 0.8061254 73 4 1 0.7950213 63 4 1 0.7795369 72 4 1 0.7748121 61 4 1 0.7701103 68 4 1 0.7620559 74 4 1 0.7596815 75 4 1 0.7425538 Average silhouette width per cluster: [1] 0.7262347 0.7548344 0.6691154 0.8042285 Average silhouette width of total data set: [1] 0.737657 2775 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 1.414 40.106 75.591 71.538 99.169 154.500 Metric : euclidean Number of objects : 75 Available components: [1] "medoids" "id.med" "clustering" "objective" "isolation" [6] "clusinfo" "silinfo" "diss" "call" "data" > (pr3 <- pam(ruspini, 3)) Medoids: ID x y 17 17 30 52 32 32 44 149 52 52 99 119 Clustering vector: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 3 3 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 3 3 3 3 3 3 3 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 Objective function: build swap 25.68229 21.59293 Available components: [1] "medoids" "id.med" "clustering" "objective" "isolation" [6] "clusinfo" "silinfo" "diss" "call" "data" > (pr5 <- pam(ruspini, 5)) Medoids: ID x y 10 10 19 65 32 32 44 149 52 52 99 119 47 47 78 94 70 70 69 21 Clustering vector: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 4 4 4 3 3 3 3 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 3 3 3 3 3 3 3 3 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 Objective function: build swap 12.09864 10.39579 Available components: [1] "medoids" "id.med" "clustering" "objective" "isolation" [6] "clusinfo" "silinfo" "diss" "call" "data" > > data(votes.repub) > summary(pv3 <- pam(votes.repub, 3)) Medoids: ID X1856 X1860 X1864 X1868 X1872 X1876 X1880 X1884 X1888 X1892 X1896 Alabama 1 NA NA NA 51.44 53.19 40.02 36.98 38.44 32.28 3.95 28.13 Alaska 2 NA NA NA NA NA NA NA NA NA NA NA New Mexico 31 NA NA NA NA NA NA NA NA NA NA NA X1900 X1904 X1908 X1912 X1916 X1920 X1924 X1928 X1932 X1936 X1940 Alabama 34.67 20.65 24.38 8.26 21.97 30.98 27.01 48.49 14.15 12.82 14.34 Alaska NA NA NA NA NA NA NA NA NA NA NA New Mexico NA NA NA 35.91 46.53 54.68 48.52 59.01 35.76 36.50 43.28 X1944 X1948 X1952 X1956 X1960 X1964 X1968 X1972 X1976 Alabama 18.20 19.04 35.02 39.39 41.75 69.5 14.0 72.4 43.48 Alaska NA NA NA NA 50.94 34.1 45.3 58.1 62.91 New Mexico 46.44 42.93 55.39 57.81 49.41 41.0 51.8 61.0 51.04 Clustering vector: Alabama Alaska Arizona Arkansas California 1 2 3 1 2 Colorado Connecticut Delaware Florida Georgia 2 2 3 1 1 Hawaii Idaho Illinois Indiana Iowa 2 3 2 3 3 Kansas Kentucky Louisiana Maine Maryland 2 3 1 2 3 Massachusetts Michigan Minnesota Mississippi Missouri 3 2 3 1 3 Montana Nebraska Nevada New Hampshire New Jersey 3 3 2 2 2 New Mexico New York North Carolina North Dakota Ohio 3 3 3 2 3 Oklahoma Oregon Pennsylvania Rhode Island South Carolina 3 3 2 3 2 South Dakota Tennessee Texas Utah Vermont 3 3 2 3 2 Virginia Washington West Virginia Wisconsin Wyoming 2 3 3 3 3 Objective function: build swap 38.32548 38.32548 Numerical information per cluster: size max_diss av_diss diameter separation [1,] 6 78.92731 51.59134 116.7048 50.14189 [2,] 18 86.54675 38.47068 271.2455 19.42184 [3,] 26 60.03879 35.16361 124.8324 19.42184 Isolated clusters: L-clusters: character(0) L*-clusters: character(0) Silhouette plot information: cluster neighbor sil_width Louisiana 1 3 0.54689535 Alabama 1 3 0.52839272 Georgia 1 3 0.52730253 Mississippi 1 2 0.52454810 Florida 1 3 0.25211631 Arkansas 1 3 0.24131701 Alaska 2 3 0.15699268 Hawaii 2 3 0.08479842 Vermont 2 3 -0.02620975 Maine 2 3 -0.03284950 Michigan 2 3 -0.11524982 Pennsylvania 2 3 -0.15341477 New Hampshire 2 3 -0.17099889 Connecticut 2 3 -0.19095000 New Jersey 2 3 -0.19281567 Kansas 2 3 -0.19719316 California 2 3 -0.24006293 Illinois 2 3 -0.25236336 North Dakota 2 3 -0.25464430 Virginia 2 3 -0.26262534 Nevada 2 3 -0.27016336 Colorado 2 3 -0.27885043 Texas 2 1 -0.47297583 South Carolina 2 1 -0.50899710 New Mexico 3 2 0.39555584 Washington 3 2 0.32989454 Oklahoma 3 2 0.30953823 Wyoming 3 2 0.30163169 Idaho 3 2 0.29915132 Montana 3 2 0.29105494 Missouri 3 2 0.29038462 Oregon 3 2 0.27710695 Maryland 3 2 0.27437520 West Virginia 3 2 0.27089938 Utah 3 2 0.26964380 Tennessee 3 2 0.26846440 Arizona 3 2 0.25968564 Delaware 3 2 0.25920434 Kentucky 3 2 0.25868341 South Dakota 3 2 0.25615670 Indiana 3 2 0.25031548 Wisconsin 3 2 0.21808013 Ohio 3 2 0.21477474 Nebraska 3 2 0.20965953 North Carolina 3 2 0.19201537 Minnesota 3 2 0.18955165 New York 3 2 0.18820394 Iowa 3 2 0.17296046 Rhode Island 3 2 0.12599915 Massachusetts 3 2 0.12106770 Average silhouette width per cluster: [1] 0.4367620 -0.1876985 0.2497715 Average silhouette width of total data set: [1] 0.1147212 1225 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 17.20 48.34 64.68 82.23 105.49 281.95 Metric : euclidean Number of objects : 50 Available components: [1] "medoids" "id.med" "clustering" "objective" "isolation" [6] "clusinfo" "silinfo" "diss" "call" "data" > (pv4 <- pam(votes.repub, 4)) Medoids: ID X1856 X1860 X1864 X1868 X1872 X1876 X1880 X1884 X1888 X1892 X1896 Alabama 1 NA NA NA 51.44 53.19 40.02 36.98 38.44 32.28 3.95 28.13 Alaska 2 NA NA NA NA NA NA NA NA NA NA NA New Mexico 31 NA NA NA NA NA NA NA NA NA NA NA Iowa 15 49.13 54.87 64.23 61.92 64.18 58.58 56.85 52.42 52.36 49.60 55.46 X1900 X1904 X1908 X1912 X1916 X1920 X1924 X1928 X1932 X1936 X1940 Alabama 34.67 20.65 24.38 8.26 21.97 30.98 27.01 48.49 14.15 12.82 14.34 Alaska NA NA NA NA NA NA NA NA NA NA NA New Mexico NA NA NA 35.91 46.53 54.68 48.52 59.01 35.76 36.50 43.28 Iowa 57.99 63.37 55.62 24.30 54.06 70.91 55.06 61.80 39.98 42.70 52.03 X1944 X1948 X1952 X1956 X1960 X1964 X1968 X1972 X1976 Alabama 18.20 19.04 35.02 39.39 41.75 69.5 14.0 72.4 43.48 Alaska NA NA NA NA 50.94 34.1 45.3 58.1 62.91 New Mexico 46.44 42.93 55.39 57.81 49.41 41.0 51.8 61.0 51.04 Iowa 51.99 47.58 63.76 59.06 56.71 38.1 53.0 57.6 50.51 Clustering vector: Alabama Alaska Arizona Arkansas California 1 2 3 1 2 Colorado Connecticut Delaware Florida Georgia 2 2 3 1 1 Hawaii Idaho Illinois Indiana Iowa 2 3 4 3 4 Kansas Kentucky Louisiana Maine Maryland 4 3 1 2 3 Massachusetts Michigan Minnesota Mississippi Missouri 4 2 4 1 3 Montana Nebraska Nevada New Hampshire New Jersey 3 4 2 2 2 New Mexico New York North Carolina North Dakota Ohio 3 3 3 4 4 Oklahoma Oregon Pennsylvania Rhode Island South Carolina 3 3 4 4 2 South Dakota Tennessee Texas Utah Vermont 4 3 2 3 2 Virginia Washington West Virginia Wisconsin Wyoming 2 3 3 4 3 Objective function: build swap 35.84182 35.84182 Available components: [1] "medoids" "id.med" "clustering" "objective" "isolation" [6] "clusinfo" "silinfo" "diss" "call" "data" > (pv6 <- pam(votes.repub, 6, trace = 3)) C pam(): computing 1226 dissimilarities from 50 x 31 matrix: [Ok] pam()'s bswap(*, s=281.951, pamonce=0): build 6 medoids: new repr. 2 new repr. 1 new repr. 31 new repr. 15 new repr. 46 new repr. 40 after build: medoids are 1 2 15 31 40 46 and min.dist dysma[1:n] are 0 0 37.7 56 35.8 28.5 28.6 31.7 54.1 48.2 51.7 33.2 27.3 30.5 0 35.1 25.4 60.9 36.9 26.7 48.4 28.1 33.2 63.1 21.1 28.6 37.5 35.8 29.8 31.3 0 32 29.9 35.7 30.9 35.1 27.8 35.7 50.2 0 26.2 30.2 45.2 34.1 33.8 0 28.5 35.1 34.2 28.8 swp new 10 <-> 1 old; decreasing diss. 1579.03 by -2.57067 end{bswap()}, end{cstat()} Medoids: ID X1856 X1860 X1864 X1868 X1872 X1876 X1880 X1884 X1888 X1892 Georgia 10 NA NA NA 35.72 43.77 27.94 34.33 33.84 28.33 21.80 Alaska 2 NA NA NA NA NA NA NA NA NA NA Virginia 46 0.19 1.15 NA NA 50.48 40.62 39.52 48.90 49.47 38.75 New Mexico 31 NA NA NA NA NA NA NA NA NA NA Iowa 15 49.13 54.87 64.23 61.92 64.18 58.58 56.85 52.42 52.36 49.60 South Carolina 40 NA NA NA 57.93 75.95 50.26 33.97 23.72 17.27 18.99 X1896 X1900 X1904 X1908 X1912 X1916 X1920 X1924 X1928 X1932 Georgia 36.82 28.56 18.32 31.40 4.27 7.07 28.57 18.19 43.37 7.77 Alaska NA NA NA NA NA NA NA NA NA NA Virginia 45.90 43.81 36.67 38.36 17.00 32.05 37.85 32.79 53.91 30.09 New Mexico NA NA NA NA 35.91 46.53 54.68 48.52 59.01 35.76 Iowa 55.46 57.99 63.37 55.62 24.30 54.06 70.91 55.06 61.80 39.98 South Carolina 13.51 7.04 4.63 5.97 1.06 2.43 3.90 2.21 8.54 1.89 X1936 X1940 X1944 X1948 X1952 X1956 X1960 X1964 X1968 X1972 Georgia 12.60 14.84 18.25 18.31 30.34 33.22 37.44 54.1 30.4 75.0 Alaska NA NA NA NA NA NA 50.94 34.1 45.3 58.1 Virginia 29.39 31.55 37.39 41.04 56.32 55.37 52.44 46.5 41.4 67.8 New Mexico 36.50 43.28 46.44 42.93 55.39 57.81 49.41 41.0 51.8 61.0 Iowa 42.70 52.03 51.99 47.58 63.76 59.06 56.71 38.1 53.0 57.6 South Carolina 1.43 4.37 4.46 3.78 49.28 25.18 48.76 58.9 38.1 70.8 X1976 Georgia 33.02 Alaska 62.91 Virginia 50.73 New Mexico 51.04 Iowa 50.51 South Carolina 43.54 Clustering vector: Alabama Alaska Arizona Arkansas California 1 2 3 3 2 Colorado Connecticut Delaware Florida Georgia 2 2 4 3 1 Hawaii Idaho Illinois Indiana Iowa 2 4 5 4 5 Kansas Kentucky Louisiana Maine Maryland 5 4 1 2 4 Massachusetts Michigan Minnesota Mississippi Missouri 5 2 5 6 4 Montana Nebraska Nevada New Hampshire New Jersey 4 5 2 2 2 New Mexico New York North Carolina North Dakota Ohio 4 4 3 5 5 Oklahoma Oregon Pennsylvania Rhode Island South Carolina 4 4 5 5 6 South Dakota Tennessee Texas Utah Vermont 5 3 2 4 2 Virginia Washington West Virginia Wisconsin Wyoming 3 4 4 5 4 Objective function: build swap 31.58067 31.52926 Available components: [1] "medoids" "id.med" "clustering" "objective" "isolation" [6] "clusinfo" "silinfo" "diss" "call" "data" > > cat('Time elapsed: ', proc.time() - .proctime00,'\n') Time elapsed: 0.392 0.016 0.41 0 0 > > ## re-starting with medoids from pv6 shouldn't change: > pv6. <- pam(votes.repub, 6, medoids = pv6$id.med, trace = 3) C pam(): computing 1226 dissimilarities from 50 x 31 matrix: [Ok] pam()'s bswap(*, s=281.951, pamonce=0): medoids given; after build: medoids are 2 10 15 31 40 46 and min.dist dysma[1:n] are 48.2 0 37.7 56 35.8 28.5 28.6 31.7 54.1 0 51.7 33.2 27.3 30.5 0 35.1 25.4 58.3 36.9 26.7 48.4 28.1 33.2 63.1 21.1 28.6 37.5 35.8 29.8 31.3 0 32 29.9 35.7 30.9 35.1 27.8 35.7 50.2 0 26.2 30.2 45.2 34.1 33.8 0 28.5 35.1 34.2 28.8 end{bswap()}, end{cstat()} > identical(pv6[nm3], pv6.[nm3]) [1] TRUE > > ## This example seg.faulted at some point: > d.st <- data.frame(V1= c(9, 12, 12, 15, 9, 9, 13, 11, 15, 10, 13, 13, + 13, 15, 8, 13, 13, 10, 7, 9, 6, 11, 3), + V2= c(5, 9, 3, 5, 1, 1, 2, NA, 10, 1, 4, 7, + 4, NA, NA, 5, 2, 4, 3, 3, 6, 1, 1), + V3 = c(63, 41, 59, 50, 290, 226, 60, 36, 32, 121, 70, 51, + 79, 32, 42, 39, 76, 60, 56, 88, 57, 309, 254), + V4 = c(146, 43, 78, 88, 314, 149, 78, NA, 238, 153, 159, 222, + 203, NA, NA, 74, 100, 111, 9, 180, 50, 256, 107)) > dd <- daisy(d.st, stand = TRUE) > (r0 <- pam(dd, 5))# cluster 5 = { 23 } -- on single observation Medoids: ID [1,] 15 15 [2,] 8 8 [3,] 14 14 [4,] 22 22 [5,] 23 23 Clustering vector: [1] 1 2 2 3 4 4 2 2 3 2 2 2 2 3 1 2 2 2 1 1 1 4 5 Objective function: build swap 0.9368049 0.8621860 Available components: [1] "medoids" "id.med" "clustering" "objective" "isolation" [6] "clusinfo" "silinfo" "diss" "call" > ## pam doing the "daisy" computation internally: > r0s <- pam(d.st, 5, stand=TRUE, keep.diss=FALSE, keep.data=FALSE) > (ii <- which(names(r0) %in% c("call","medoids"))) [1] 1 9 > stopifnot(all.equal(r0[-ii], r0s[-ii], tol=1e-14), + identical(r0s$medoids, data.matrix(d.st)[r0$medoids, ])) > > ## This gave only 3 different medoids -> and seg.fault: > (r5 <- pam(dd, 5, medoids = c(1,3,20,2,5), trace = 2)) # now "fine" pam()'s bswap(*, s=8.51931, pamonce=0): medoids given; after build: medoids are 1 2 3 5 20 swp new 14 <-> 2 old; decreasing diss. 29.8745 by -5.50096 swp new 15 <-> 1 old; decreasing diss. 24.3735 by -2.20162 swp new 6 <-> 20 old; decreasing diss. 22.1719 by -2.12745 swp new 8 <-> 3 old; decreasing diss. 20.0444 by -0.201608 end{bswap()}, end{cstat()} Medoids: ID [1,] 15 15 [2,] 8 8 [3,] 14 14 [4,] 5 5 [5,] 6 6 Clustering vector: [1] 1 2 2 3 4 5 2 2 3 5 2 2 2 3 1 2 2 2 1 1 1 4 5 Objective function: build swap 1.2988899 0.8627319 Available components: [1] "medoids" "id.med" "clustering" "objective" "isolation" [6] "clusinfo" "silinfo" "diss" "call" > > dev.off() null device 1 > > ##------------------------ Testing pam() with new "pamonce" argument: > > ## This is from "next version of Matrix" test-tools-1.R: > showSys.time <- function(expr) { + ## prepend 'Time' for R CMD Rdiff + st <- system.time(expr) + writeLines(paste("Time", capture.output(print(st)))) + invisible(st) + } > show6Ratios <- function(...) { + stopifnot(length(rgs <- list(...)) == 6, + nchar(ns <- names(rgs)) > 0) + r <- round(cbind(..1, ..2, ..3, ..4, ..5, ..6)[c(1,5),], 5) + dimnames(r) <- list(paste("Time ", rownames(r)), ns) + r + } > > > n <- 1000 > ## If not enough cases, all CPU times equals 0. > n <- 500 # for now, and automatic testing > > sd <- 0.5 > set.seed(13) > n2 <- as.integer(round(n * 1.5)) > x <- rbind(cbind(rnorm( n,0,sd), rnorm( n,0,sd)), + cbind(rnorm(n2,5,sd), rnorm(n2,5,sd)), + cbind(rnorm(n2,7,sd), rnorm(n2,7,sd)), + cbind(rnorm(n2,9,sd), rnorm(n2,9,sd))) > > > ## original algorithm > st0 <- showSys.time(pamx <- pam(x, 4, trace.lev=2))# 8.157 0.024 8.233 C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=0): build 4 medoids: new repr. 1268 new repr. 414 new repr. 2153 new repr. 915 after build: medoids are 414 915 1268 2153 swp new 1793 <-> 1268 old; decreasing diss. 1862.37 by -129.13 end{bswap()}, end{cstat()} Time user system elapsed Time 1.163 0.005 1.176 > ## bswapPamOnce algorithm > st1 <- showSys.time(pamxonce <- pam(x, 4, pamonce=TRUE, trace.lev=2))# 6.122 0.024 6.181 C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=1): build 4 medoids: new repr. 1268 new repr. 414 new repr. 2153 new repr. 915 after build: medoids are 414 915 1268 2153 swp new 1793 <-> 1268 old; decreasing diss. 1862.37 by -129.13 end{bswap()}, end{cstat()} Time user system elapsed Time 0.882 0.015 0.908 > ## bswapPamOnceDistIndice > st2 <- showSys.time(pamxonce2 <- pam(x, 4, pamonce = 2, trace.lev=2))# 4.101 0.024 4.151 C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=2): build 4 medoids: new repr. 1268 new repr. 414 new repr. 2153 new repr. 915 after build: medoids are 414 915 1268 2153 swp new 1793 <-> 1268 old; decreasing diss. 1862.37 by -129.13 end{bswap()}, end{cstat()} Time user system elapsed Time 0.741 0.000 0.746 > ## bswapPamSchubert FastPAM1 > st3 <- showSys.time(pamxonce3 <- pam(x, 4, pamonce = 3, trace.lev=2))# C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=3): build 4 medoids: new repr. 1268 new repr. 414 new repr. 2153 new repr. 915 after build: medoids are 414 915 1268 2153 swp new 1793 <-> 1268 old; decreasing diss. 1862.37 by -129.13 end{bswap()}, end{cstat()} Time user system elapsed Time 0.560 0.001 0.566 > ## bswapPamSchubert FastPAM2 > st4 <- showSys.time(pamxonce4 <- pam(x, 4, pamonce = 4, trace.lev=2))# C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=4): build 4 medoids: new repr. 1268 new repr. 414 new repr. 2153 new repr. 915 after build: medoids are 414 915 1268 2153 swp new 1793 <-> 1268 old; decreasing diss. 1862.37 by -129.13 end{bswap()}, end{cstat()} Time user system elapsed Time 0.637 0.000 0.643 > ## bswapPamSchubert FastPAM2 with linearized memory access > st5 <- showSys.time(pamxonce5 <- pam(x, 4, pamonce = 5, trace.lev=2))# C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=5): build 4 medoids: new repr. 1268 new repr. 414 new repr. 2153 new repr. 915 after build: medoids are 414 915 1268 2153 swp new 1793 <-> 1268 old; decreasing diss. 1862.37 by -129.13 end{bswap()}, end{cstat()} Time user system elapsed Time 0.494 0.000 0.498 > ## bswapPamSchubert FasterPAM > st6 <- showSys.time(pamxonce6 <- pam(x, 4, pamonce = 6, trace.lev=2))# C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=6): build 4 medoids: new repr. 1268 new repr. 414 new repr. 2153 new repr. 915 after build: medoids are 414 915 1268 2153 swp new 1251 <-> 1268 old; decreasing diss. 1862.37 by -27.6945 swp new 1255 <-> 1251 old; decreasing diss. 1834.68 by -81.213 swp new 1259 <-> 1255 old; decreasing diss. 1753.46 by -4.71205 swp new 1265 <-> 1259 old; decreasing diss. 1748.75 by -1.5194 swp new 1280 <-> 1265 old; decreasing diss. 1747.23 by -1.34867 swp new 1300 <-> 1280 old; decreasing diss. 1745.88 by -9.69283 swp new 1421 <-> 1300 old; decreasing diss. 1736.19 by -2.94296 swp new 1793 <-> 1421 old; decreasing diss. 1733.25 by -0.00639415 end{bswap()}, end{cstat()} Time user system elapsed Time 0.483 0.001 0.488 > show6Ratios('6:orig' = st6/st0, '5:orig' = st5/st0, '4:orig' = st4/st0, '3:orig' = st3/st0, '2:orig' = st2/st0, '1:orig' = st1/st0) 6:orig 5:orig 4:orig 3:orig 2:orig 1:orig Time user.self 0.41531 0.42476 0.54772 0.48151 0.63715 0.75838 Time sys.child NaN NaN NaN NaN NaN NaN > > ## only call element is not equal > (icall <- which(names(pamx) == "call")) [1] 9 > pamx[[icall]] pam(x = x, k = 4, trace.lev = 2) > stopifnot(all.equal(pamx [-icall], pamxonce [-icall]), + all.equal(pamxonce[-icall], pamxonce2[-icall]), + all.equal(pamxonce[-icall], pamxonce3[-icall]), + all.equal(pamxonce[-icall], pamxonce4[-icall]), + all.equal(pamxonce[-icall], pamxonce5[-icall]), + all.equal(pamxonce[-icall], pamxonce6[-icall])) > > ## Same using specified medoids > (med0 <- 1 + round(n* c(0,1, 2.5, 4)))# lynne (~ 2010, AMD Phenom II X4 925) [1] 1 501 1251 2001 > st0 <- showSys.time(pamxst <- pam(x, 4, medoids = med0, trace.lev=2))# 13.071 0.024 13.177 C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=0): medoids given; after build: medoids are 1 501 1251 2001 swp new 915 <-> 501 old; decreasing diss. 2126.83 by -197.507 swp new 1793 <-> 1251 old; decreasing diss. 1929.32 by -101.336 swp new 414 <-> 1 old; decreasing diss. 1827.98 by -86.3404 swp new 2153 <-> 2001 old; decreasing diss. 1741.64 by -8.40201 end{bswap()}, end{cstat()} Time user system elapsed Time 1.720 0.000 1.732 > st1 <- showSys.time(pamxoncest <- pam(x, 4, medoids = med0, pamonce=TRUE, trace.lev=2))# 8.503 0.024 8.578 C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=1): medoids given; after build: medoids are 1 501 1251 2001 swp new 915 <-> 501 old; decreasing diss. 2126.83 by -197.507 swp new 1793 <-> 1251 old; decreasing diss. 1929.32 by -101.336 swp new 414 <-> 1 old; decreasing diss. 1827.98 by -86.3404 swp new 2153 <-> 2001 old; decreasing diss. 1741.64 by -8.40201 end{bswap()}, end{cstat()} Time user system elapsed Time 1.319 0.000 1.329 > st2 <- showSys.time(pamxonce2st <- pam(x, 4, medoids = med0, pamonce=2, trace.lev=2))# 5.587 0.025 5.647 C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=2): medoids given; after build: medoids are 1 501 1251 2001 swp new 915 <-> 501 old; decreasing diss. 2126.83 by -197.507 swp new 1793 <-> 1251 old; decreasing diss. 1929.32 by -101.336 swp new 414 <-> 1 old; decreasing diss. 1827.98 by -86.3404 swp new 2153 <-> 2001 old; decreasing diss. 1741.64 by -8.40201 end{bswap()}, end{cstat()} Time user system elapsed Time 0.915 0.001 0.922 > st3 <- showSys.time(pamxonce3st <- pam(x, 4, medoids = med0, pamonce=3, trace.lev=2))# C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=3): medoids given; after build: medoids are 1 501 1251 2001 swp new 915 <-> 501 old; decreasing diss. 2126.83 by -197.507 swp new 1793 <-> 1251 old; decreasing diss. 1929.32 by -101.336 swp new 414 <-> 1 old; decreasing diss. 1827.98 by -86.3404 swp new 2153 <-> 2001 old; decreasing diss. 1741.64 by -8.40201 end{bswap()}, end{cstat()} Time user system elapsed Time 0.442 0.001 0.445 > st4 <- showSys.time(pamxonce4st <- pam(x, 4, medoids = med0, pamonce=4, trace.lev=2))# C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=4): medoids given; after build: medoids are 1 501 1251 2001 swp new 915 <-> 501 old; decreasing diss. 2126.83 by -197.507 fswp new 1421 <-> 1251 old; decreasing diss. 1929.32 by -101.326 fswp new 414 <-> 1 old; decreasing diss. 1827.99 by -86.3404 fswp new 2153 <-> 2001 old; decreasing diss. 1741.65 by -8.40546 swp new 1793 <-> 1421 old; decreasing diss. 1733.25 by -0.00639415 end{bswap()}, end{cstat()} Time user system elapsed Time 0.329 0.000 0.331 > st5 <- showSys.time(pamxonce5st <- pam(x, 4, medoids = med0, pamonce=5, trace.lev=2))# C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=5): medoids given; after build: medoids are 1 501 1251 2001 swp new 915 <-> 501 old; decreasing diss. 2126.83 by -197.507 fswp new 1421 <-> 1251 old; decreasing diss. 1929.32 by -101.326 fswp new 414 <-> 1 old; decreasing diss. 1827.99 by -86.3404 fswp new 2153 <-> 2001 old; decreasing diss. 1741.65 by -8.40546 swp new 1793 <-> 1421 old; decreasing diss. 1733.25 by -0.00639415 end{bswap()}, end{cstat()} Time user system elapsed Time 0.289 0.000 0.290 > st6 <- showSys.time(pamxonce6st <- pam(x, 4, medoids = med0, pamonce=6, trace.lev=2))# C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=6): medoids given; after build: medoids are 1 501 1251 2001 swp new 8 <-> 1 old; decreasing diss. 2126.83 by -33.2528 swp new 12 <-> 8 old; decreasing diss. 2093.57 by -32.0203 swp new 15 <-> 12 old; decreasing diss. 2061.55 by -2.88573 swp new 16 <-> 15 old; decreasing diss. 2058.67 by -3.50571 swp new 33 <-> 16 old; decreasing diss. 2055.16 by -0.382726 swp new 56 <-> 33 old; decreasing diss. 2054.78 by -0.660581 swp new 70 <-> 56 old; decreasing diss. 2054.12 by -9.63432 swp new 86 <-> 70 old; decreasing diss. 2044.48 by -2.56554 swp new 123 <-> 86 old; decreasing diss. 2041.92 by -1.30247 swp new 414 <-> 123 old; decreasing diss. 2040.62 by -0.130313 swp new 502 <-> 501 old; decreasing diss. 2040.49 by -36.5109 swp new 507 <-> 502 old; decreasing diss. 2003.97 by -131.351 swp new 509 <-> 507 old; decreasing diss. 1872.62 by -14.3528 swp new 530 <-> 509 old; decreasing diss. 1858.27 by -7.60641 swp new 542 <-> 530 old; decreasing diss. 1850.66 by -2.78128 swp new 574 <-> 542 old; decreasing diss. 1847.88 by -4.18202 swp new 913 <-> 574 old; decreasing diss. 1843.7 by -0.343729 swp new 915 <-> 913 old; decreasing diss. 1843.36 by -0.378301 swp new 1255 <-> 1251 old; decreasing diss. 1842.98 by -81.0222 swp new 1259 <-> 1255 old; decreasing diss. 1761.96 by -4.71205 swp new 1265 <-> 1259 old; decreasing diss. 1757.24 by -1.6954 swp new 1280 <-> 1265 old; decreasing diss. 1755.55 by -1.25118 swp new 1300 <-> 1280 old; decreasing diss. 1754.3 by -9.70566 swp new 1421 <-> 1300 old; decreasing diss. 1744.59 by -2.93951 swp new 1793 <-> 1421 old; decreasing diss. 1741.65 by -0.00984953 swp new 2089 <-> 2001 old; decreasing diss. 1741.64 by -3.18091 swp new 2153 <-> 2089 old; decreasing diss. 1738.46 by -5.2211 end{bswap()}, end{cstat()} Time user system elapsed Time 0.227 0.000 0.228 > show6Ratios('6:orig' = st6/st0, '5:orig' = st5/st0, '4:orig' = st4/st0, '3:orig' = st3/st0, '2:orig' = st2/st0, '1:orig' = st1/st0) 6:orig 5:orig 4:orig 3:orig 2:orig 1:orig Time user.self 0.13198 0.16802 0.19128 0.25698 0.53198 0.76686 Time sys.child NaN NaN NaN NaN NaN NaN > > ## only call element is not equal > stopifnot(all.equal(pamxst [-icall], pamxoncest [-icall]), + all.equal(pamxoncest[-icall], pamxonce2st[-icall]), + all.equal(pamxoncest[-icall], pamxonce3st[-icall]), + all.equal(pamxoncest[-icall], pamxonce4st[-icall]), + all.equal(pamxoncest[-icall], pamxonce5st[-icall]), + all.equal(pamxoncest[-icall], pamxonce6st[-icall])) > > ## Different starting values > med0 <- 1:4 # lynne (~ 2010, AMD Phenom II X4 925) > st0 <- showSys.time(pamxst <- pam(x, 4, medoids = med0, trace.lev=2))# 13.416 0.023 13.529 C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=0): medoids given; after build: medoids are 1 2 3 4 swp new 1421 <-> 4 old; decreasing diss. 21009.4 by -15939.9 swp new 2153 <-> 3 old; decreasing diss. 5069.52 by -1657.88 swp new 915 <-> 2 old; decreasing diss. 3411.65 by -1592.06 swp new 414 <-> 1 old; decreasing diss. 1819.59 by -86.3404 swp new 1793 <-> 1421 old; decreasing diss. 1733.25 by -0.00639415 end{bswap()}, end{cstat()} Time user system elapsed Time 1.727 0.000 1.732 > st1 <- showSys.time(pamxoncest <- pam(x, 4, medoids = med0, pamonce=TRUE, trace.lev=2))# 8.384 0.024 8.459 C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=1): medoids given; after build: medoids are 1 2 3 4 swp new 1421 <-> 4 old; decreasing diss. 21009.4 by -15939.9 swp new 2153 <-> 3 old; decreasing diss. 5069.52 by -1657.88 swp new 915 <-> 2 old; decreasing diss. 3411.65 by -1592.06 swp new 414 <-> 1 old; decreasing diss. 1819.59 by -86.3404 swp new 1793 <-> 1421 old; decreasing diss. 1733.25 by -0.00639415 end{bswap()}, end{cstat()} Time user system elapsed Time 1.362 0.000 1.366 > st2 <- showSys.time(pamxonce2st <- pam(x, 4, medoids = med0, pamonce=2, trace.lev=2))# 5.455 0.030 5.520 C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=2): medoids given; after build: medoids are 1 2 3 4 swp new 1421 <-> 4 old; decreasing diss. 21009.4 by -15939.9 swp new 2153 <-> 3 old; decreasing diss. 5069.52 by -1657.88 swp new 915 <-> 2 old; decreasing diss. 3411.65 by -1592.06 swp new 414 <-> 1 old; decreasing diss. 1819.59 by -86.3404 swp new 1793 <-> 1421 old; decreasing diss. 1733.25 by -0.00639415 end{bswap()}, end{cstat()} Time user system elapsed Time 0.926 0.000 0.929 > st3 <- showSys.time(pamxonce3st <- pam(x, 4, medoids = med0, pamonce=3, trace.lev=2))# C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=3): medoids given; after build: medoids are 1 2 3 4 swp new 1421 <-> 4 old; decreasing diss. 21009.4 by -15939.9 swp new 2153 <-> 3 old; decreasing diss. 5069.52 by -1657.88 swp new 915 <-> 2 old; decreasing diss. 3411.65 by -1592.06 swp new 414 <-> 1 old; decreasing diss. 1819.59 by -86.3404 swp new 1793 <-> 1421 old; decreasing diss. 1733.25 by -0.00639415 end{bswap()}, end{cstat()} Time user system elapsed Time 0.504 0.000 0.505 > st4 <- showSys.time(pamxonce4st <- pam(x, 4, medoids = med0, pamonce=4, trace.lev=2))# C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=4): medoids given; after build: medoids are 1 2 3 4 swp new 1421 <-> 4 old; decreasing diss. 21009.4 by -15939.9 swp new 2153 <-> 3 old; decreasing diss. 5069.52 by -1657.88 swp new 915 <-> 2 old; decreasing diss. 3411.65 by -1592.06 swp new 414 <-> 1 old; decreasing diss. 1819.59 by -86.3404 fswp new 1793 <-> 1421 old; decreasing diss. 1733.25 by -0.00639415 end{bswap()}, end{cstat()} Time user system elapsed Time 0.449 0.000 0.451 > st5 <- showSys.time(pamxonce5st <- pam(x, 4, medoids = med0, pamonce=5, trace.lev=2))# C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=5): medoids given; after build: medoids are 1 2 3 4 swp new 1421 <-> 4 old; decreasing diss. 21009.4 by -15939.9 swp new 2153 <-> 3 old; decreasing diss. 5069.52 by -1657.88 swp new 915 <-> 2 old; decreasing diss. 3411.65 by -1592.06 swp new 414 <-> 1 old; decreasing diss. 1819.59 by -86.3404 fswp new 1793 <-> 1421 old; decreasing diss. 1733.25 by -0.00639415 end{bswap()}, end{cstat()} Time user system elapsed Time 0.338 0.000 0.340 > st6 <- showSys.time(pamxonce6st <- pam(x, 4, medoids = med0, pamonce=6, trace.lev=2))# C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=6): medoids given; after build: medoids are 1 2 3 4 swp new 7 <-> 3 old; decreasing diss. 21009.4 by -4.9986 swp new 8 <-> 2 old; decreasing diss. 21004.4 by -16.4723 swp new 11 <-> 7 old; decreasing diss. 20987.9 by -12.0798 swp new 12 <-> 8 old; decreasing diss. 20975.9 by -3.31491 swp new 13 <-> 1 old; decreasing diss. 20972.5 by -4.88251 swp new 14 <-> 13 old; decreasing diss. 20967.7 by -1.90148 swp new 15 <-> 14 old; decreasing diss. 20965.8 by -9.59363 swp new 22 <-> 11 old; decreasing diss. 20956.2 by -10.0478 swp new 24 <-> 15 old; decreasing diss. 20946.1 by -7.99457 swp new 26 <-> 12 old; decreasing diss. 20938.1 by -3.0991 swp new 44 <-> 22 old; decreasing diss. 20935 by -880.436 swp new 45 <-> 4 old; decreasing diss. 20054.6 by -9.44638 swp new 55 <-> 26 old; decreasing diss. 20045.1 by -1.77816 swp new 57 <-> 24 old; decreasing diss. 20043.4 by -1.76138 swp new 58 <-> 44 old; decreasing diss. 20041.6 by -178.122 swp new 63 <-> 45 old; decreasing diss. 19863.5 by -0.34634 swp new 71 <-> 57 old; decreasing diss. 19863.1 by -1.49747 swp new 75 <-> 63 old; decreasing diss. 19861.6 by -1.31804 swp new 76 <-> 71 old; decreasing diss. 19860.3 by -1.42789 swp new 80 <-> 55 old; decreasing diss. 19858.9 by -5.29615 swp new 81 <-> 75 old; decreasing diss. 19853.6 by -0.164308 swp new 83 <-> 76 old; decreasing diss. 19853.4 by -0.0877432 swp new 115 <-> 81 old; decreasing diss. 19853.3 by -0.303527 swp new 171 <-> 58 old; decreasing diss. 19853 by -971.874 swp new 185 <-> 115 old; decreasing diss. 18881.2 by -0.471238 swp new 192 <-> 80 old; decreasing diss. 18880.7 by -0.294662 swp new 257 <-> 185 old; decreasing diss. 18880.4 by -0.466733 swp new 290 <-> 257 old; decreasing diss. 18879.9 by -0.105762 swp new 309 <-> 83 old; decreasing diss. 18879.8 by -0.0395709 swp new 419 <-> 192 old; decreasing diss. 18879.8 by -0.0439214 swp new 425 <-> 309 old; decreasing diss. 18879.7 by -0.136105 swp new 471 <-> 425 old; decreasing diss. 18879.6 by -0.244642 swp new 501 <-> 171 old; decreasing diss. 18879.4 by -11830.7 swp new 502 <-> 471 old; decreasing diss. 7048.64 by -273.113 swp new 503 <-> 290 old; decreasing diss. 6775.52 by -813.133 swp new 504 <-> 502 old; decreasing diss. 5962.39 by -20.8894 swp new 507 <-> 504 old; decreasing diss. 5941.5 by -42.7153 swp new 515 <-> 501 old; decreasing diss. 5898.79 by -0.453931 swp new 523 <-> 515 old; decreasing diss. 5898.33 by -67.1248 swp new 526 <-> 507 old; decreasing diss. 5831.21 by -0.673248 swp new 527 <-> 526 old; decreasing diss. 5830.53 by -2.26904 swp new 537 <-> 503 old; decreasing diss. 5828.26 by -3.1636 swp new 542 <-> 527 old; decreasing diss. 5825.1 by -2.0623 swp new 545 <-> 542 old; decreasing diss. 5823.04 by -17.9136 swp new 547 <-> 523 old; decreasing diss. 5805.13 by -194.143 swp new 573 <-> 547 old; decreasing diss. 5610.98 by -607.192 swp new 576 <-> 545 old; decreasing diss. 5003.79 by -0.801911 swp new 579 <-> 573 old; decreasing diss. 5002.99 by -347.734 swp new 592 <-> 576 old; decreasing diss. 4655.26 by -0.997177 swp new 604 <-> 592 old; decreasing diss. 4654.26 by -0.808458 swp new 617 <-> 604 old; decreasing diss. 4653.45 by -1.02162 swp new 813 <-> 537 old; decreasing diss. 4652.43 by -0.254896 swp new 883 <-> 617 old; decreasing diss. 4652.17 by -1.83048 swp new 955 <-> 813 old; decreasing diss. 4650.34 by -0.591944 swp new 1015 <-> 883 old; decreasing diss. 4649.75 by -0.0303283 swp new 1016 <-> 955 old; decreasing diss. 4649.72 by -0.343593 swp new 1086 <-> 1016 old; decreasing diss. 4649.38 by -0.0942057 swp new 1088 <-> 1015 old; decreasing diss. 4649.28 by -0.0747132 swp new 1111 <-> 1086 old; decreasing diss. 4649.21 by -0.996659 swp new 1131 <-> 1088 old; decreasing diss. 4648.21 by -0.773913 swp new 1134 <-> 1111 old; decreasing diss. 4647.44 by -0.174449 swp new 1151 <-> 1131 old; decreasing diss. 4647.26 by -0.319467 swp new 1251 <-> 579 old; decreasing diss. 4646.94 by -1367.16 swp new 1252 <-> 1251 old; decreasing diss. 3279.79 by -27.203 swp new 1253 <-> 1151 old; decreasing diss. 3252.58 by -137.657 swp new 1255 <-> 1252 old; decreasing diss. 3114.93 by -52.4651 swp new 1257 <-> 1253 old; decreasing diss. 3062.46 by -42.3678 swp new 1259 <-> 1255 old; decreasing diss. 3020.09 by -1.87135 swp new 1266 <-> 1257 old; decreasing diss. 3018.22 by -90.6385 swp new 1280 <-> 1259 old; decreasing diss. 2927.58 by -20.3614 swp new 1283 <-> 1266 old; decreasing diss. 2907.22 by -272.98 swp new 1288 <-> 1280 old; decreasing diss. 2634.24 by -1.69952 swp new 1300 <-> 1288 old; decreasing diss. 2632.54 by -9.58469 swp new 1325 <-> 1300 old; decreasing diss. 2622.96 by -7.37653 swp new 1612 <-> 1283 old; decreasing diss. 2615.58 by -2.38886 swp new 2001 <-> 1612 old; decreasing diss. 2613.19 by -788.545 swp new 2089 <-> 2001 old; decreasing diss. 1824.65 by -3.28836 swp new 2153 <-> 2089 old; decreasing diss. 1821.36 by -5.16445 swp new 12 <-> 419 old; decreasing diss. 1816.19 by -28.3676 swp new 15 <-> 12 old; decreasing diss. 1787.83 by -2.88573 swp new 16 <-> 15 old; decreasing diss. 1784.94 by -3.50571 swp new 33 <-> 16 old; decreasing diss. 1781.43 by -0.382726 swp new 56 <-> 33 old; decreasing diss. 1781.05 by -0.660581 swp new 70 <-> 56 old; decreasing diss. 1780.39 by -9.63432 swp new 86 <-> 70 old; decreasing diss. 1770.76 by -2.56554 swp new 123 <-> 86 old; decreasing diss. 1768.19 by -1.30247 swp new 414 <-> 123 old; decreasing diss. 1766.89 by -0.130313 swp new 507 <-> 1134 old; decreasing diss. 1766.76 by -1.67967 swp new 509 <-> 507 old; decreasing diss. 1765.08 by -11.8255 swp new 530 <-> 509 old; decreasing diss. 1753.25 by -9.54887 swp new 542 <-> 530 old; decreasing diss. 1743.7 by -2.59694 swp new 574 <-> 542 old; decreasing diss. 1741.11 by -3.50085 swp new 913 <-> 574 old; decreasing diss. 1737.61 by -0.356354 swp new 915 <-> 913 old; decreasing diss. 1737.25 by -0.471447 swp new 1300 <-> 1325 old; decreasing diss. 1736.78 by -0.589135 swp new 1421 <-> 1300 old; decreasing diss. 1736.19 by -2.94296 swp new 1793 <-> 1421 old; decreasing diss. 1733.25 by -0.00639415 end{bswap()}, end{cstat()} Time user system elapsed Time 0.258 0.000 0.259 > show6Ratios('6:orig' = st6/st0, '5:orig' = st5/st0, '4:orig' = st4/st0, '3:orig' = st3/st0, '2:orig' = st2/st0, '1:orig' = st1/st0) 6:orig 5:orig 4:orig 3:orig 2:orig 1:orig Time user.self 0.14939 0.19572 0.25999 0.29184 0.53619 0.78865 Time sys.child NaN NaN NaN NaN NaN NaN > > ## only call element is not equal > stopifnot(all.equal(pamxst [-icall], pamxoncest [-icall]), + all.equal(pamxoncest[-icall], pamxonce2st[-icall]), + all.equal(pamxoncest[-icall], pamxonce3st[-icall]), + all.equal(pamxoncest[-icall], pamxonce4st[-icall]), + all.equal(pamxoncest[-icall], pamxonce5st[-icall]), + all.equal(pamxoncest[-icall], pamxonce6st[-icall])) > > > ## Medoid bug --- MM: Fixed, well "0L+ hack", in my pam.q, on 2012-01-31 > ## ---------- > med0 <- (1:6) > st0 <- showSys.time(pamxst <- pam(x, 6, medoids = med0 , trace.lev=2)) C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=0): medoids given; after build: medoids are 1 2 3 4 5 6 swp new 1421 <-> 6 old; decreasing diss. 20991.1 by -15949.5 swp new 2153 <-> 4 old; decreasing diss. 5041.66 by -1676.25 swp new 915 <-> 3 old; decreasing diss. 3365.41 by -1671.37 swp new 325 <-> 2 old; decreasing diss. 1694.04 by -53.8582 swp new 2720 <-> 5 old; decreasing diss. 1640.18 by -26.6572 swp new 2696 <-> 2153 old; decreasing diss. 1613.53 by -19.0531 swp new 52 <-> 1 old; decreasing diss. 1594.47 by -13.965 swp new 2709 <-> 2720 old; decreasing diss. 1580.51 by -5.81848 swp new 199 <-> 325 old; decreasing diss. 1574.69 by -2.65496 swp new 438 <-> 52 old; decreasing diss. 1572.03 by -1.77054 swp new 2082 <-> 2696 old; decreasing diss. 1570.26 by -0.187256 end{bswap()}, end{cstat()} Time user system elapsed Time 4.345 0.000 4.357 > stopifnot(identical(med0, 1:6)) > med0 <- (1:6) > st1 <- showSys.time(pamxst.1 <- pam(x, 6, medoids = med0 , pamonce=1, trace.lev=2)) C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=1): medoids given; after build: medoids are 1 2 3 4 5 6 swp new 1421 <-> 6 old; decreasing diss. 20991.1 by -15949.5 swp new 2153 <-> 4 old; decreasing diss. 5041.66 by -1676.25 swp new 915 <-> 3 old; decreasing diss. 3365.41 by -1671.37 swp new 325 <-> 2 old; decreasing diss. 1694.04 by -53.8582 swp new 2720 <-> 5 old; decreasing diss. 1640.18 by -26.6572 swp new 2696 <-> 2153 old; decreasing diss. 1613.53 by -19.0531 swp new 52 <-> 1 old; decreasing diss. 1594.47 by -13.965 swp new 2709 <-> 2720 old; decreasing diss. 1580.51 by -5.81848 swp new 199 <-> 325 old; decreasing diss. 1574.69 by -2.65496 swp new 438 <-> 52 old; decreasing diss. 1572.03 by -1.77054 swp new 2082 <-> 2696 old; decreasing diss. 1570.26 by -0.187256 end{bswap()}, end{cstat()} Time user system elapsed Time 3.753 0.000 3.763 > stopifnot(identical(med0, 1:6)) > med0 <- (1:6) > st2 <- showSys.time(pamxst.2 <- pam(x, 6, medoids = med0 , pamonce=2, trace.lev=2)) C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=2): medoids given; after build: medoids are 1 2 3 4 5 6 swp new 1421 <-> 6 old; decreasing diss. 20991.1 by -15949.5 swp new 2153 <-> 4 old; decreasing diss. 5041.66 by -1676.25 swp new 915 <-> 3 old; decreasing diss. 3365.41 by -1671.37 swp new 325 <-> 2 old; decreasing diss. 1694.04 by -53.8582 swp new 2720 <-> 5 old; decreasing diss. 1640.18 by -26.6572 swp new 2696 <-> 2153 old; decreasing diss. 1613.53 by -19.0531 swp new 52 <-> 1 old; decreasing diss. 1594.47 by -13.965 swp new 2709 <-> 2720 old; decreasing diss. 1580.51 by -5.81848 swp new 199 <-> 325 old; decreasing diss. 1574.69 by -2.65496 swp new 438 <-> 52 old; decreasing diss. 1572.03 by -1.77054 swp new 2082 <-> 2696 old; decreasing diss. 1570.26 by -0.187256 end{bswap()}, end{cstat()} Time user system elapsed Time 2.519 0.001 2.530 > stopifnot(identical(med0, 1:6)) > med0 <- (1:6) > st3 <- showSys.time(pamxst.3 <- pam(x, 6, medoids = med0 , pamonce=3, trace.lev=2)) C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=3): medoids given; after build: medoids are 1 2 3 4 5 6 swp new 1421 <-> 6 old; decreasing diss. 20991.1 by -15949.5 swp new 2153 <-> 4 old; decreasing diss. 5041.66 by -1676.25 swp new 915 <-> 3 old; decreasing diss. 3365.41 by -1671.37 swp new 325 <-> 2 old; decreasing diss. 1694.04 by -53.8582 swp new 2720 <-> 5 old; decreasing diss. 1640.18 by -26.6572 swp new 2696 <-> 2153 old; decreasing diss. 1613.53 by -19.0531 swp new 52 <-> 1 old; decreasing diss. 1594.47 by -13.965 swp new 2709 <-> 2720 old; decreasing diss. 1580.51 by -5.81848 swp new 199 <-> 325 old; decreasing diss. 1574.69 by -2.65496 swp new 438 <-> 52 old; decreasing diss. 1572.03 by -1.77054 swp new 2082 <-> 2696 old; decreasing diss. 1570.26 by -0.187256 end{bswap()}, end{cstat()} Time user system elapsed Time 0.854 0.000 0.857 > stopifnot(identical(med0, 1:6)) > med0 <- (1:6) > st4 <- showSys.time(pamxst.4 <- pam(x, 6, medoids = med0 , pamonce=4, trace.lev=2)) C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=4): medoids given; after build: medoids are 1 2 3 4 5 6 swp new 1421 <-> 6 old; decreasing diss. 20991.1 by -15949.5 swp new 2153 <-> 4 old; decreasing diss. 5041.66 by -1676.25 swp new 915 <-> 3 old; decreasing diss. 3365.41 by -1671.37 swp new 325 <-> 2 old; decreasing diss. 1694.04 by -53.8582 fswp new 2720 <-> 5 old; decreasing diss. 1640.18 by -26.6572 swp new 2696 <-> 2153 old; decreasing diss. 1613.53 by -19.0531 fswp new 52 <-> 1 old; decreasing diss. 1594.47 by -13.965 swp new 2709 <-> 2720 old; decreasing diss. 1580.51 by -5.81848 fswp new 199 <-> 325 old; decreasing diss. 1574.69 by -2.65496 swp new 438 <-> 52 old; decreasing diss. 1572.03 by -1.77054 fswp new 2082 <-> 2696 old; decreasing diss. 1570.26 by -0.187256 end{bswap()}, end{cstat()} Time user system elapsed Time 0.619 0.000 0.620 > stopifnot(identical(med0, 1:6)) > med0 <- (1:6) > st5 <- showSys.time(pamxst.5 <- pam(x, 6, medoids = med0 , pamonce=5, trace.lev=2)) C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=5): medoids given; after build: medoids are 1 2 3 4 5 6 swp new 1421 <-> 6 old; decreasing diss. 20991.1 by -15949.5 swp new 2153 <-> 4 old; decreasing diss. 5041.66 by -1676.25 swp new 915 <-> 3 old; decreasing diss. 3365.41 by -1671.37 swp new 325 <-> 2 old; decreasing diss. 1694.04 by -53.8582 fswp new 2720 <-> 5 old; decreasing diss. 1640.18 by -26.6572 swp new 2696 <-> 2153 old; decreasing diss. 1613.53 by -19.0531 fswp new 52 <-> 1 old; decreasing diss. 1594.47 by -13.965 swp new 2709 <-> 2720 old; decreasing diss. 1580.51 by -5.81848 fswp new 199 <-> 325 old; decreasing diss. 1574.69 by -2.65496 swp new 438 <-> 52 old; decreasing diss. 1572.03 by -1.77054 fswp new 2082 <-> 2696 old; decreasing diss. 1570.26 by -0.187256 end{bswap()}, end{cstat()} Time user system elapsed Time 0.473 0.001 0.476 > stopifnot(identical(med0, 1:6)) > med0 <- (1:6) > st6 <- showSys.time(pamxst.6 <- pam(x, 6, medoids = med0 , pamonce=6, trace.lev=2)) C pam(): computing 3779876 dissimilarities from 2750 x 2 matrix: [Ok] pam()'s bswap(*, s=15.7788, pamonce=6): medoids given; after build: medoids are 1 2 3 4 5 6 swp new 7 <-> 6 old; decreasing diss. 20991.1 by -3.78677 swp new 8 <-> 5 old; decreasing diss. 20987.4 by -25.0122 swp new 9 <-> 2 old; decreasing diss. 20962.3 by -6.53934 swp new 10 <-> 7 old; decreasing diss. 20955.8 by -0.133503 swp new 11 <-> 9 old; decreasing diss. 20955.7 by -14.9294 swp new 12 <-> 10 old; decreasing diss. 20940.7 by -2.35016 swp new 13 <-> 12 old; decreasing diss. 20938.4 by -12.1267 swp new 14 <-> 11 old; decreasing diss. 20926.3 by -2.99664 swp new 15 <-> 13 old; decreasing diss. 20923.3 by -11.5871 swp new 20 <-> 1 old; decreasing diss. 20911.7 by -0.0423835 swp new 22 <-> 3 old; decreasing diss. 20911.6 by -8.76936 swp new 23 <-> 20 old; decreasing diss. 20902.9 by -0.779336 swp new 39 <-> 15 old; decreasing diss. 20902.1 by -0.285867 swp new 44 <-> 4 old; decreasing diss. 20901.8 by -889.012 swp new 45 <-> 14 old; decreasing diss. 20012.8 by -0.586001 swp new 46 <-> 45 old; decreasing diss. 20012.2 by -1.1479 swp new 57 <-> 39 old; decreasing diss. 20011.1 by -3.67274 swp new 58 <-> 44 old; decreasing diss. 20007.4 by -189.36 swp new 62 <-> 23 old; decreasing diss. 19818 by -0.626154 swp new 66 <-> 46 old; decreasing diss. 19817.4 by -1.29082 swp new 68 <-> 22 old; decreasing diss. 19816.1 by -0.580804 swp new 75 <-> 62 old; decreasing diss. 19815.5 by -0.860328 swp new 76 <-> 57 old; decreasing diss. 19814.7 by -1.97434 swp new 171 <-> 58 old; decreasing diss. 19812.7 by -968.625 swp new 185 <-> 75 old; decreasing diss. 18844.1 by -0.12972 swp new 198 <-> 68 old; decreasing diss. 18843.9 by -0.533904 swp new 204 <-> 198 old; decreasing diss. 18843.4 by -0.00928895 swp new 218 <-> 185 old; decreasing diss. 18843.4 by -0.0287215 swp new 280 <-> 204 old; decreasing diss. 18843.4 by -0.913559 swp new 329 <-> 280 old; decreasing diss. 18842.5 by -0.101916 swp new 361 <-> 8 old; decreasing diss. 18842.3 by -0.0966188 swp new 402 <-> 361 old; decreasing diss. 18842.3 by -0.0394578 swp new 501 <-> 171 old; decreasing diss. 18842.2 by -11833 swp new 502 <-> 66 old; decreasing diss. 7009.24 by -309.206 swp new 503 <-> 329 old; decreasing diss. 6700.03 by -887.644 swp new 504 <-> 76 old; decreasing diss. 5812.39 by -28.554 swp new 506 <-> 504 old; decreasing diss. 5783.83 by -14.2809 swp new 507 <-> 506 old; decreasing diss. 5769.55 by -19.8604 swp new 508 <-> 507 old; decreasing diss. 5749.69 by -7.88586 swp new 515 <-> 501 old; decreasing diss. 5741.8 by -3.36477 swp new 519 <-> 502 old; decreasing diss. 5738.44 by -1.16993 swp new 523 <-> 515 old; decreasing diss. 5737.27 by -71.9147 swp new 526 <-> 508 old; decreasing diss. 5665.35 by -1.56708 swp new 533 <-> 526 old; decreasing diss. 5663.79 by -1.652 swp new 537 <-> 519 old; decreasing diss. 5662.14 by -0.283073 swp new 540 <-> 537 old; decreasing diss. 5661.85 by -2.35314 swp new 545 <-> 533 old; decreasing diss. 5659.5 by -2.94604 swp new 547 <-> 503 old; decreasing diss. 5656.55 by -221.229 swp new 573 <-> 547 old; decreasing diss. 5435.32 by -574.75 swp new 575 <-> 523 old; decreasing diss. 4860.57 by -17.1525 swp new 579 <-> 573 old; decreasing diss. 4843.42 by -346.495 swp new 593 <-> 575 old; decreasing diss. 4496.93 by -2.83188 swp new 594 <-> 540 old; decreasing diss. 4494.1 by -0.50804 swp new 618 <-> 545 old; decreasing diss. 4493.59 by -0.137577 swp new 660 <-> 618 old; decreasing diss. 4493.45 by -4.45459 swp new 663 <-> 593 old; decreasing diss. 4489 by -0.912682 swp new 709 <-> 663 old; decreasing diss. 4488.08 by -1.44419 swp new 848 <-> 594 old; decreasing diss. 4486.64 by -0.00137738 swp new 991 <-> 709 old; decreasing diss. 4486.64 by -0.173764 swp new 1242 <-> 660 old; decreasing diss. 4486.46 by -0.244432 swp new 1251 <-> 579 old; decreasing diss. 4486.22 by -1369.29 swp new 1252 <-> 402 old; decreasing diss. 3116.93 by -58.5165 swp new 1253 <-> 1252 old; decreasing diss. 3058.42 by -169.451 swp new 1255 <-> 1251 old; decreasing diss. 2888.97 by -30.8092 swp new 1257 <-> 848 old; decreasing diss. 2858.16 by -70.3794 swp new 1262 <-> 1255 old; decreasing diss. 2787.78 by -29.3154 swp new 1266 <-> 1253 old; decreasing diss. 2758.46 by -64.8733 swp new 1282 <-> 1262 old; decreasing diss. 2693.59 by -0.803303 swp new 1283 <-> 1257 old; decreasing diss. 2692.79 by -238.314 swp new 1284 <-> 1266 old; decreasing diss. 2454.47 by -6.79018 swp new 1289 <-> 1284 old; decreasing diss. 2447.68 by -6.25715 swp new 1291 <-> 1289 old; decreasing diss. 2441.42 by -1.33251 swp new 1293 <-> 1291 old; decreasing diss. 2440.09 by -4.73682 swp new 1299 <-> 1293 old; decreasing diss. 2435.35 by -5.10123 swp new 1301 <-> 1282 old; decreasing diss. 2430.25 by -3.83834 swp new 1322 <-> 1301 old; decreasing diss. 2426.41 by -1.61521 swp new 1332 <-> 1322 old; decreasing diss. 2424.8 by -1.66893 swp new 1335 <-> 1299 old; decreasing diss. 2423.13 by -9.28429 swp new 1374 <-> 1332 old; decreasing diss. 2413.85 by -1.14706 swp new 1469 <-> 1374 old; decreasing diss. 2412.7 by -0.0376604 swp new 1583 <-> 1335 old; decreasing diss. 2412.66 by -0.0266074 swp new 1612 <-> 1283 old; decreasing diss. 2412.64 by -1.78413 swp new 2001 <-> 1612 old; decreasing diss. 2410.85 by -794.078 swp new 2089 <-> 2001 old; decreasing diss. 1616.77 by -3.16676 swp new 2153 <-> 2089 old; decreasing diss. 1613.61 by -5.2914 swp new 12 <-> 218 old; decreasing diss. 1608.32 by -9.02144 swp new 15 <-> 12 old; decreasing diss. 1599.29 by -2.88573 swp new 16 <-> 15 old; decreasing diss. 1596.41 by -3.50571 swp new 33 <-> 16 old; decreasing diss. 1592.9 by -0.382726 swp new 56 <-> 33 old; decreasing diss. 1592.52 by -0.660581 swp new 70 <-> 56 old; decreasing diss. 1591.86 by -9.63432 swp new 86 <-> 70 old; decreasing diss. 1582.22 by -2.56554 swp new 123 <-> 86 old; decreasing diss. 1579.66 by -1.30247 swp new 414 <-> 123 old; decreasing diss. 1578.36 by -0.130313 swp new 507 <-> 1242 old; decreasing diss. 1578.23 by -16.7114 swp new 513 <-> 991 old; decreasing diss. 1561.51 by -2.15127 swp new 518 <-> 507 old; decreasing diss. 1559.36 by -7.23052 swp new 556 <-> 518 old; decreasing diss. 1552.13 by -1.79073 swp new 622 <-> 513 old; decreasing diss. 1550.34 by -0.947204 swp new 822 <-> 556 old; decreasing diss. 1549.4 by -0.320612 swp new 926 <-> 622 old; decreasing diss. 1549.07 by -1.31521 swp new 1106 <-> 926 old; decreasing diss. 1547.76 by -0.187491 swp new 1124 <-> 822 old; decreasing diss. 1547.57 by -0.261824 swp new 1194 <-> 1124 old; decreasing diss. 1547.31 by -0.0387596 swp new 1256 <-> 1583 old; decreasing diss. 1547.27 by -1.04235 swp new 1262 <-> 1469 old; decreasing diss. 1546.23 by -2.25214 swp new 1429 <-> 1256 old; decreasing diss. 1543.98 by -0.359624 swp new 1592 <-> 1429 old; decreasing diss. 1543.62 by -0.641983 swp new 2286 <-> 2153 old; decreasing diss. 1542.98 by -0.109986 swp new 2482 <-> 2286 old; decreasing diss. 1542.87 by -0.0744393 end{bswap()}, end{cstat()} Time user system elapsed Time 0.282 0.001 0.284 > stopifnot(identical(med0, 1:6)) > stopifnot(all.equal(pamxst[-icall], pamxst.1 [-icall]), + all.equal(pamxst[-icall], pamxst.2 [-icall]), + all.equal(pamxst[-icall], pamxst.3 [-icall]), + all.equal(pamxst[-icall], pamxst.4 [-icall]), + all.equal(pamxst[-icall], pamxst.5 [-icall])) > # FasterPAM finds a better solution here, by chance > stopifnot(pamxst$objective >= pamxst.6$objective) > > > ## Last Line: > cat('Time elapsed: ', proc.time() - .proctime00,'\n') Time elapsed: 29.923 0.049 30.113 0 0 > > > proc.time() user system elapsed 30.026 0.082 30.241 cluster/tests/mona.Rout.save0000644000176200001440000042732214466000052015646 0ustar liggesusers R version 4.3.1 Patched (2023-08-12 r84937) -- "Beagle Scouts" Copyright (C) 2023 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) 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. > library(cluster) > > data(animals) > (mani <- mona(animals, trace=TRUE)) Loop npass = 1: (ka,kb) = (1,20) for(j ..) -> jma=1, jtel(.,z) = (10, 10) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 10, 10, 11) --> nclu = 2, kwan[ka] = 10 L500; found kwan[1] = 10 >= 2 ==> Loop again Loop npass = 2: (ka,kb) = (1,10) for(j ..) -> jma=3, jtel(.,z) = (4, 6) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 6, 4, 7) --> nclu = 3, kwan[ka] = 4 Loop npass = 2: (ka,kb) = (11,20) for(j ..) -> jma=2, jtel(.,z) = (2, 8) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 8, 2, 19) --> nclu = 4, kwan[ka] = 2 L500; found kwan[1] = 6 >= 2 ==> Loop again Loop npass = 3: (ka,kb) = (1,6) for(j ..) -> jma=2, jtel(.,z) = (2, 4) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 4, 2, 5) --> nclu = 5, kwan[ka] = 2 Loop npass = 3: (ka,kb) = (7,10) for(j ..) -> jma=4, jtel(.,z) = (1, 3) --> splitting: ka=7, ner[ka]=11 => (nzf, jtel2, jres, km) = (0, 1, 3, 8) --> nclu = 6, kwan[ka] = 3 Loop npass = 3: (ka,kb) = (11,18) for(j ..) -> jma=4, jtel(.,z) = (5, 3) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 3, 5, 14) --> nclu = 7, kwan[ka] = 5 Loop npass = 3: (ka,kb) = (19,20) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> splitting: ka=19, ner[ka]=7 => (nzf, jtel2, jres, km) = (1, 1, 1, 20) --> nclu = 8, kwan[ka] = 1 L500; found kwan[1] = 4 >= 2 ==> Loop again Loop npass = 4: (ka,kb) = (1,4) for(j ..) -> jma=5, jtel(.,z) = (1, 3) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 1, 3, 2) --> nclu = 9, kwan[ka] = 3 Loop npass = 4: (ka,kb) = (5,6) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=5, ner[ka]=2 => (nzf, jtel2, jres, km) = (0, 1, 1, 6) --> nclu = 10, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (8,10) for(j ..) -> jma=5, jtel(.,z) = (1, 2) --> splitting: ka=8, ner[ka]=12 => (nzf, jtel2, jres, km) = (0, 1, 2, 9) --> nclu = 11, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (11,13) for(j ..) -> jma=5, jtel(.,z) = (2, 1) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 1, 2, 12) --> nclu = 12, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (14,18) for(j ..) -> jma=6, jtel(.,z) = (3, 2) --> splitting: ka=14, ner[ka]=5 => (nzf, jtel2, jres, km) = (0, 3, 2, 17) --> nclu = 13, kwan[ka] = 2 L500; found kwan[2] = 3 >= 2 ==> Loop again Loop npass = 5: (ka,kb) = (2,4) for(j ..) -> jma=6, jtel(.,z) = (2, 1) --> splitting: ka=2, ner[ka]=4 => (nzf, jtel2, jres, km) = (0, 2, 1, 4) --> nclu = 14, kwan[ka] = 1 Loop npass = 5: (ka,kb) = (9,10) for(j ..) -> jma=6, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 14, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (12,13) for(j ..) -> jma=6, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 14, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (14,16) for(j ..) -> jma=6, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 14, kwan[ka] = -3 Loop npass = 5: (ka,kb) = (17,18) for(j ..) -> jma=6, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 14, kwan[ka] = -2 L500; found kwan[2] = 2 >= 2 ==> Loop again Loop npass = 6: (ka,kb) = (2,3) for(j ..) -> jma=6, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 14, kwan[ka] = -2 mona(x, ..) fit; x of dimension 20x6 Because of NA's, revised data: war fly ver end gro hai ant 0 0 0 0 1 0 bee 0 1 0 0 1 1 cat 1 0 1 0 0 1 cpl 0 0 0 0 0 1 chi 1 0 1 1 1 1 cow 1 0 1 0 1 1 duc 1 1 1 0 1 0 eag 1 1 1 1 0 0 ele 1 0 1 1 1 0 fly 0 1 0 0 0 0 fro 0 0 1 1 0 0 her 0 0 1 0 1 0 lio 1 0 1 1 1 1 liz 0 0 1 0 0 0 lob 0 0 0 0 0 0 man 1 0 1 1 1 1 rab 1 0 1 0 1 1 sal 0 0 1 0 0 0 spi 0 0 0 0 0 1 wha 1 0 1 1 1 0 Order of objects: [1] ant cpl spi lob bee fly fro her liz sal cat cow rab chi lio man ele wha duc [20] eag Variable used: [1] gro NULL hai fly gro ver end gro NULL war gro NULL end NULL NULL [16] hai NULL fly end Separation step: [1] 4 0 5 3 4 2 3 4 0 1 4 0 3 0 0 4 0 2 3 Available components: [1] "data" "hasNA" "order" "variable" "step" "order.lab" [7] "call" > str(mani) List of 7 $ data : int [1:20, 1:6] 0 0 1 0 1 1 1 1 1 0 ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr [1:20] "ant" "bee" "cat" "cpl" ... .. ..$ : chr [1:6] "war" "fly" "ver" "end" ... $ hasNA : logi TRUE $ order : int [1:20] 1 4 19 15 2 10 11 12 14 18 ... $ variable : chr [1:19] "gro" "NULL" "hai" "fly" ... $ step : int [1:19] 4 0 5 3 4 2 3 4 0 1 ... $ order.lab: chr [1:20] "ant" "cpl" "spi" "lob" ... $ call : language mona(x = animals, trace.lev = TRUE) - attr(*, "class")= chr "mona" > ## version of the data withOUT missing: > animal.F <- mani$data > (maniF <- mona(animal.F, trace=TRUE)) Loop npass = 1: (ka,kb) = (1,20) for(j ..) -> jma=1, jtel(.,z) = (10, 10) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 10, 10, 11) --> nclu = 2, kwan[ka] = 10 L500; found kwan[1] = 10 >= 2 ==> Loop again Loop npass = 2: (ka,kb) = (1,10) for(j ..) -> jma=3, jtel(.,z) = (4, 6) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 6, 4, 7) --> nclu = 3, kwan[ka] = 4 Loop npass = 2: (ka,kb) = (11,20) for(j ..) -> jma=2, jtel(.,z) = (2, 8) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 8, 2, 19) --> nclu = 4, kwan[ka] = 2 L500; found kwan[1] = 6 >= 2 ==> Loop again Loop npass = 3: (ka,kb) = (1,6) for(j ..) -> jma=2, jtel(.,z) = (2, 4) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 4, 2, 5) --> nclu = 5, kwan[ka] = 2 Loop npass = 3: (ka,kb) = (7,10) for(j ..) -> jma=4, jtel(.,z) = (1, 3) --> splitting: ka=7, ner[ka]=11 => (nzf, jtel2, jres, km) = (0, 1, 3, 8) --> nclu = 6, kwan[ka] = 3 Loop npass = 3: (ka,kb) = (11,18) for(j ..) -> jma=4, jtel(.,z) = (5, 3) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 3, 5, 14) --> nclu = 7, kwan[ka] = 5 Loop npass = 3: (ka,kb) = (19,20) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> splitting: ka=19, ner[ka]=7 => (nzf, jtel2, jres, km) = (1, 1, 1, 20) --> nclu = 8, kwan[ka] = 1 L500; found kwan[1] = 4 >= 2 ==> Loop again Loop npass = 4: (ka,kb) = (1,4) for(j ..) -> jma=5, jtel(.,z) = (1, 3) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 1, 3, 2) --> nclu = 9, kwan[ka] = 3 Loop npass = 4: (ka,kb) = (5,6) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=5, ner[ka]=2 => (nzf, jtel2, jres, km) = (0, 1, 1, 6) --> nclu = 10, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (8,10) for(j ..) -> jma=5, jtel(.,z) = (1, 2) --> splitting: ka=8, ner[ka]=12 => (nzf, jtel2, jres, km) = (0, 1, 2, 9) --> nclu = 11, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (11,13) for(j ..) -> jma=5, jtel(.,z) = (2, 1) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 1, 2, 12) --> nclu = 12, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (14,18) for(j ..) -> jma=6, jtel(.,z) = (3, 2) --> splitting: ka=14, ner[ka]=5 => (nzf, jtel2, jres, km) = (0, 3, 2, 17) --> nclu = 13, kwan[ka] = 2 L500; found kwan[2] = 3 >= 2 ==> Loop again Loop npass = 5: (ka,kb) = (2,4) for(j ..) -> jma=6, jtel(.,z) = (2, 1) --> splitting: ka=2, ner[ka]=4 => (nzf, jtel2, jres, km) = (0, 2, 1, 4) --> nclu = 14, kwan[ka] = 1 Loop npass = 5: (ka,kb) = (9,10) for(j ..) -> jma=6, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 14, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (12,13) for(j ..) -> jma=6, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 14, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (14,16) for(j ..) -> jma=6, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 14, kwan[ka] = -3 Loop npass = 5: (ka,kb) = (17,18) for(j ..) -> jma=6, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 14, kwan[ka] = -2 L500; found kwan[2] = 2 >= 2 ==> Loop again Loop npass = 6: (ka,kb) = (2,3) for(j ..) -> jma=6, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 14, kwan[ka] = -2 mona(x, ..) fit; x of dimension 20x6 Order of objects: [1] ant cpl spi lob bee fly fro her liz sal cat cow rab chi lio man ele wha duc [20] eag Variable used: [1] gro NULL hai fly gro ver end gro NULL war gro NULL end NULL NULL [16] hai NULL fly end Separation step: [1] 4 0 5 3 4 2 3 4 0 1 4 0 3 0 0 4 0 2 3 Available components: [1] "data" "hasNA" "order" "variable" "step" "order.lab" [7] "call" > > data(plantTraits) > ## Now construct 'plantT2' which has *all* binary variables > not2 <- vapply(plantTraits, function(var) !(is.factor(var) && nlevels(var) == 2), NA) > names(plantTraits)[not2] [1] "pdias" "longindex" "durflow" "height" "begflow" "mycor" [7] "vegaer" "vegsout" "autopoll" "insects" "wind" > > plantT2 <- plantTraits > for(n in names(plantTraits)[not2]) { + v <- plantTraits[,n] + if(is.factor(v)) { + lv <- as.integer(levels(v))# ok for this data + v <- as.integer(v) + M <- median(lv) + } else M <- median(v, na.rm = TRUE) + stopifnot(is.finite(M)) + plantT2[,n] <- (v <= M) + } > summary(plantT2) pdias longindex durflow height Mode :logical Mode :logical Mode :logical Mode :logical FALSE:50 FALSE:54 FALSE:39 FALSE:52 TRUE :50 TRUE :57 TRUE :97 TRUE :84 NA's :36 NA's :25 begflow mycor vegaer vegsout Mode :logical Mode :logical Mode :logical Mode :logical FALSE:58 FALSE:87 FALSE:17 FALSE:38 TRUE :78 TRUE :10 TRUE :117 TRUE :96 NA's :39 NA's :2 NA's :2 autopoll insects wind lign piq ros Mode :logical Mode :logical Mode :logical 0:93 0:119 0 :120 FALSE:63 FALSE:84 FALSE:39 1:43 1: 17 1 : 12 TRUE :73 TRUE :52 TRUE :97 NA's: 4 semiros leafy suman winan monocarp polycarp seasaes seashiv 0 :97 0 :47 0:117 0:124 0:127 0: 19 0 :85 0 :128 1 :35 1 :85 1: 19 1: 12 1: 9 1:117 1 :47 1 : 4 NA's: 4 NA's: 4 NA's: 4 NA's: 4 seasver everalw everparti elaio endozoo epizoo aquat 0 :126 0 :78 0 :112 0 :119 0 :93 0 :109 0 :128 1 : 6 1 :54 1 : 20 1 : 12 1 :38 1 : 22 1 : 3 NA's: 4 NA's: 4 NA's: 4 NA's: 5 NA's: 5 NA's: 5 NA's: 5 windgl unsp 0 :108 0 :93 1 : 23 1 :38 NA's: 5 NA's: 5 > > (mon.pl2 <- mona(plantT2, trace = TRUE)) Loop npass = 1: (ka,kb) = (1,136) for(j ..) -> jma=12, jtel(.,z) = (43, 93) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 43, 93, 44) --> nclu = 2, kwan[ka] = 93 L500; found kwan[1] = 43 >= 2 ==> Loop again Loop npass = 2: (ka,kb) = (1,43) for(j ..) -> jma=11, jtel(.,z) = (33, 10) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 33, 10, 34) --> nclu = 3, kwan[ka] = 10 Loop npass = 2: (ka,kb) = (44,136) for(j ..) -> jma=24, jtel(.,z) = (47, 46) --> splitting: ka=44, ner[ka]=3 => (nzf, jtel2, jres, km) = (0, 47, 46, 91) --> nclu = 4, kwan[ka] = 46 L500; found kwan[1] = 33 >= 2 ==> Loop again Loop npass = 3: (ka,kb) = (1,33) for(j ..) -> jma=9, jtel(.,z) = (20, 13) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 20, 13, 21) --> nclu = 5, kwan[ka] = 13 Loop npass = 3: (ka,kb) = (34,43) for(j ..) -> jma=21, jtel(.,z) = (8, 2) --> splitting: ka=34, ner[ka]=14 => (nzf, jtel2, jres, km) = (0, 8, 2, 42) --> nclu = 6, kwan[ka] = 2 Loop npass = 3: (ka,kb) = (44,90) for(j ..) -> jma=11, jtel(.,z) = (26, 21) --> splitting: ka=44, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 21, 26, 65) --> nclu = 7, kwan[ka] = 26 Loop npass = 3: (ka,kb) = (91,136) for(j ..) -> jma=17, jtel(.,z) = (15, 31) --> splitting: ka=91, ner[ka]=6 => (nzf, jtel2, jres, km) = (0, 15, 31, 106) --> nclu = 8, kwan[ka] = 31 L500; found kwan[1] = 20 >= 2 ==> Loop again Loop npass = 4: (ka,kb) = (1,20) for(j ..) -> jma=21, jtel(.,z) = (11, 9) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 11, 9, 12) --> nclu = 9, kwan[ka] = 9 Loop npass = 4: (ka,kb) = (21,33) for(j ..) -> jma=21, jtel(.,z) = (8, 5) --> splitting: ka=21, ner[ka]=31 => (nzf, jtel2, jres, km) = (0, 8, 5, 29) --> nclu = 10, kwan[ka] = 5 Loop npass = 4: (ka,kb) = (34,41) for(j ..) -> jma=27, jtel(.,z) = (2, 6) --> splitting: ka=34, ner[ka]=14 => (nzf, jtel2, jres, km) = (1, 6, 2, 40) --> nclu = 11, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (42,43) for(j ..) -> jma=7, jtel(.,z) = (1, 1) --> splitting: ka=42, ner[ka]=99 => (nzf, jtel2, jres, km) = (0, 1, 1, 43) --> nclu = 12, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (44,64) for(j ..) -> jma=28, jtel(.,z) = (8, 13) --> splitting: ka=44, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 13, 8, 57) --> nclu = 13, kwan[ka] = 8 Loop npass = 4: (ka,kb) = (65,90) for(j ..) -> jma=15, jtel(.,z) = (12, 14) --> splitting: ka=65, ner[ka]=5 => (nzf, jtel2, jres, km) = (0, 12, 14, 77) --> nclu = 14, kwan[ka] = 14 Loop npass = 4: (ka,kb) = (91,105) for(j ..) -> jma=25, jtel(.,z) = (6, 9) --> splitting: ka=91, ner[ka]=6 => (nzf, jtel2, jres, km) = (1, 9, 6, 100) --> nclu = 15, kwan[ka] = 6 Loop npass = 4: (ka,kb) = (106,136) for(j ..) -> jma=5, jtel(.,z) = (12, 19) --> splitting: ka=106, ner[ka]=8 => (nzf, jtel2, jres, km) = (0, 12, 19, 118) --> nclu = 16, kwan[ka] = 19 L500; found kwan[1] = 11 >= 2 ==> Loop again Loop npass = 5: (ka,kb) = (1,11) for(j ..) -> jma=2, jtel(.,z) = (5, 6) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 5, 6, 6) --> nclu = 17, kwan[ka] = 6 Loop npass = 5: (ka,kb) = (12,20) for(j ..) -> jma=2, jtel(.,z) = (4, 5) --> splitting: ka=12, ner[ka]=19 => (nzf, jtel2, jres, km) = (1, 5, 4, 17) --> nclu = 18, kwan[ka] = 4 Loop npass = 5: (ka,kb) = (21,28) for(j ..) -> jma=5, jtel(.,z) = (6, 2) --> splitting: ka=21, ner[ka]=31 => (nzf, jtel2, jres, km) = (0, 6, 2, 27) --> nclu = 19, kwan[ka] = 2 Loop npass = 5: (ka,kb) = (29,33) for(j ..) -> jma=1, jtel(.,z) = (4, 1) --> splitting: ka=29, ner[ka]=68 => (nzf, jtel2, jres, km) = (1, 1, 4, 30) --> nclu = 20, kwan[ka] = 4 Loop npass = 5: (ka,kb) = (34,39) for(j ..) -> jma=1, jtel(.,z) = (2, 4) --> splitting: ka=34, ner[ka]=14 => (nzf, jtel2, jres, km) = (0, 2, 4, 36) --> nclu = 21, kwan[ka] = 4 Loop npass = 5: (ka,kb) = (40,41) for(j ..) -> jma=3, jtel(.,z) = (1, 1) --> splitting: ka=40, ner[ka]=28 => (nzf, jtel2, jres, km) = (1, 1, 1, 41) --> nclu = 22, kwan[ka] = 1 Loop npass = 5: (ka,kb) = (44,56) for(j ..) -> jma=6, jtel(.,z) = (5, 8) --> splitting: ka=44, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 8, 5, 52) --> nclu = 23, kwan[ka] = 5 Loop npass = 5: (ka,kb) = (57,64) for(j ..) -> jma=6, jtel(.,z) = (3, 5) --> splitting: ka=57, ner[ka]=10 => (nzf, jtel2, jres, km) = (1, 5, 3, 62) --> nclu = 24, kwan[ka] = 3 Loop npass = 5: (ka,kb) = (65,76) for(j ..) -> jma=19, jtel(.,z) = (5, 7) --> splitting: ka=65, ner[ka]=5 => (nzf, jtel2, jres, km) = (1, 7, 5, 72) --> nclu = 25, kwan[ka] = 5 Loop npass = 5: (ka,kb) = (77,90) for(j ..) -> jma=14, jtel(.,z) = (7, 7) --> splitting: ka=77, ner[ka]=42 => (nzf, jtel2, jres, km) = (1, 7, 7, 84) --> nclu = 26, kwan[ka] = 7 Loop npass = 5: (ka,kb) = (91,99) for(j ..) -> jma=3, jtel(.,z) = (5, 4) --> splitting: ka=91, ner[ka]=6 => (nzf, jtel2, jres, km) = (0, 5, 4, 96) --> nclu = 27, kwan[ka] = 4 Loop npass = 5: (ka,kb) = (100,105) for(j ..) -> jma=30, jtel(.,z) = (2, 4) --> splitting: ka=100, ner[ka]=7 => (nzf, jtel2, jres, km) = (1, 4, 2, 104) --> nclu = 28, kwan[ka] = 2 Loop npass = 5: (ka,kb) = (106,117) for(j ..) -> jma=16, jtel(.,z) = (7, 5) --> splitting: ka=106, ner[ka]=8 => (nzf, jtel2, jres, km) = (1, 5, 7, 111) --> nclu = 29, kwan[ka] = 7 Loop npass = 5: (ka,kb) = (118,136) for(j ..) -> jma=25, jtel(.,z) = (8, 11) --> splitting: ka=118, ner[ka]=9 => (nzf, jtel2, jres, km) = (1, 11, 8, 129) --> nclu = 30, kwan[ka] = 8 L500; found kwan[1] = 5 >= 2 ==> Loop again Loop npass = 6: (ka,kb) = (1,5) for(j ..) -> jma=27, jtel(.,z) = (3, 2) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 2, 3, 3) --> nclu = 31, kwan[ka] = 3 Loop npass = 6: (ka,kb) = (6,11) for(j ..) -> jma=3, jtel(.,z) = (5, 1) --> splitting: ka=6, ner[ka]=72 => (nzf, jtel2, jres, km) = (0, 5, 1, 11) --> nclu = 32, kwan[ka] = 1 Loop npass = 6: (ka,kb) = (12,16) for(j ..) -> jma=24, jtel(.,z) = (4, 1) --> splitting: ka=12, ner[ka]=19 => (nzf, jtel2, jres, km) = (0, 4, 1, 16) --> nclu = 33, kwan[ka] = 1 Loop npass = 6: (ka,kb) = (17,20) for(j ..) -> jma=3, jtel(.,z) = (2, 2) --> splitting: ka=17, ner[ka]=55 => (nzf, jtel2, jres, km) = (0, 2, 2, 19) --> nclu = 34, kwan[ka] = 2 Loop npass = 6: (ka,kb) = (21,26) for(j ..) -> jma=1, jtel(.,z) = (3, 3) --> splitting: ka=21, ner[ka]=31 => (nzf, jtel2, jres, km) = (1, 3, 3, 24) --> nclu = 35, kwan[ka] = 3 Loop npass = 6: (ka,kb) = (27,28) for(j ..) -> jma=2, jtel(.,z) = (1, 1) --> splitting: ka=27, ner[ka]=105 => (nzf, jtel2, jres, km) = (0, 1, 1, 28) --> nclu = 36, kwan[ka] = 1 Loop npass = 6: (ka,kb) = (30,33) for(j ..) -> jma=3, jtel(.,z) = (2, 2) --> splitting: ka=30, ner[ka]=70 => (nzf, jtel2, jres, km) = (1, 2, 2, 32) --> nclu = 37, kwan[ka] = 2 Loop npass = 6: (ka,kb) = (34,35) for(j ..) -> jma=2, jtel(.,z) = (1, 1) --> splitting: ka=34, ner[ka]=14 => (nzf, jtel2, jres, km) = (1, 1, 1, 35) --> nclu = 38, kwan[ka] = 1 Loop npass = 6: (ka,kb) = (36,39) for(j ..) -> jma=8, jtel(.,z) = (3, 1) --> splitting: ka=36, ner[ka]=20 => (nzf, jtel2, jres, km) = (0, 3, 1, 39) --> nclu = 39, kwan[ka] = 1 Loop npass = 6: (ka,kb) = (44,51) for(j ..) -> jma=5, jtel(.,z) = (3, 5) --> splitting: ka=44, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 5, 3, 49) --> nclu = 40, kwan[ka] = 3 Loop npass = 6: (ka,kb) = (52,56) for(j ..) -> jma=31, jtel(.,z) = (2, 3) --> splitting: ka=52, ner[ka]=21 => (nzf, jtel2, jres, km) = (0, 2, 3, 54) --> nclu = 41, kwan[ka] = 3 Loop npass = 6: (ka,kb) = (57,61) for(j ..) -> jma=9, jtel(.,z) = (3, 2) --> splitting: ka=57, ner[ka]=10 => (nzf, jtel2, jres, km) = (1, 2, 3, 59) --> nclu = 42, kwan[ka] = 3 Loop npass = 6: (ka,kb) = (62,64) for(j ..) -> jma=1, jtel(.,z) = (2, 1) --> splitting: ka=62, ner[ka]=62 => (nzf, jtel2, jres, km) = (0, 2, 1, 64) --> nclu = 43, kwan[ka] = 1 Loop npass = 6: (ka,kb) = (65,71) for(j ..) -> jma=1, jtel(.,z) = (4, 3) --> splitting: ka=65, ner[ka]=5 => (nzf, jtel2, jres, km) = (0, 4, 3, 69) --> nclu = 44, kwan[ka] = 3 Loop npass = 6: (ka,kb) = (72,76) for(j ..) -> jma=3, jtel(.,z) = (1, 4) --> splitting: ka=72, ner[ka]=26 => (nzf, jtel2, jres, km) = (1, 4, 1, 76) --> nclu = 45, kwan[ka] = 1 Loop npass = 6: (ka,kb) = (77,83) for(j ..) -> jma=3, jtel(.,z) = (4, 3) --> splitting: ka=77, ner[ka]=42 => (nzf, jtel2, jres, km) = (1, 3, 4, 80) --> nclu = 46, kwan[ka] = 4 Loop npass = 6: (ka,kb) = (84,90) for(j ..) -> jma=26, jtel(.,z) = (3, 4) --> splitting: ka=84, ner[ka]=49 => (nzf, jtel2, jres, km) = (1, 4, 3, 88) --> nclu = 47, kwan[ka] = 3 Loop npass = 6: (ka,kb) = (91,95) for(j ..) -> jma=21, jtel(.,z) = (2, 3) --> splitting: ka=91, ner[ka]=6 => (nzf, jtel2, jres, km) = (1, 3, 2, 94) --> nclu = 48, kwan[ka] = 2 Loop npass = 6: (ka,kb) = (96,99) for(j ..) -> jma=14, jtel(.,z) = (1, 3) --> splitting: ka=96, ner[ka]=22 => (nzf, jtel2, jres, km) = (1, 3, 1, 99) --> nclu = 49, kwan[ka] = 1 Loop npass = 6: (ka,kb) = (100,103) for(j ..) -> jma=10, jtel(.,z) = (2, 2) --> splitting: ka=100, ner[ka]=7 => (nzf, jtel2, jres, km) = (1, 2, 2, 102) --> nclu = 50, kwan[ka] = 2 Loop npass = 6: (ka,kb) = (104,105) for(j ..) -> jma=6, jtel(.,z) = (1, 1) --> splitting: ka=104, ner[ka]=64 => (nzf, jtel2, jres, km) = (0, 1, 1, 105) --> nclu = 51, kwan[ka] = 1 Loop npass = 6: (ka,kb) = (106,110) for(j ..) -> jma=8, jtel(.,z) = (2, 3) --> splitting: ka=106, ner[ka]=8 => (nzf, jtel2, jres, km) = (1, 3, 2, 109) --> nclu = 52, kwan[ka] = 2 Loop npass = 6: (ka,kb) = (111,117) for(j ..) -> jma=6, jtel(.,z) = (4, 3) --> splitting: ka=111, ner[ka]=43 => (nzf, jtel2, jres, km) = (0, 4, 3, 115) --> nclu = 53, kwan[ka] = 3 Loop npass = 6: (ka,kb) = (118,128) for(j ..) -> jma=8, jtel(.,z) = (5, 6) --> splitting: ka=118, ner[ka]=9 => (nzf, jtel2, jres, km) = (0, 5, 6, 123) --> nclu = 54, kwan[ka] = 6 Loop npass = 6: (ka,kb) = (129,136) for(j ..) -> jma=28, jtel(.,z) = (3, 5) --> splitting: ka=129, ner[ka]=11 => (nzf, jtel2, jres, km) = (0, 3, 5, 132) --> nclu = 55, kwan[ka] = 5 L500; found kwan[1] = 2 >= 2 ==> Loop again Loop npass = 7: (ka,kb) = (1,2) for(j ..) -> jma=28, jtel(.,z) = (3, 5) --> _NO_ splitting --> nclu = 55, kwan[ka] = -2 Loop npass = 7: (ka,kb) = (3,5) for(j ..) -> jma=1, jtel(.,z) = (1, 2) --> splitting: ka=3, ner[ka]=30 => (nzf, jtel2, jres, km) = (1, 2, 1, 5) --> nclu = 56, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (6,10) for(j ..) -> jma=27, jtel(.,z) = (4, 1) --> splitting: ka=6, ner[ka]=72 => (nzf, jtel2, jres, km) = (0, 4, 1, 10) --> nclu = 57, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (12,15) for(j ..) -> jma=5, jtel(.,z) = (3, 1) --> splitting: ka=12, ner[ka]=19 => (nzf, jtel2, jres, km) = (1, 1, 3, 13) --> nclu = 58, kwan[ka] = 3 Loop npass = 7: (ka,kb) = (17,18) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=17, ner[ka]=55 => (nzf, jtel2, jres, km) = (1, 1, 1, 18) --> nclu = 59, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (19,20) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> splitting: ka=19, ner[ka]=112 => (nzf, jtel2, jres, km) = (0, 1, 1, 20) --> nclu = 60, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (21,23) for(j ..) -> jma=8, jtel(.,z) = (2, 1) --> splitting: ka=21, ner[ka]=31 => (nzf, jtel2, jres, km) = (0, 2, 1, 23) --> nclu = 61, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (24,26) for(j ..) -> jma=2, jtel(.,z) = (2, 1) --> splitting: ka=24, ner[ka]=93 => (nzf, jtel2, jres, km) = (0, 2, 1, 26) --> nclu = 62, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (30,31) for(j ..) -> jma=8, jtel(.,z) = (1, 1) --> splitting: ka=30, ner[ka]=70 => (nzf, jtel2, jres, km) = (0, 1, 1, 31) --> nclu = 63, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (32,33) for(j ..) -> jma=8, jtel(.,z) = (1, 1) --> splitting: ka=32, ner[ka]=103 => (nzf, jtel2, jres, km) = (0, 1, 1, 33) --> nclu = 64, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (36,38) for(j ..) -> jma=8, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 64, kwan[ka] = -3 Loop npass = 7: (ka,kb) = (44,48) for(j ..) -> jma=15, jtel(.,z) = (3, 2) --> splitting: ka=44, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 2, 3, 46) --> nclu = 65, kwan[ka] = 3 Loop npass = 7: (ka,kb) = (49,51) for(j ..) -> jma=2, jtel(.,z) = (2, 1) --> splitting: ka=49, ner[ka]=35 => (nzf, jtel2, jres, km) = (0, 2, 1, 51) --> nclu = 66, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (52,53) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=52, ner[ka]=21 => (nzf, jtel2, jres, km) = (0, 1, 1, 53) --> nclu = 67, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (54,56) for(j ..) -> jma=1, jtel(.,z) = (2, 1) --> splitting: ka=54, ner[ka]=71 => (nzf, jtel2, jres, km) = (1, 1, 2, 55) --> nclu = 68, kwan[ka] = 2 Loop npass = 7: (ka,kb) = (57,58) for(j ..) -> jma=1, jtel(.,z) = (1, 1) --> splitting: ka=57, ner[ka]=10 => (nzf, jtel2, jres, km) = (0, 1, 1, 58) --> nclu = 69, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (59,61) for(j ..) -> jma=15, jtel(.,z) = (2, 1) --> splitting: ka=59, ner[ka]=15 => (nzf, jtel2, jres, km) = (0, 2, 1, 61) --> nclu = 70, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (62,63) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> splitting: ka=62, ner[ka]=62 => (nzf, jtel2, jres, km) = (0, 1, 1, 63) --> nclu = 71, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (65,68) for(j ..) -> jma=2, jtel(.,z) = (1, 3) --> splitting: ka=65, ner[ka]=5 => (nzf, jtel2, jres, km) = (1, 3, 1, 68) --> nclu = 72, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (69,71) for(j ..) -> jma=2, jtel(.,z) = (2, 1) --> splitting: ka=69, ner[ka]=53 => (nzf, jtel2, jres, km) = (0, 2, 1, 71) --> nclu = 73, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (72,75) for(j ..) -> jma=4, jtel(.,z) = (3, 1) --> splitting: ka=72, ner[ka]=26 => (nzf, jtel2, jres, km) = (1, 1, 3, 73) --> nclu = 74, kwan[ka] = 3 Loop npass = 7: (ka,kb) = (77,79) for(j ..) -> jma=2, jtel(.,z) = (1, 2) --> splitting: ka=77, ner[ka]=42 => (nzf, jtel2, jres, km) = (0, 1, 2, 78) --> nclu = 75, kwan[ka] = 2 Loop npass = 7: (ka,kb) = (80,83) for(j ..) -> jma=1, jtel(.,z) = (2, 2) --> splitting: ka=80, ner[ka]=107 => (nzf, jtel2, jres, km) = (0, 2, 2, 82) --> nclu = 76, kwan[ka] = 2 Loop npass = 7: (ka,kb) = (84,87) for(j ..) -> jma=6, jtel(.,z) = (1, 3) --> splitting: ka=84, ner[ka]=49 => (nzf, jtel2, jres, km) = (1, 3, 1, 87) --> nclu = 77, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (88,90) for(j ..) -> jma=1, jtel(.,z) = (1, 2) --> splitting: ka=88, ner[ka]=92 => (nzf, jtel2, jres, km) = (0, 1, 2, 89) --> nclu = 78, kwan[ka] = 2 Loop npass = 7: (ka,kb) = (91,93) for(j ..) -> jma=2, jtel(.,z) = (2, 1) --> splitting: ka=91, ner[ka]=6 => (nzf, jtel2, jres, km) = (1, 1, 2, 92) --> nclu = 79, kwan[ka] = 2 Loop npass = 7: (ka,kb) = (94,95) for(j ..) -> jma=1, jtel(.,z) = (1, 1) --> splitting: ka=94, ner[ka]=75 => (nzf, jtel2, jres, km) = (1, 1, 1, 95) --> nclu = 80, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (96,98) for(j ..) -> jma=2, jtel(.,z) = (1, 2) --> splitting: ka=96, ner[ka]=22 => (nzf, jtel2, jres, km) = (1, 2, 1, 98) --> nclu = 81, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (100,101) for(j ..) -> jma=3, jtel(.,z) = (1, 1) --> splitting: ka=100, ner[ka]=7 => (nzf, jtel2, jres, km) = (0, 1, 1, 101) --> nclu = 82, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (102,103) for(j ..) -> jma=3, jtel(.,z) = (1, 1) --> splitting: ka=102, ner[ka]=65 => (nzf, jtel2, jres, km) = (0, 1, 1, 103) --> nclu = 83, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (106,108) for(j ..) -> jma=14, jtel(.,z) = (1, 2) --> splitting: ka=106, ner[ka]=8 => (nzf, jtel2, jres, km) = (1, 2, 1, 108) --> nclu = 84, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (109,110) for(j ..) -> jma=2, jtel(.,z) = (1, 1) --> splitting: ka=109, ner[ka]=58 => (nzf, jtel2, jres, km) = (1, 1, 1, 110) --> nclu = 85, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (111,114) for(j ..) -> jma=2, jtel(.,z) = (2, 2) --> splitting: ka=111, ner[ka]=43 => (nzf, jtel2, jres, km) = (1, 2, 2, 113) --> nclu = 86, kwan[ka] = 2 Loop npass = 7: (ka,kb) = (115,117) for(j ..) -> jma=2, jtel(.,z) = (2, 1) --> splitting: ka=115, ner[ka]=123 => (nzf, jtel2, jres, km) = (0, 2, 1, 117) --> nclu = 87, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (118,122) for(j ..) -> jma=1, jtel(.,z) = (2, 3) --> splitting: ka=118, ner[ka]=9 => (nzf, jtel2, jres, km) = (0, 2, 3, 120) --> nclu = 88, kwan[ka] = 3 Loop npass = 7: (ka,kb) = (123,128) for(j ..) -> jma=28, jtel(.,z) = (2, 4) --> splitting: ka=123, ner[ka]=18 => (nzf, jtel2, jres, km) = (1, 4, 2, 127) --> nclu = 89, kwan[ka] = 2 Loop npass = 7: (ka,kb) = (129,131) for(j ..) -> jma=4, jtel(.,z) = (1, 2) --> splitting: ka=129, ner[ka]=11 => (nzf, jtel2, jres, km) = (1, 2, 1, 131) --> nclu = 90, kwan[ka] = 1 Loop npass = 7: (ka,kb) = (132,136) for(j ..) -> jma=8, jtel(.,z) = (3, 2) --> splitting: ka=132, ner[ka]=12 => (nzf, jtel2, jres, km) = (0, 3, 2, 135) --> nclu = 91, kwan[ka] = 2 L500; found kwan[3] = 2 >= 2 ==> Loop again Loop npass = 8: (ka,kb) = (3,4) for(j ..) -> jma=3, jtel(.,z) = (1, 1) --> splitting: ka=3, ner[ka]=30 => (nzf, jtel2, jres, km) = (0, 1, 1, 4) --> nclu = 92, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (6,9) for(j ..) -> jma=1, jtel(.,z) = (3, 1) --> splitting: ka=6, ner[ka]=72 => (nzf, jtel2, jres, km) = (0, 3, 1, 9) --> nclu = 93, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (13,15) for(j ..) -> jma=1, jtel(.,z) = (2, 1) --> splitting: ka=13, ner[ka]=36 => (nzf, jtel2, jres, km) = (1, 1, 2, 14) --> nclu = 94, kwan[ka] = 2 Loop npass = 8: (ka,kb) = (21,22) for(j ..) -> jma=1, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 94, kwan[ka] = -2 Loop npass = 8: (ka,kb) = (24,25) for(j ..) -> jma=13, jtel(.,z) = (1, 1) --> splitting: ka=24, ner[ka]=93 => (nzf, jtel2, jres, km) = (1, 1, 1, 25) --> nclu = 95, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (44,45) for(j ..) -> jma=7, jtel(.,z) = (1, 1) --> splitting: ka=44, ner[ka]=3 => (nzf, jtel2, jres, km) = (0, 1, 1, 45) --> nclu = 96, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (46,48) for(j ..) -> jma=1, jtel(.,z) = (2, 1) --> splitting: ka=46, ner[ka]=83 => (nzf, jtel2, jres, km) = (0, 2, 1, 48) --> nclu = 97, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (49,50) for(j ..) -> jma=15, jtel(.,z) = (1, 1) --> splitting: ka=49, ner[ka]=35 => (nzf, jtel2, jres, km) = (0, 1, 1, 50) --> nclu = 98, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (55,56) for(j ..) -> jma=8, jtel(.,z) = (1, 1) --> splitting: ka=55, ner[ka]=108 => (nzf, jtel2, jres, km) = (1, 1, 1, 56) --> nclu = 99, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (59,60) for(j ..) -> jma=1, jtel(.,z) = (1, 1) --> splitting: ka=59, ner[ka]=15 => (nzf, jtel2, jres, km) = (1, 1, 1, 60) --> nclu = 100, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (65,67) for(j ..) -> jma=26, jtel(.,z) = (2, 1) --> splitting: ka=65, ner[ka]=5 => (nzf, jtel2, jres, km) = (0, 2, 1, 67) --> nclu = 101, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (69,70) for(j ..) -> jma=7, jtel(.,z) = (1, 1) --> splitting: ka=69, ner[ka]=53 => (nzf, jtel2, jres, km) = (0, 1, 1, 70) --> nclu = 102, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (73,75) for(j ..) -> jma=1, jtel(.,z) = (2, 1) --> splitting: ka=73, ner[ka]=37 => (nzf, jtel2, jres, km) = (0, 2, 1, 75) --> nclu = 103, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (78,79) for(j ..) -> jma=1, jtel(.,z) = (1, 1) --> splitting: ka=78, ner[ka]=67 => (nzf, jtel2, jres, km) = (0, 1, 1, 79) --> nclu = 104, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (80,81) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> splitting: ka=80, ner[ka]=107 => (nzf, jtel2, jres, km) = (1, 1, 1, 81) --> nclu = 105, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (82,83) for(j ..) -> jma=2, jtel(.,z) = (1, 1) --> splitting: ka=82, ner[ka]=120 => (nzf, jtel2, jres, km) = (0, 1, 1, 83) --> nclu = 106, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (84,86) for(j ..) -> jma=1, jtel(.,z) = (1, 2) --> splitting: ka=84, ner[ka]=49 => (nzf, jtel2, jres, km) = (1, 2, 1, 86) --> nclu = 107, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (89,90) for(j ..) -> jma=2, jtel(.,z) = (1, 1) --> splitting: ka=89, ner[ka]=135 => (nzf, jtel2, jres, km) = (0, 1, 1, 90) --> nclu = 108, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (92,93) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> splitting: ka=92, ner[ka]=16 => (nzf, jtel2, jres, km) = (0, 1, 1, 93) --> nclu = 109, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (96,97) for(j ..) -> jma=1, jtel(.,z) = (1, 1) --> splitting: ka=96, ner[ka]=22 => (nzf, jtel2, jres, km) = (0, 1, 1, 97) --> nclu = 110, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (106,107) for(j ..) -> jma=2, jtel(.,z) = (1, 1) --> splitting: ka=106, ner[ka]=8 => (nzf, jtel2, jres, km) = (0, 1, 1, 107) --> nclu = 111, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (111,112) for(j ..) -> jma=3, jtel(.,z) = (1, 1) --> splitting: ka=111, ner[ka]=43 => (nzf, jtel2, jres, km) = (0, 1, 1, 112) --> nclu = 112, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (113,114) for(j ..) -> jma=9, jtel(.,z) = (1, 1) --> splitting: ka=113, ner[ka]=76 => (nzf, jtel2, jres, km) = (0, 1, 1, 114) --> nclu = 113, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (115,116) for(j ..) -> jma=1, jtel(.,z) = (1, 1) --> splitting: ka=115, ner[ka]=123 => (nzf, jtel2, jres, km) = (0, 1, 1, 116) --> nclu = 114, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (118,119) for(j ..) -> jma=2, jtel(.,z) = (1, 1) --> splitting: ka=118, ner[ka]=9 => (nzf, jtel2, jres, km) = (0, 1, 1, 119) --> nclu = 115, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (120,122) for(j ..) -> jma=9, jtel(.,z) = (2, 1) --> splitting: ka=120, ner[ka]=17 => (nzf, jtel2, jres, km) = (0, 2, 1, 122) --> nclu = 116, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (123,126) for(j ..) -> jma=2, jtel(.,z) = (1, 3) --> splitting: ka=123, ner[ka]=18 => (nzf, jtel2, jres, km) = (1, 3, 1, 126) --> nclu = 117, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (127,128) for(j ..) -> jma=1, jtel(.,z) = (1, 1) --> splitting: ka=127, ner[ka]=25 => (nzf, jtel2, jres, km) = (1, 1, 1, 128) --> nclu = 118, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (129,130) for(j ..) -> jma=1, jtel(.,z) = (1, 1) --> splitting: ka=129, ner[ka]=11 => (nzf, jtel2, jres, km) = (1, 1, 1, 130) --> nclu = 119, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (132,134) for(j ..) -> jma=2, jtel(.,z) = (1, 2) --> splitting: ka=132, ner[ka]=12 => (nzf, jtel2, jres, km) = (1, 2, 1, 134) --> nclu = 120, kwan[ka] = 1 Loop npass = 8: (ka,kb) = (135,136) for(j ..) -> jma=7, jtel(.,z) = (1, 1) --> splitting: ka=135, ner[ka]=60 => (nzf, jtel2, jres, km) = (0, 1, 1, 136) --> nclu = 121, kwan[ka] = 1 L500; found kwan[6] = 3 >= 2 ==> Loop again Loop npass = 9: (ka,kb) = (6,8) for(j ..) -> jma=8, jtel(.,z) = (2, 1) --> splitting: ka=6, ner[ka]=72 => (nzf, jtel2, jres, km) = (0, 2, 1, 8) --> nclu = 122, kwan[ka] = 1 Loop npass = 9: (ka,kb) = (14,15) for(j ..) -> jma=8, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 122, kwan[ka] = -2 Loop npass = 9: (ka,kb) = (46,47) for(j ..) -> jma=2, jtel(.,z) = (1, 1) --> splitting: ka=46, ner[ka]=83 => (nzf, jtel2, jres, km) = (0, 1, 1, 47) --> nclu = 123, kwan[ka] = 1 Loop npass = 9: (ka,kb) = (65,66) for(j ..) -> jma=3, jtel(.,z) = (1, 1) --> splitting: ka=65, ner[ka]=5 => (nzf, jtel2, jres, km) = (0, 1, 1, 66) --> nclu = 124, kwan[ka] = 1 Loop npass = 9: (ka,kb) = (73,74) for(j ..) -> jma=9, jtel(.,z) = (1, 1) --> splitting: ka=73, ner[ka]=37 => (nzf, jtel2, jres, km) = (1, 1, 1, 74) --> nclu = 125, kwan[ka] = 1 Loop npass = 9: (ka,kb) = (84,85) for(j ..) -> jma=2, jtel(.,z) = (1, 1) --> splitting: ka=84, ner[ka]=49 => (nzf, jtel2, jres, km) = (0, 1, 1, 85) --> nclu = 126, kwan[ka] = 1 Loop npass = 9: (ka,kb) = (120,121) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> splitting: ka=120, ner[ka]=17 => (nzf, jtel2, jres, km) = (1, 1, 1, 121) --> nclu = 127, kwan[ka] = 1 Loop npass = 9: (ka,kb) = (123,125) for(j ..) -> jma=1, jtel(.,z) = (2, 1) --> splitting: ka=123, ner[ka]=18 => (nzf, jtel2, jres, km) = (1, 1, 2, 124) --> nclu = 128, kwan[ka] = 2 Loop npass = 9: (ka,kb) = (132,133) for(j ..) -> jma=3, jtel(.,z) = (1, 1) --> splitting: ka=132, ner[ka]=12 => (nzf, jtel2, jres, km) = (1, 1, 1, 133) --> nclu = 129, kwan[ka] = 1 L500; found kwan[6] = 2 >= 2 ==> Loop again Loop npass = 10: (ka,kb) = (6,7) for(j ..) -> jma=13, jtel(.,z) = (1, 1) --> splitting: ka=6, ner[ka]=72 => (nzf, jtel2, jres, km) = (1, 1, 1, 7) --> nclu = 130, kwan[ka] = 1 Loop npass = 10: (ka,kb) = (124,125) for(j ..) -> jma=3, jtel(.,z) = (1, 1) --> splitting: ka=124, ner[ka]=24 => (nzf, jtel2, jres, km) = (0, 1, 1, 125) --> nclu = 131, kwan[ka] = 1 mona(x, ..) fit; x of dimension 136x31 Because of NA's, revised data: pdias longindex durflow height begflow mycor vegaer vegsout autopoll Aceca 0 1 1 0 1 0 1 1 1 Aceps 0 1 1 0 1 0 1 1 1 Agrca 1 0 1 1 0 0 1 0 1 Agrst 1 0 1 1 0 0 0 1 1 Ajure 1 0 1 1 1 0 0 1 0 Allpe 0 0 1 0 1 1 1 1 0 Anaar 1 0 1 1 0 0 1 1 0 Anene 0 1 1 1 1 0 1 0 0 Angsy 1 1 1 1 0 0 1 1 1 Antod 1 1 1 1 1 0 1 1 0 Arrel 0 1 0 0 0 0 1 0 0 Artvu 1 0 0 0 0 0 1 1 1 Aruma 0 1 1 1 1 0 1 0 1 Betsp 1 0 1 0 1 0 1 1 1 Brasy 0 1 1 1 0 0 1 0 1 Brost 0 1 1 1 1 1 1 1 0 Brydi 0 1 1 0 0 1 1 1 1 Calse 0 0 0 0 0 0 1 0 0 Calvu 1 0 1 1 0 0 1 1 1 Carbe 0 1 1 0 1 0 1 1 1 Cardi 1 0 1 1 1 1 1 1 1 Cheal 1 0 0 0 0 0 1 1 1 Chema 1 0 0 1 1 0 1 1 0 Cirar 1 0 1 1 0 0 1 0 1 Cirlu 0 1 1 1 0 0 1 0 0 Cirvu 0 1 0 0 0 0 1 1 1 Conmj 0 0 1 1 1 0 1 0 1 Corav 0 1 0 0 1 0 1 1 1 Cordi 0 0 0 1 0 1 1 1 0 Corsa 0 1 1 0 1 0 1 1 1 Crala 0 1 1 0 1 0 1 1 0 Cramo 0 1 1 0 1 0 1 1 0 Cucba 0 1 1 1 0 1 1 1 1 Cytsc 0 0 1 0 1 0 1 1 1 Dacgl 1 1 1 1 1 0 1 1 0 Dapla 0 0 1 1 1 0 1 1 1 Dauca 1 0 0 1 0 0 1 1 0 Desfl 1 1 1 1 0 0 1 1 1 Diaar 1 1 1 1 0 1 1 1 0 Digpu 1 0 0 1 0 0 1 1 1 Elyca 0 0 1 1 0 0 1 1 0 Epipa 0 1 0 1 0 0 0 1 0 Eupam 0 0 1 1 1 1 1 0 1 Evoeu 1 1 1 0 1 0 1 1 1 Fagsy 0 1 1 0 1 0 1 1 1 Fraal 0 1 0 0 1 0 1 1 1 Fraan 0 1 1 0 1 0 1 1 1 Frasp 0 1 1 0 1 0 1 1 1 Frave 0 1 1 1 1 0 0 1 0 Galap 0 1 1 0 0 0 1 1 0 Galmo 1 1 0 1 1 1 1 0 0 Gerro 0 1 0 1 1 0 1 1 0 Geuur 0 1 0 1 1 0 1 1 0 Glehe 1 1 1 1 1 0 0 1 1 Hedhe 0 1 1 0 0 0 0 1 1 Holla 1 0 1 1 0 0 1 1 0 Holmo 1 1 1 1 0 0 1 0 1 Hyahi 0 0 1 1 1 1 1 1 1 Hyano 0 1 1 1 1 0 1 1 1 Hyppe 1 0 1 1 0 0 1 0 0 Ileaq 0 1 1 0 1 0 1 1 1 Junco 1 0 1 1 1 1 1 1 0 Junef 1 0 1 0 0 1 1 0 0 Lacse 1 0 0 1 0 1 1 1 0 Lapco 1 0 1 1 0 0 1 1 0 Launo 1 0 1 0 1 0 1 1 1 Leuvu 1 0 0 1 0 0 1 1 0 Ligvu 0 1 1 0 0 0 1 1 0 Linre 0 0 0 1 1 1 1 0 1 Lonpe 1 1 0 0 0 0 1 1 0 Luzmu 0 0 1 1 1 1 1 1 1 Malsy 1 0 1 0 1 0 1 1 1 Medlu 0 0 0 1 1 0 1 1 0 Melof 0 1 1 1 0 1 1 1 0 Melpr 0 1 1 1 1 1 1 1 0 Melun 0 1 1 1 1 1 1 0 1 Meran 0 0 0 1 1 1 1 1 1 Milef 1 1 1 1 1 0 1 1 0 Molca 1 0 1 1 0 0 1 1 1 Paprh 1 0 1 1 1 1 1 1 1 Plama 1 0 0 1 0 0 1 1 0 Poaan 1 0 0 1 1 0 1 1 0 Poane 1 1 1 1 0 0 1 1 1 Poapr 1 0 1 1 1 0 1 0 0 Poatr 1 0 1 1 0 0 0 1 1 Polav 0 0 0 1 0 0 1 1 0 Polin 0 1 1 1 0 1 1 0 1 Polmu 0 1 1 1 1 1 1 0 0 Poptr 1 1 1 0 1 0 1 0 1 Potre 1 1 0 1 0 0 0 1 1 Potst 1 0 0 1 1 0 0 1 0 Privu 1 0 1 1 1 0 1 1 1 Pruav 1 1 1 0 1 0 1 1 0 Pruce 1 0 1 0 1 0 1 0 1 Prula 1 0 1 0 1 0 1 1 1 Prusi 0 1 1 0 1 0 1 0 0 Pteaq 1 1 1 0 0 0 1 0 1 Pyrsp 1 0 1 0 1 0 1 1 1 Queil 1 0 1 0 1 0 1 0 1 Ranac 0 1 0 1 1 0 0 1 1 Ranre 0 0 1 1 1 0 0 1 0 Robps 1 0 1 0 1 0 1 0 1 Rosar 1 1 1 0 0 0 1 1 0 Rosca 1 1 1 0 1 0 1 1 0 Rubca 0 1 0 1 0 0 0 1 0 Rubfr 1 1 0 0 0 0 1 0 0 Rubpe 1 1 1 0 0 1 1 0 1 Rumac 1 0 1 1 1 1 1 0 1 Rumco 1 0 1 1 1 1 1 1 0 Rumcr 0 0 1 1 0 0 1 1 1 Rumsa 1 0 1 1 0 1 1 1 1 Rusac 0 1 0 1 1 0 1 0 1 Samni 0 0 1 0 0 0 1 1 0 Scrno 1 0 0 1 0 0 1 0 1 Soldu 0 0 0 1 0 0 1 0 1 Sonol 1 0 0 1 0 0 1 1 0 Sordo 1 0 1 0 1 0 1 1 0 Sorto 0 0 1 0 1 0 1 1 1 Stasy 1 1 1 1 0 0 1 0 0 Steho 0 1 1 1 1 1 0 1 0 Steme 1 0 0 1 1 1 1 1 0 Symsp 1 1 1 0 0 0 1 0 0 Tamco 1 1 1 0 1 0 1 0 1 Tarsp 1 0 0 1 1 0 1 1 1 Taxba 1 0 1 0 1 0 0 0 1 Teusc 1 0 1 1 0 0 0 0 0 Trire 0 0 0 1 0 0 0 1 1 Ulemi 0 1 0 0 0 0 1 1 1 Ulmsp 0 1 1 0 1 0 1 0 1 Urtdi 1 0 0 0 0 1 1 0 1 Verch 1 1 1 1 1 0 1 0 0 Vicsa 0 0 1 0 1 0 1 1 0 Vicse 0 1 0 1 1 0 1 0 0 Vinmi 0 0 1 1 1 1 0 1 1 Viohi 0 1 1 1 1 0 1 1 0 Viore 0 0 1 1 1 1 1 1 0 insects wind lign piq ros semiros leafy suman winan monocarp polycarp Aceca 0 1 1 0 0 0 1 0 0 0 1 Aceps 0 1 1 0 0 0 1 0 0 0 1 Agrca 1 0 0 0 0 0 1 0 0 0 1 Agrst 1 0 0 0 0 0 1 0 0 0 1 Ajure 0 1 0 0 0 1 0 0 0 0 1 Allpe 0 1 0 0 0 1 0 1 0 1 0 Anaar 0 1 0 0 0 0 1 1 1 0 0 Anene 0 1 0 0 0 1 0 0 0 0 1 Angsy 0 1 0 0 0 1 0 0 0 1 1 Antod 1 0 0 0 0 0 1 0 0 0 1 Arrel 1 0 0 0 0 0 1 0 0 0 1 Artvu 1 0 0 0 0 0 1 0 0 0 1 Aruma 0 1 0 0 1 0 0 0 0 0 1 Betsp 1 0 1 0 0 0 1 0 0 0 1 Brasy 1 0 0 0 0 1 0 0 0 0 1 Brost 1 1 0 0 0 1 0 1 1 0 0 Brydi 0 1 0 0 0 0 1 0 0 0 1 Calse 0 1 0 0 0 0 1 0 0 0 1 Calvu 0 1 1 0 0 0 1 0 0 0 1 Carbe 1 0 1 0 0 0 1 0 0 0 1 Cardi 1 0 0 0 0 1 0 0 0 0 1 Cheal 1 0 0 0 0 0 1 1 0 0 0 Chema 0 1 0 0 0 1 0 0 0 0 1 Cirar 0 1 0 1 0 0 1 0 0 0 1 Cirlu 0 1 0 0 0 0 1 0 0 0 1 Cirvu 0 1 0 1 0 1 0 0 0 1 0 Conmj 0 1 0 0 0 1 0 0 0 0 1 Corav 1 0 1 0 0 0 1 0 0 0 1 Cordi 1 1 0 0 1 0 1 1 0 0 0 Corsa 0 1 1 0 0 0 1 0 0 0 1 Crala 0 1 1 1 0 0 1 0 0 0 1 Cramo 0 1 1 1 0 0 1 0 0 0 1 Cucba 0 1 0 0 0 0 1 0 0 0 1 Cytsc 0 1 1 0 0 0 1 0 0 0 1 Dacgl 1 0 0 0 0 1 0 0 0 0 1 Dapla 0 1 1 0 0 0 1 0 0 0 1 Dauca 0 1 0 0 0 1 0 0 0 1 0 Desfl 1 0 0 0 0 1 0 0 0 0 1 Diaar 1 1 0 0 0 1 0 1 0 1 0 Digpu 0 1 0 0 0 1 0 0 0 1 1 Elyca 1 0 0 0 0 0 1 0 0 0 1 Epipa 1 1 0 0 0 0 1 0 0 0 1 Eupam 0 1 0 0 0 0 1 0 0 0 1 Evoeu 0 1 1 0 0 0 1 0 0 0 1 Fagsy 1 0 1 0 0 0 1 0 0 0 1 Fraal 0 1 1 0 0 0 1 0 0 0 1 Fraan 1 0 1 0 0 0 1 0 0 0 1 Frasp 1 0 1 0 0 0 1 0 0 0 1 Frave 0 1 0 0 1 0 0 0 0 0 1 Galap 0 1 0 0 0 0 1 1 1 0 0 Galmo 0 1 0 0 0 0 1 1 0 0 0 Gerro 1 1 0 0 0 1 0 0 0 1 1 Geuur 1 1 0 0 0 1 0 0 0 0 1 Glehe 0 1 0 0 0 1 0 0 0 0 1 Hedhe 0 1 1 0 0 0 1 0 0 0 1 Holla 1 0 0 0 0 0 1 0 0 0 1 Holmo 1 0 0 0 0 0 1 0 0 0 1 Hyahi 0 1 0 0 1 0 0 0 0 0 1 Hyano 0 1 0 0 1 0 0 0 0 0 1 Hyppe 0 1 0 0 0 0 1 0 0 0 1 Ileaq 0 1 1 1 0 0 1 0 0 0 1 Junco 1 0 0 0 1 0 1 0 0 0 1 Junef 1 0 0 0 1 1 1 0 0 0 1 Lacse 1 1 0 1 0 1 0 1 0 1 0 Lapco 1 1 0 0 0 1 0 1 1 0 0 Launo 0 1 1 0 0 0 1 0 0 0 1 Leuvu 0 1 0 0 0 0 1 0 0 0 1 Ligvu 0 1 1 0 0 0 1 0 0 0 1 Linre 0 1 0 0 0 0 1 0 0 0 1 Lonpe 0 1 1 0 0 0 1 0 0 0 1 Luzmu 0 0 0 0 0 1 0 0 0 0 1 Malsy 0 1 1 0 0 0 1 0 0 0 1 Medlu 0 1 0 0 0 0 1 1 1 0 1 Melof 0 1 0 0 0 0 1 0 0 0 1 Melpr 0 1 0 0 0 0 1 1 0 0 0 Melun 1 0 0 0 0 0 1 0 0 0 1 Meran 1 0 0 0 1 0 1 1 1 0 0 Milef 1 0 0 0 0 0 1 0 0 0 1 Molca 1 0 0 0 0 1 0 0 0 0 1 Paprh 0 1 0 0 0 1 0 1 1 0 0 Plama 1 0 0 0 1 0 0 0 0 0 1 Poaan 1 1 0 0 0 1 0 1 1 0 1 Poane 1 0 0 0 0 1 0 0 0 0 1 Poapr 1 0 0 0 0 1 0 0 0 0 1 Poatr 1 0 0 0 0 1 0 0 0 0 1 Polav 0 1 0 0 0 0 1 1 0 0 0 Polin 1 1 0 0 1 0 0 0 0 0 1 Polmu 0 1 0 0 0 0 1 0 0 0 1 Poptr 1 0 1 0 0 0 1 0 0 0 1 Potre 0 1 0 0 0 0 1 0 0 0 1 Potst 0 1 0 0 0 1 0 0 0 0 1 Privu 0 1 0 0 1 0 0 0 0 0 1 Pruav 0 1 1 0 0 0 1 0 0 0 1 Pruce 0 1 1 0 0 0 1 0 0 0 1 Prula 0 1 1 0 0 0 1 0 0 0 1 Prusi 0 1 1 1 0 0 1 0 0 0 1 Pteaq 1 1 0 0 1 0 0 0 0 0 1 Pyrsp 0 1 1 1 0 0 1 0 0 0 1 Queil 1 0 1 1 0 0 1 0 0 0 1 Ranac 0 1 0 0 0 1 0 0 0 0 1 Ranre 0 1 0 0 0 1 0 0 0 0 1 Robps 0 1 1 1 0 0 1 0 0 0 1 Rosar 0 1 1 1 0 0 1 0 0 0 1 Rosca 0 1 1 1 0 0 1 0 0 0 1 Rubca 0 1 1 1 0 0 1 0 0 0 1 Rubfr 0 1 1 1 0 0 1 0 0 0 1 Rubpe 0 1 0 0 0 0 1 0 0 0 1 Rumac 1 0 0 0 0 1 0 0 0 0 1 Rumco 1 0 0 0 0 1 0 0 0 1 1 Rumcr 1 0 0 0 0 1 0 1 1 0 1 Rumsa 1 0 0 0 0 1 0 0 0 0 1 Rusac 0 1 1 1 0 0 1 0 0 0 1 Samni 1 1 1 0 0 0 1 0 0 0 1 Scrno 0 1 0 0 0 0 1 0 0 0 1 Soldu 0 1 1 0 0 0 1 0 0 0 1 Sonol 1 1 0 0 0 1 0 1 1 0 0 Sordo 0 1 1 0 0 0 1 0 0 0 1 Sorto 0 1 1 0 0 0 1 0 0 0 1 Stasy 0 1 0 0 0 0 1 0 0 0 1 Steho 0 1 0 0 0 0 1 0 0 0 1 Steme 0 1 0 0 0 0 1 1 1 0 0 Symsp 0 1 1 0 0 0 1 0 0 0 1 Tamco 0 1 0 0 0 0 1 0 0 0 1 Tarsp 0 1 0 0 1 0 0 0 0 0 1 Taxba 1 0 1 0 0 0 1 0 0 0 1 Teusc 0 1 0 0 0 0 1 0 0 0 1 Trire 0 1 0 0 1 0 0 0 0 0 1 Ulemi 0 1 1 1 0 0 1 0 0 0 1 Ulmsp 1 0 1 0 0 0 1 0 0 0 1 Urtdi 1 0 0 1 0 0 1 0 0 0 1 Verch 0 1 0 0 0 0 1 0 0 0 1 Vicsa 1 1 0 0 0 0 1 0 1 0 0 Vicse 0 1 0 0 0 0 1 0 0 0 1 Vinmi 0 1 0 0 0 0 1 0 0 0 1 Viohi 0 1 0 0 1 0 0 0 0 0 1 Viore 0 1 0 0 1 0 0 0 0 0 1 seasaes seashiv seasver everalw everparti elaio endozoo epizoo aquat Aceca 1 0 0 0 0 0 0 0 0 Aceps 1 0 0 0 0 0 0 0 0 Agrca 0 0 0 1 0 0 0 0 0 Agrst 0 0 0 1 0 0 0 0 0 Ajure 0 0 0 1 0 1 0 0 0 Allpe 0 1 0 0 0 0 0 0 0 Anaar 0 0 0 0 1 0 0 0 0 Anene 0 0 1 0 0 0 0 1 0 Angsy 1 0 0 0 0 0 0 0 1 Antod 0 0 0 1 0 0 0 1 0 Arrel 0 0 0 0 1 0 0 1 0 Artvu 0 0 0 0 1 0 0 0 0 Aruma 0 0 1 0 0 0 1 0 0 Betsp 1 0 0 0 0 0 0 0 0 Brasy 0 0 0 1 0 0 0 1 0 Brost 0 1 0 0 0 0 0 1 0 Brydi 1 0 0 0 0 0 1 0 0 Calse 1 0 0 0 0 0 0 0 0 Calvu 0 0 0 1 0 0 0 0 0 Carbe 1 0 0 0 0 0 0 0 0 Cardi 0 0 0 1 0 0 0 0 0 Cheal 1 0 0 0 0 0 0 0 0 Chema 0 0 0 1 0 1 0 0 0 Cirar 0 0 0 0 0 0 0 0 0 Cirlu 1 0 0 0 0 0 0 1 0 Cirvu 0 0 0 1 0 0 0 0 0 Conmj 0 0 1 0 0 0 0 0 0 Corav 1 0 0 0 0 0 1 0 0 Cordi 1 0 0 0 0 0 1 1 0 Corsa 1 0 0 0 0 0 1 0 0 Crala 1 0 0 0 0 0 1 0 0 Cramo 1 0 0 0 0 0 1 0 0 Cucba 1 0 0 0 0 0 1 0 0 Cytsc 0 0 0 0 1 1 0 0 0 Dacgl 0 0 0 1 0 0 0 0 0 Dapla 0 0 0 1 0 0 1 0 0 Dauca 0 0 0 1 0 0 0 1 0 Desfl 0 0 0 1 0 0 0 1 0 Diaar 1 1 0 1 1 0 1 1 1 Digpu 0 0 0 1 0 0 0 0 0 Elyca 0 0 0 1 0 0 0 1 0 Epipa 0 0 0 1 0 0 0 0 0 Eupam 0 0 0 0 1 1 0 0 0 Evoeu 1 0 0 0 0 1 1 0 0 Fagsy 1 0 0 0 0 0 1 0 0 Fraal 1 0 0 0 0 0 1 0 0 Fraan 1 0 0 0 0 0 0 0 0 Frasp 1 0 0 0 0 0 0 0 0 Frave 0 0 0 1 0 0 1 1 0 Galap 0 1 0 0 0 0 0 1 0 Galmo 1 0 0 0 0 0 0 0 0 Gerro 0 0 0 1 0 0 0 1 0 Geuur 0 0 0 1 0 0 0 1 0 Glehe 0 0 0 1 0 0 0 0 0 Hedhe 0 0 0 1 0 0 1 0 0 Holla 0 0 0 0 1 0 0 0 0 Holmo 0 0 0 1 0 0 0 1 0 Hyahi 0 0 1 0 0 0 0 0 0 Hyano 0 0 1 0 0 0 0 0 0 Hyppe 0 0 0 0 1 0 0 0 0 Ileaq 0 0 0 1 0 0 1 0 0 Junco 0 0 0 1 0 0 0 1 0 Junef 0 0 0 1 0 0 0 1 0 Lacse 0 0 0 0 1 0 0 0 0 Lapco 0 0 0 0 1 0 0 0 0 Launo 0 0 0 1 0 0 1 0 0 Leuvu 0 0 0 1 0 0 0 0 0 Ligvu 0 0 0 0 1 0 1 0 0 Linre 1 0 0 0 0 1 1 1 0 Lonpe 0 0 0 0 1 0 1 0 0 Luzmu 0 0 0 1 0 1 0 0 0 Malsy 1 0 0 0 0 0 1 0 0 Medlu 0 0 0 1 0 0 0 0 0 Melof 1 0 0 0 0 0 0 0 0 Melpr 1 0 0 0 0 1 0 0 0 Melun 1 0 0 0 0 1 0 0 0 Meran 1 1 1 1 0 1 1 1 0 Milef 0 0 0 1 0 0 0 0 0 Molca 1 0 0 0 0 0 0 0 0 Paprh 1 0 0 0 0 0 0 0 0 Plama 0 0 0 0 1 0 0 1 0 Poaan 0 0 0 0 1 0 0 0 0 Poane 0 0 0 1 0 0 0 0 0 Poapr 0 0 0 1 0 0 0 0 0 Poatr 0 0 0 1 0 0 0 0 0 Polav 1 0 0 0 0 0 0 0 0 Polin 0 0 0 1 0 0 0 0 0 Polmu 0 0 1 0 0 0 1 0 0 Poptr 1 0 0 0 0 0 0 0 0 Potre 0 0 0 0 1 0 0 0 0 Potst 0 0 0 1 0 0 0 0 0 Privu 0 0 0 1 0 1 0 0 0 Pruav 1 0 0 0 0 0 1 0 0 Pruce 1 0 0 0 0 0 1 0 0 Prula 0 0 0 1 0 0 1 0 0 Prusi 1 0 0 0 0 0 1 0 0 Pteaq 1 0 0 0 0 0 0 0 0 Pyrsp 1 0 0 0 0 0 1 0 0 Queil 0 0 0 0 1 0 1 0 0 Ranac 0 0 0 1 0 0 0 1 0 Ranre 0 0 0 1 0 0 0 1 1 Robps 1 0 0 0 0 0 0 0 0 Rosar 0 0 0 0 1 0 1 0 0 Rosca 1 0 0 0 0 0 1 0 0 Rubca 1 0 0 0 0 0 1 0 0 Rubfr 0 0 0 0 1 0 1 0 0 Rubpe 0 0 0 1 0 0 1 0 0 Rumac 0 0 0 1 0 0 0 0 0 Rumco 0 0 0 1 0 0 0 0 1 Rumcr 0 0 0 1 0 0 0 0 0 Rumsa 0 0 0 1 0 0 0 0 0 Rusac 0 0 0 1 0 0 1 0 0 Samni 1 0 0 0 0 0 1 0 0 Scrno 1 0 0 0 0 0 0 0 0 Soldu 1 0 0 0 0 0 1 0 0 Sonol 0 0 0 0 1 0 0 0 0 Sordo 1 0 0 0 0 0 1 0 0 Sorto 1 0 0 0 0 0 1 0 0 Stasy 1 0 0 0 0 0 0 1 0 Steho 0 0 0 1 0 0 0 0 0 Steme 0 0 0 0 1 0 0 0 0 Symsp 0 0 0 0 1 0 1 0 0 Tamco 1 0 0 0 0 0 1 0 0 Tarsp 0 0 0 1 0 0 0 0 0 Taxba 0 0 0 1 0 0 1 0 0 Teusc 0 0 0 0 1 0 0 0 0 Trire 0 0 0 1 0 0 0 1 0 Ulemi 0 0 0 1 0 1 0 0 0 Ulmsp 1 0 0 0 0 0 0 0 0 Urtdi 0 0 0 0 1 0 0 1 0 Verch 0 0 0 1 0 0 0 0 0 Vicsa 0 1 0 0 0 0 0 0 0 Vicse 1 0 0 0 0 0 0 0 0 Vinmi 0 0 0 1 0 1 1 1 0 Viohi 0 0 0 1 0 1 0 0 0 Viore 0 0 0 1 0 1 0 0 0 windgl unsp Aceca 1 0 Aceps 1 0 Agrca 0 1 Agrst 0 1 Ajure 0 0 Allpe 0 1 Anaar 0 1 Anene 0 0 Angsy 0 0 Antod 0 0 Arrel 0 0 Artvu 0 1 Aruma 0 0 Betsp 1 0 Brasy 0 0 Brost 0 0 Brydi 0 0 Calse 1 0 Calvu 1 0 Carbe 1 0 Cardi 0 1 Cheal 0 1 Chema 0 0 Cirar 1 0 Cirlu 0 0 Cirvu 1 0 Conmj 0 1 Corav 0 0 Cordi 1 1 Corsa 0 0 Crala 0 0 Cramo 0 0 Cucba 0 0 Cytsc 0 1 Dacgl 0 1 Dapla 0 0 Dauca 0 0 Desfl 0 0 Diaar 1 1 Digpu 1 0 Elyca 0 0 Epipa 1 0 Eupam 0 0 Evoeu 0 0 Fagsy 0 0 Fraal 0 0 Fraan 1 0 Frasp 1 0 Frave 0 0 Galap 0 0 Galmo 0 1 Gerro 0 0 Geuur 0 0 Glehe 0 1 Hedhe 0 0 Holla 0 1 Holmo 0 0 Hyahi 0 1 Hyano 0 1 Hyppe 1 0 Ileaq 0 0 Junco 0 0 Junef 0 0 Lacse 1 0 Lapco 0 1 Launo 0 0 Leuvu 0 1 Ligvu 0 0 Linre 0 1 Lonpe 0 0 Luzmu 0 0 Malsy 0 0 Medlu 0 1 Melof 0 1 Melpr 0 0 Melun 0 0 Meran 0 1 Milef 0 1 Molca 0 1 Paprh 1 0 Plama 0 0 Poaan 0 1 Poane 0 1 Poapr 0 1 Poatr 0 1 Polav 0 1 Polin 1 0 Polmu 0 0 Poptr 1 0 Potre 0 1 Potst 0 1 Privu 0 0 Pruav 0 0 Pruce 0 0 Prula 0 0 Prusi 0 0 Pteaq 1 0 Pyrsp 0 0 Queil 0 0 Ranac 0 0 Ranre 0 0 Robps 0 1 Rosar 0 0 Rosca 0 0 Rubca 0 0 Rubfr 0 0 Rubpe 0 0 Rumac 1 0 Rumco 0 0 Rumcr 0 1 Rumsa 0 1 Rusac 0 0 Samni 0 0 Scrno 1 0 Soldu 0 0 Sonol 1 0 Sordo 0 0 Sorto 0 0 Stasy 0 0 Steho 0 1 Steme 0 1 Symsp 0 0 Tamco 0 0 Tarsp 1 0 Taxba 0 0 Teusc 0 1 Trire 0 0 Ulemi 0 1 Ulmsp 1 0 Urtdi 0 0 Verch 0 1 Vicsa 0 1 Vicse 0 1 Vinmi 0 1 Viohi 0 0 Viore 0 0 Order of objects: [1] Aceca Aceps Corsa Fraal Evoeu Malsy Pyrsp Pruce Sorto Robps Soldu Calvu [13] Dapla Launo Prula Cytsc Hedhe Ileaq Rusac Ulemi Crala Cramo Prusi Pruav [25] Rosca Sordo Rubca Samni Ligvu Lonpe Rubfr Rosar Symsp Betsp Poptr Carbe [37] Fraan Frasp Ulmsp Corav Fagsy Queil Taxba Agrca Agrst Poane Poatr Rumcr [49] Dacgl Milef Poapr Cardi Rumsa Luzmu Rumac Rumco Antod Elyca Brasy Desfl [61] Holmo Junco Junef Meran Ajure Chema Potst Glehe Geuur Ranac Ranre Cirvu [73] Dauca Digpu Gerro Diaar Epipa Leuvu Medlu Rubpe Verch Steho Vinmi Frave [85] Trire Tarsp Polin Privu Viohi Viore Allpe Brost Galap Melpr Paprh Cheal [97] Polav Galmo Cordi Anaar Steme Lapco Poaan Lacse Sonol Anene Conmj Aruma [109] Hyahi Hyano Eupam Linre Melun Polmu Tamco Vicse Vicsa Angsy Molca Brydi [121] Cucba Melof Calse Cirar Scrno Pteaq Cirlu Stasy Arrel Urtdi Plama Artvu [133] Holla Potre Hyppe Teusc Variable used: [1] NULL endozoo durflow pdias longindex piq vegsout [8] pdias endozoo durflow seasaes begflow pdias NULL [15] everalw longindex begflow durflow height autopoll NULL [22] vegsout pdias piq longindex begflow longindex seasaes [29] pdias vegsout durflow vegsout wind longindex pdias [36] NULL NULL vegsout endozoo durflow seasaes vegaer [43] lign vegaer semiros longindex pdias begflow semiros [50] longindex mycor begflow unsp pdias vegsout epizoo [57] pdias autopoll pdias semiros mycor height pdias [64] wind durflow elaio longindex pdias vegaer longindex [71] monocarp height autopoll pdias durflow semiros longindex [78] pdias durflow height pdias longindex ros longindex [85] pdias mycor elaio pdias longindex everalw longindex [92] height seasaes pdias durflow pdias longindex ros [99] everparti durflow insects durflow windgl mycor suman [106] longindex ros vegsout longindex leafy durflow longindex [113] autopoll mycor pdias longindex begflow longindex pdias [120] height autopoll vegsout pdias durflow longindex epizoo [127] pdias everparti pdias height epizoo durflow longindex [134] vegsout vegaer Separation step: [1] 0 6 8 7 5 10 9 8 7 6 4 7 8 0 6 5 7 6 7 3 0 7 6 8 7 [26] 5 6 4 5 7 6 7 2 6 5 0 0 6 4 5 3 4 1 8 7 9 8 6 8 7 [51] 5 7 6 7 8 4 7 6 8 7 5 7 6 3 9 8 7 6 8 7 5 7 9 8 6 [76] 4 7 8 6 8 7 8 5 9 8 7 6 7 8 2 7 8 6 7 5 8 7 6 4 7 [101] 6 7 5 6 3 8 7 6 7 5 8 7 8 6 8 7 4 8 7 9 8 6 9 10 8 [126] 7 8 5 8 7 6 9 8 7 8 Available components: [1] "data" "hasNA" "order" "variable" "step" "order.lab" [7] "call" > > suppressWarnings(RNGversion("3.5.0")) # back compatibility of results > set.seed(1) > ani.N1 <- animals; ani.N1[cbind(sample.int(20, 10), sample.int(6, 10, replace=TRUE))] <- NA > (maniN <- mona(ani.N1, trace=TRUE)) Loop npass = 1: (ka,kb) = (1,20) for(j ..) -> jma=1, jtel(.,z) = (10, 10) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 10, 10, 11) --> nclu = 2, kwan[ka] = 10 L500; found kwan[1] = 10 >= 2 ==> Loop again Loop npass = 2: (ka,kb) = (1,10) for(j ..) -> jma=3, jtel(.,z) = (3, 7) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 7, 3, 8) --> nclu = 3, kwan[ka] = 3 Loop npass = 2: (ka,kb) = (11,20) for(j ..) -> jma=2, jtel(.,z) = (1, 9) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 9, 1, 20) --> nclu = 4, kwan[ka] = 1 L500; found kwan[1] = 7 >= 2 ==> Loop again Loop npass = 3: (ka,kb) = (1,7) for(j ..) -> jma=5, jtel(.,z) = (1, 6) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 6, 1, 7) --> nclu = 5, kwan[ka] = 1 Loop npass = 3: (ka,kb) = (8,10) for(j ..) -> jma=4, jtel(.,z) = (1, 2) --> splitting: ka=8, ner[ka]=11 => (nzf, jtel2, jres, km) = (0, 1, 2, 9) --> nclu = 6, kwan[ka] = 2 Loop npass = 3: (ka,kb) = (11,19) for(j ..) -> jma=6, jtel(.,z) = (7, 2) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (0, 7, 2, 18) --> nclu = 7, kwan[ka] = 2 L500; found kwan[1] = 6 >= 2 ==> Loop again Loop npass = 4: (ka,kb) = (1,6) for(j ..) -> jma=2, jtel(.,z) = (1, 5) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 5, 1, 6) --> nclu = 8, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (9,10) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=9, ner[ka]=12 => (nzf, jtel2, jres, km) = (0, 1, 1, 10) --> nclu = 9, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (11,17) for(j ..) -> jma=4, jtel(.,z) = (4, 3) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 3, 4, 14) --> nclu = 10, kwan[ka] = 4 Loop npass = 4: (ka,kb) = (18,19) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=18, ner[ka]=8 => (nzf, jtel2, jres, km) = (1, 1, 1, 19) --> nclu = 11, kwan[ka] = 1 L500; found kwan[1] = 5 >= 2 ==> Loop again Loop npass = 5: (ka,kb) = (1,5) for(j ..) -> jma=6, jtel(.,z) = (2, 3) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 3, 2, 4) --> nclu = 12, kwan[ka] = 2 Loop npass = 5: (ka,kb) = (11,13) for(j ..) -> jma=5, jtel(.,z) = (2, 1) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 1, 2, 12) --> nclu = 13, kwan[ka] = 2 Loop npass = 5: (ka,kb) = (14,17) for(j ..) -> jma=5, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 13, kwan[ka] = -4 L500; found kwan[1] = 3 >= 2 ==> Loop again Loop npass = 6: (ka,kb) = (1,3) for(j ..) -> jma=5, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 13, kwan[ka] = -3 Loop npass = 6: (ka,kb) = (4,5) for(j ..) -> jma=5, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 13, kwan[ka] = -2 Loop npass = 6: (ka,kb) = (12,13) for(j ..) -> jma=5, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 13, kwan[ka] = -2 mona(x, ..) fit; x of dimension 20x6 Because of NA's, revised data: war fly ver end gro hai ant 0 0 0 0 0 0 bee 0 1 0 0 1 1 cat 1 0 1 0 0 1 cpl 0 0 0 0 0 1 chi 1 0 1 1 1 1 cow 1 0 1 0 1 1 duc 1 1 1 0 1 0 eag 1 0 1 1 0 0 ele 1 0 1 1 1 1 fly 0 1 0 0 0 0 fro 0 0 1 1 0 0 her 0 0 1 0 1 0 lio 1 0 1 1 1 1 liz 0 0 0 0 0 0 lob 0 0 0 0 0 0 man 1 0 1 1 1 1 rab 1 0 1 0 1 1 sal 0 0 1 0 0 0 spi 0 0 0 0 0 1 wha 1 0 1 1 1 0 Order of objects: [1] ant liz lob cpl spi fly bee fro her sal cat cow rab chi ele lio man eag wha [20] duc Variable used: [1] NULL NULL hai NULL fly gro ver end gro war gro NULL end NULL NULL [16] NULL hai gro fly Separation step: [1] 0 0 5 0 4 3 2 3 4 1 5 0 4 0 0 0 3 4 2 Available components: [1] "data" "hasNA" "order" "variable" "step" "order.lab" [7] "call" > > for(seed in c(2:20)) { + set.seed(seed); cat("seed = ", seed,"\n") + ani.N2 <- animals + ani.N2[cbind(sample.int(20, 9), + sample.int( 6, 9, replace=TRUE))] <- NA + try(print(maniN2 <- mona(ani.N2, trace=TRUE))) + } seed = 2 Loop npass = 1: (ka,kb) = (1,20) for(j ..) -> jma=1, jtel(.,z) = (10, 10) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 10, 10, 11) --> nclu = 2, kwan[ka] = 10 L500; found kwan[1] = 10 >= 2 ==> Loop again Loop npass = 2: (ka,kb) = (1,10) for(j ..) -> jma=3, jtel(.,z) = (4, 6) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 6, 4, 7) --> nclu = 3, kwan[ka] = 4 Loop npass = 2: (ka,kb) = (11,20) for(j ..) -> jma=5, jtel(.,z) = (9, 1) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (0, 9, 1, 20) --> nclu = 4, kwan[ka] = 1 L500; found kwan[1] = 6 >= 2 ==> Loop again Loop npass = 3: (ka,kb) = (1,6) for(j ..) -> jma=6, jtel(.,z) = (2, 4) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 4, 2, 5) --> nclu = 5, kwan[ka] = 2 Loop npass = 3: (ka,kb) = (7,10) for(j ..) -> jma=4, jtel(.,z) = (1, 3) --> splitting: ka=7, ner[ka]=11 => (nzf, jtel2, jres, km) = (0, 1, 3, 8) --> nclu = 6, kwan[ka] = 3 Loop npass = 3: (ka,kb) = (11,19) for(j ..) -> jma=4, jtel(.,z) = (5, 4) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 4, 5, 15) --> nclu = 7, kwan[ka] = 5 L500; found kwan[1] = 4 >= 2 ==> Loop again Loop npass = 4: (ka,kb) = (1,4) for(j ..) -> jma=2, jtel(.,z) = (2, 2) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 2, 2, 3) --> nclu = 8, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (5,6) for(j ..) -> jma=2, jtel(.,z) = (2, 2) --> _NO_ splitting --> nclu = 8, kwan[ka] = -2 Loop npass = 4: (ka,kb) = (8,10) for(j ..) -> jma=5, jtel(.,z) = (1, 2) --> splitting: ka=8, ner[ka]=12 => (nzf, jtel2, jres, km) = (0, 1, 2, 9) --> nclu = 9, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (11,14) for(j ..) -> jma=2, jtel(.,z) = (2, 2) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 2, 2, 13) --> nclu = 10, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (15,19) for(j ..) -> jma=2, jtel(.,z) = (1, 4) --> splitting: ka=15, ner[ka]=5 => (nzf, jtel2, jres, km) = (1, 4, 1, 19) --> nclu = 11, kwan[ka] = 1 L500; found kwan[1] = 2 >= 2 ==> Loop again Loop npass = 5: (ka,kb) = (1,2) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 1, 1, 2) --> nclu = 12, kwan[ka] = 1 Loop npass = 5: (ka,kb) = (3,4) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=3, ner[ka]=2 => (nzf, jtel2, jres, km) = (0, 1, 1, 4) --> nclu = 13, kwan[ka] = 1 Loop npass = 5: (ka,kb) = (9,10) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 13, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (11,12) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 13, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (13,14) for(j ..) -> jma=6, jtel(.,z) = (1, 1) --> splitting: ka=13, ner[ka]=6 => (nzf, jtel2, jres, km) = (0, 1, 1, 14) --> nclu = 14, kwan[ka] = 1 Loop npass = 5: (ka,kb) = (15,18) for(j ..) -> jma=6, jtel(.,z) = (2, 2) --> splitting: ka=15, ner[ka]=5 => (nzf, jtel2, jres, km) = (0, 2, 2, 17) --> nclu = 15, kwan[ka] = 2 L500; found kwan[15] = 2 >= 2 ==> Loop again Loop npass = 6: (ka,kb) = (15,16) for(j ..) -> jma=6, jtel(.,z) = (2, 2) --> _NO_ splitting --> nclu = 15, kwan[ka] = -2 Loop npass = 6: (ka,kb) = (17,18) for(j ..) -> jma=6, jtel(.,z) = (2, 2) --> _NO_ splitting --> nclu = 15, kwan[ka] = -2 mona(x, ..) fit; x of dimension 20x6 Because of NA's, revised data: war fly ver end gro hai ant 0 0 0 0 1 0 bee 0 1 0 0 1 0 cat 1 0 1 0 1 1 cpl 0 0 0 0 0 1 chi 1 0 1 1 1 1 cow 1 1 1 0 1 1 duc 1 1 1 0 1 0 eag 1 1 1 1 0 0 ele 1 0 1 1 1 0 fly 0 1 0 0 0 0 fro 0 0 1 1 0 0 her 0 0 1 0 1 0 lio 1 0 1 1 1 1 liz 0 0 1 0 0 0 lob 0 0 0 0 0 0 man 1 1 1 1 1 1 rab 1 0 1 0 1 1 sal 0 0 1 0 0 0 spi 0 0 0 0 0 1 wha 1 0 1 1 1 0 Order of objects: [1] ant lob bee fly cpl spi fro her liz sal cat rab cow duc chi lio ele wha man [20] eag Variable used: [1] gro fly gro hai NULL ver end gro NULL war NULL fly hai end NULL [16] hai NULL fly gro Separation step: [1] 5 4 5 3 0 2 3 4 0 1 0 4 5 3 0 5 0 4 2 Available components: [1] "data" "hasNA" "order" "variable" "step" "order.lab" [7] "call" seed = 3 Loop npass = 1: (ka,kb) = (1,20) for(j ..) -> jma=1, jtel(.,z) = (10, 10) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 10, 10, 11) --> nclu = 2, kwan[ka] = 10 L500; found kwan[1] = 10 >= 2 ==> Loop again Loop npass = 2: (ka,kb) = (1,10) for(j ..) -> jma=3, jtel(.,z) = (4, 6) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 6, 4, 7) --> nclu = 3, kwan[ka] = 4 Loop npass = 2: (ka,kb) = (11,20) for(j ..) -> jma=2, jtel(.,z) = (2, 8) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 8, 2, 19) --> nclu = 4, kwan[ka] = 2 L500; found kwan[1] = 6 >= 2 ==> Loop again Loop npass = 3: (ka,kb) = (1,6) for(j ..) -> jma=5, jtel(.,z) = (3, 3) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 3, 3, 4) --> nclu = 5, kwan[ka] = 3 Loop npass = 3: (ka,kb) = (7,10) for(j ..) -> jma=4, jtel(.,z) = (1, 3) --> splitting: ka=7, ner[ka]=11 => (nzf, jtel2, jres, km) = (0, 1, 3, 8) --> nclu = 6, kwan[ka] = 3 Loop npass = 3: (ka,kb) = (11,18) for(j ..) -> jma=4, jtel(.,z) = (6, 2) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 2, 6, 13) --> nclu = 7, kwan[ka] = 6 Loop npass = 3: (ka,kb) = (19,20) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=19, ner[ka]=7 => (nzf, jtel2, jres, km) = (0, 1, 1, 20) --> nclu = 8, kwan[ka] = 1 L500; found kwan[1] = 3 >= 2 ==> Loop again Loop npass = 4: (ka,kb) = (1,3) for(j ..) -> jma=2, jtel(.,z) = (1, 2) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 2, 1, 3) --> nclu = 9, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (4,6) for(j ..) -> jma=2, jtel(.,z) = (1, 2) --> splitting: ka=4, ner[ka]=4 => (nzf, jtel2, jres, km) = (1, 2, 1, 6) --> nclu = 10, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (8,10) for(j ..) -> jma=5, jtel(.,z) = (1, 2) --> splitting: ka=8, ner[ka]=12 => (nzf, jtel2, jres, km) = (0, 1, 2, 9) --> nclu = 11, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (11,12) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 1, 1, 12) --> nclu = 12, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (13,18) for(j ..) -> jma=6, jtel(.,z) = (4, 2) --> splitting: ka=13, ner[ka]=5 => (nzf, jtel2, jres, km) = (0, 4, 2, 17) --> nclu = 13, kwan[ka] = 2 L500; found kwan[1] = 2 >= 2 ==> Loop again Loop npass = 5: (ka,kb) = (1,2) for(j ..) -> jma=6, jtel(.,z) = (4, 2) --> _NO_ splitting --> nclu = 13, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (4,5) for(j ..) -> jma=6, jtel(.,z) = (4, 2) --> _NO_ splitting --> nclu = 13, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (9,10) for(j ..) -> jma=6, jtel(.,z) = (4, 2) --> _NO_ splitting --> nclu = 13, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (13,16) for(j ..) -> jma=6, jtel(.,z) = (4, 2) --> _NO_ splitting --> nclu = 13, kwan[ka] = -4 Loop npass = 5: (ka,kb) = (17,18) for(j ..) -> jma=6, jtel(.,z) = (4, 2) --> _NO_ splitting --> nclu = 13, kwan[ka] = -2 mona(x, ..) fit; x of dimension 20x6 Because of NA's, revised data: war fly ver end gro hai ant 0 0 0 0 1 0 bee 0 1 0 0 1 1 cat 1 0 1 0 0 1 cpl 0 0 0 0 0 1 chi 1 0 1 1 1 1 cow 1 0 1 1 1 1 duc 1 1 1 1 1 0 eag 1 1 1 1 0 0 ele 1 0 1 1 1 0 fly 0 1 0 0 0 0 fro 0 0 1 1 0 0 her 0 0 1 0 1 0 lio 1 0 1 1 1 1 liz 0 0 1 0 0 0 lob 0 0 0 0 1 0 man 1 0 1 1 1 1 rab 1 0 1 0 1 1 sal 0 0 1 0 0 0 spi 0 0 0 0 0 1 wha 1 0 1 1 1 0 Order of objects: [1] ant lob bee cpl spi fly fro her liz sal cat rab chi cow lio man ele wha duc [20] eag Variable used: [1] NULL fly gro NULL fly ver end gro NULL war gro end NULL NULL NULL [16] hai NULL fly gro Separation step: [1] 0 4 3 0 4 2 3 4 0 1 4 3 0 0 0 4 0 2 3 Available components: [1] "data" "hasNA" "order" "variable" "step" "order.lab" [7] "call" seed = 4 Error in mona(ani.N2, trace = TRUE) : No clustering performed, all variables have at least one missing value. seed = 5 Error in mona(ani.N2, trace = TRUE) : No clustering performed, all variables have at least one missing value. seed = 6 Loop npass = 1: (ka,kb) = (1,20) for(j ..) -> jma=3, jtel(.,z) = (14, 6) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 6, 14, 7) --> nclu = 2, kwan[ka] = 14 L500; found kwan[1] = 6 >= 2 ==> Loop again Loop npass = 2: (ka,kb) = (1,6) for(j ..) -> jma=2, jtel(.,z) = (2, 4) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 4, 2, 5) --> nclu = 3, kwan[ka] = 2 Loop npass = 2: (ka,kb) = (7,20) for(j ..) -> jma=6, jtel(.,z) = (5, 9) --> splitting: ka=7, ner[ka]=3 => (nzf, jtel2, jres, km) = (0, 5, 9, 12) --> nclu = 4, kwan[ka] = 9 L500; found kwan[1] = 4 >= 2 ==> Loop again Loop npass = 3: (ka,kb) = (1,4) for(j ..) -> jma=5, jtel(.,z) = (1, 3) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 1, 3, 2) --> nclu = 5, kwan[ka] = 3 Loop npass = 3: (ka,kb) = (5,6) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=5, ner[ka]=2 => (nzf, jtel2, jres, km) = (0, 1, 1, 6) --> nclu = 6, kwan[ka] = 1 Loop npass = 3: (ka,kb) = (7,11) for(j ..) -> jma=4, jtel(.,z) = (2, 3) --> splitting: ka=7, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 3, 2, 10) --> nclu = 7, kwan[ka] = 2 Loop npass = 3: (ka,kb) = (12,20) for(j ..) -> jma=2, jtel(.,z) = (2, 7) --> splitting: ka=12, ner[ka]=5 => (nzf, jtel2, jres, km) = (1, 7, 2, 19) --> nclu = 8, kwan[ka] = 2 L500; found kwan[2] = 3 >= 2 ==> Loop again Loop npass = 4: (ka,kb) = (2,4) for(j ..) -> jma=6, jtel(.,z) = (2, 1) --> splitting: ka=2, ner[ka]=4 => (nzf, jtel2, jres, km) = (0, 2, 1, 4) --> nclu = 9, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (7,9) for(j ..) -> jma=5, jtel(.,z) = (2, 1) --> splitting: ka=7, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 1, 2, 8) --> nclu = 10, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (10,11) for(j ..) -> jma=5, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 10, kwan[ka] = -2 Loop npass = 4: (ka,kb) = (12,18) for(j ..) -> jma=4, jtel(.,z) = (5, 2) --> splitting: ka=12, ner[ka]=5 => (nzf, jtel2, jres, km) = (0, 5, 2, 17) --> nclu = 11, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (19,20) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> splitting: ka=19, ner[ka]=7 => (nzf, jtel2, jres, km) = (1, 1, 1, 20) --> nclu = 12, kwan[ka] = 1 L500; found kwan[2] = 2 >= 2 ==> Loop again Loop npass = 5: (ka,kb) = (2,3) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 12, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (8,9) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 12, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (12,16) for(j ..) -> jma=1, jtel(.,z) = (3, 2) --> splitting: ka=12, ner[ka]=5 => (nzf, jtel2, jres, km) = (0, 3, 2, 15) --> nclu = 13, kwan[ka] = 2 Loop npass = 5: (ka,kb) = (17,18) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=17, ner[ka]=12 => (nzf, jtel2, jres, km) = (0, 1, 1, 18) --> nclu = 14, kwan[ka] = 1 L500; found kwan[12] = 3 >= 2 ==> Loop again Loop npass = 6: (ka,kb) = (12,14) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 14, kwan[ka] = -3 Loop npass = 6: (ka,kb) = (15,16) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 14, kwan[ka] = -2 mona(x, ..) fit; x of dimension 20x6 Because of NA's, revised data: war fly ver end gro hai ant 0 0 0 0 1 0 bee 0 1 0 0 1 1 cat 1 0 1 0 0 1 cpl 0 0 0 0 0 1 chi 1 0 1 1 1 0 cow 1 0 1 0 1 1 duc 1 1 1 0 1 0 eag 1 1 1 1 0 0 ele 1 0 1 1 1 0 fly 0 1 0 0 0 0 fro 0 0 1 1 1 0 her 0 0 1 0 1 0 lio 1 0 1 1 1 1 liz 0 0 1 0 0 0 lob 0 0 0 0 0 0 man 1 0 1 1 1 1 rab 1 0 1 0 1 1 sal 0 0 1 1 1 0 spi 0 0 0 0 0 1 wha 1 0 1 1 1 0 Order of objects: [1] ant cpl spi lob bee fly cat cow rab lio man chi ele wha fro sal her liz duc [20] eag Variable used: [1] gro NULL hai fly gro ver gro NULL end NULL hai NULL NULL war NULL [16] end gro fly end Separation step: [1] 3 0 4 2 3 1 4 0 3 0 2 0 0 5 0 4 5 3 4 Available components: [1] "data" "hasNA" "order" "variable" "step" "order.lab" [7] "call" seed = 7 Loop npass = 1: (ka,kb) = (1,20) for(j ..) -> jma=1, jtel(.,z) = (11, 9) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 9, 11, 10) --> nclu = 2, kwan[ka] = 11 L500; found kwan[1] = 9 >= 2 ==> Loop again Loop npass = 2: (ka,kb) = (1,9) for(j ..) -> jma=3, jtel(.,z) = (3, 6) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 6, 3, 7) --> nclu = 3, kwan[ka] = 3 Loop npass = 2: (ka,kb) = (10,20) for(j ..) -> jma=6, jtel(.,z) = (7, 4) --> splitting: ka=10, ner[ka]=3 => (nzf, jtel2, jres, km) = (0, 7, 4, 17) --> nclu = 4, kwan[ka] = 4 L500; found kwan[1] = 6 >= 2 ==> Loop again Loop npass = 3: (ka,kb) = (1,6) for(j ..) -> jma=2, jtel(.,z) = (2, 4) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 4, 2, 5) --> nclu = 5, kwan[ka] = 2 Loop npass = 3: (ka,kb) = (7,9) for(j ..) -> jma=4, jtel(.,z) = (1, 2) --> splitting: ka=7, ner[ka]=11 => (nzf, jtel2, jres, km) = (0, 1, 2, 8) --> nclu = 6, kwan[ka] = 2 Loop npass = 3: (ka,kb) = (10,16) for(j ..) -> jma=5, jtel(.,z) = (5, 2) --> splitting: ka=10, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 2, 5, 12) --> nclu = 7, kwan[ka] = 5 Loop npass = 3: (ka,kb) = (17,20) for(j ..) -> jma=2, jtel(.,z) = (2, 2) --> splitting: ka=17, ner[ka]=7 => (nzf, jtel2, jres, km) = (0, 2, 2, 19) --> nclu = 8, kwan[ka] = 2 L500; found kwan[1] = 4 >= 2 ==> Loop again Loop npass = 4: (ka,kb) = (1,4) for(j ..) -> jma=5, jtel(.,z) = (2, 2) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 2, 2, 3) --> nclu = 9, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (5,6) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=5, ner[ka]=2 => (nzf, jtel2, jres, km) = (0, 1, 1, 6) --> nclu = 10, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (8,9) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 10, kwan[ka] = -2 Loop npass = 4: (ka,kb) = (10,11) for(j ..) -> jma=3, jtel(.,z) = (1, 1) --> splitting: ka=10, ner[ka]=3 => (nzf, jtel2, jres, km) = (0, 1, 1, 11) --> nclu = 11, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (12,16) for(j ..) -> jma=4, jtel(.,z) = (2, 3) --> splitting: ka=12, ner[ka]=5 => (nzf, jtel2, jres, km) = (0, 2, 3, 14) --> nclu = 12, kwan[ka] = 3 Loop npass = 4: (ka,kb) = (17,18) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> splitting: ka=17, ner[ka]=7 => (nzf, jtel2, jres, km) = (1, 1, 1, 18) --> nclu = 13, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (19,20) for(j ..) -> jma=3, jtel(.,z) = (1, 1) --> splitting: ka=19, ner[ka]=9 => (nzf, jtel2, jres, km) = (0, 1, 1, 20) --> nclu = 14, kwan[ka] = 1 L500; found kwan[1] = 2 >= 2 ==> Loop again Loop npass = 5: (ka,kb) = (1,2) for(j ..) -> jma=3, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 14, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (3,4) for(j ..) -> jma=6, jtel(.,z) = (1, 1) --> splitting: ka=3, ner[ka]=15 => (nzf, jtel2, jres, km) = (1, 1, 1, 4) --> nclu = 15, kwan[ka] = 1 Loop npass = 5: (ka,kb) = (12,13) for(j ..) -> jma=6, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 15, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (14,16) for(j ..) -> jma=6, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 15, kwan[ka] = -3 mona(x, ..) fit; x of dimension 20x6 Because of NA's, revised data: war fly ver end gro hai ant 0 0 0 0 1 0 bee 0 1 0 0 1 1 cat 1 0 1 0 0 1 cpl 1 0 0 0 0 1 chi 1 0 1 1 1 1 cow 1 0 1 0 1 1 duc 1 1 1 0 1 0 eag 1 1 1 1 0 0 ele 1 0 1 1 1 0 fly 0 1 0 0 0 0 fro 0 0 1 1 0 0 her 0 0 0 0 1 0 lio 1 0 1 0 1 1 liz 0 0 1 0 0 0 lob 0 0 0 0 0 0 man 1 0 1 1 1 1 rab 1 0 1 0 1 1 sal 0 0 1 0 0 0 spi 0 0 0 0 0 1 wha 1 0 0 1 1 0 Order of objects: [1] ant her lob spi bee fly fro liz sal cat cpl chi man cow lio rab duc eag ele [20] wha Variable used: [1] NULL gro hai fly gro ver end NULL war ver gro NULL end NULL NULL [16] hai end fly ver Separation step: [1] 0 4 5 3 4 2 3 0 1 4 3 0 4 0 0 2 4 3 4 Available components: [1] "data" "hasNA" "order" "variable" "step" "order.lab" [7] "call" seed = 8 Error in mona(ani.N2, trace = TRUE) : No clustering performed, all variables have at least one missing value. seed = 9 Error in mona(ani.N2, trace = TRUE) : No clustering performed, all variables have at least one missing value. seed = 10 Loop npass = 1: (ka,kb) = (1,20) for(j ..) -> jma=1, jtel(.,z) = (10, 10) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 10, 10, 11) --> nclu = 2, kwan[ka] = 10 L500; found kwan[1] = 10 >= 2 ==> Loop again Loop npass = 2: (ka,kb) = (1,10) for(j ..) -> jma=4, jtel(.,z) = (1, 9) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 9, 1, 10) --> nclu = 3, kwan[ka] = 1 Loop npass = 2: (ka,kb) = (11,20) for(j ..) -> jma=6, jtel(.,z) = (6, 4) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (0, 6, 4, 17) --> nclu = 4, kwan[ka] = 4 L500; found kwan[1] = 9 >= 2 ==> Loop again Loop npass = 3: (ka,kb) = (1,9) for(j ..) -> jma=3, jtel(.,z) = (4, 5) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 5, 4, 6) --> nclu = 5, kwan[ka] = 4 Loop npass = 3: (ka,kb) = (11,16) for(j ..) -> jma=4, jtel(.,z) = (2, 4) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 4, 2, 15) --> nclu = 6, kwan[ka] = 2 Loop npass = 3: (ka,kb) = (17,20) for(j ..) -> jma=2, jtel(.,z) = (2, 2) --> splitting: ka=17, ner[ka]=7 => (nzf, jtel2, jres, km) = (0, 2, 2, 19) --> nclu = 7, kwan[ka] = 2 L500; found kwan[1] = 5 >= 2 ==> Loop again Loop npass = 4: (ka,kb) = (1,5) for(j ..) -> jma=2, jtel(.,z) = (2, 3) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 3, 2, 4) --> nclu = 8, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (6,9) for(j ..) -> jma=2, jtel(.,z) = (1, 3) --> splitting: ka=6, ner[ka]=4 => (nzf, jtel2, jres, km) = (1, 3, 1, 9) --> nclu = 9, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (11,14) for(j ..) -> jma=5, jtel(.,z) = (3, 1) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 1, 3, 12) --> nclu = 10, kwan[ka] = 3 Loop npass = 4: (ka,kb) = (15,16) for(j ..) -> jma=5, jtel(.,z) = (3, 1) --> _NO_ splitting --> nclu = 10, kwan[ka] = -2 Loop npass = 4: (ka,kb) = (17,18) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> splitting: ka=17, ner[ka]=7 => (nzf, jtel2, jres, km) = (1, 1, 1, 18) --> nclu = 11, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (19,20) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 11, kwan[ka] = -2 L500; found kwan[1] = 3 >= 2 ==> Loop again Loop npass = 5: (ka,kb) = (1,3) for(j ..) -> jma=5, jtel(.,z) = (1, 2) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 1, 2, 2) --> nclu = 12, kwan[ka] = 2 Loop npass = 5: (ka,kb) = (4,5) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=4, ner[ka]=2 => (nzf, jtel2, jres, km) = (0, 1, 1, 5) --> nclu = 13, kwan[ka] = 1 Loop npass = 5: (ka,kb) = (6,8) for(j ..) -> jma=5, jtel(.,z) = (1, 2) --> splitting: ka=6, ner[ka]=4 => (nzf, jtel2, jres, km) = (1, 2, 1, 8) --> nclu = 14, kwan[ka] = 1 Loop npass = 5: (ka,kb) = (12,14) for(j ..) -> jma=5, jtel(.,z) = (1, 2) --> _NO_ splitting --> nclu = 14, kwan[ka] = -3 L500; found kwan[2] = 2 >= 2 ==> Loop again Loop npass = 6: (ka,kb) = (2,3) for(j ..) -> jma=6, jtel(.,z) = (1, 1) --> splitting: ka=2, ner[ka]=15 => (nzf, jtel2, jres, km) = (1, 1, 1, 3) --> nclu = 15, kwan[ka] = 1 Loop npass = 6: (ka,kb) = (6,7) for(j ..) -> jma=6, jtel(.,z) = (1, 1) --> splitting: ka=6, ner[ka]=4 => (nzf, jtel2, jres, km) = (0, 1, 1, 7) --> nclu = 16, kwan[ka] = 1 mona(x, ..) fit; x of dimension 20x6 Because of NA's, revised data: war fly ver end gro hai ant 0 0 0 0 1 0 bee 0 1 0 0 1 1 cat 1 0 1 0 0 1 cpl 0 0 1 0 0 1 chi 1 0 1 1 1 1 cow 1 0 1 0 1 1 duc 1 1 1 0 1 0 eag 1 1 1 1 0 0 ele 1 0 1 1 1 0 fly 0 1 0 0 0 0 fro 0 0 0 1 0 0 her 0 0 1 0 1 0 lio 1 0 1 0 1 1 liz 0 0 1 0 0 0 lob 0 0 0 0 0 0 man 1 0 1 1 1 1 rab 1 0 1 0 1 1 sal 0 1 1 0 0 0 spi 0 0 0 0 0 1 wha 1 0 1 1 1 0 Order of objects: [1] ant lob spi bee fly cpl liz her sal fro cat cow lio rab chi man duc eag ele [20] wha Variable used: [1] gro hai fly gro ver hai gro fly end war gro NULL NULL end NULL [16] hai end fly NULL Separation step: [1] 5 6 4 5 3 6 5 4 2 1 4 0 0 3 0 2 4 3 0 Available components: [1] "data" "hasNA" "order" "variable" "step" "order.lab" [7] "call" seed = 11 Error in mona(ani.N2, trace = TRUE) : No clustering performed, all variables have at least one missing value. seed = 12 Loop npass = 1: (ka,kb) = (1,20) for(j ..) -> jma=6, jtel(.,z) = (9, 11) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 11, 9, 12) --> nclu = 2, kwan[ka] = 9 L500; found kwan[1] = 11 >= 2 ==> Loop again Loop npass = 2: (ka,kb) = (1,11) for(j ..) -> jma=1, jtel(.,z) = (4, 7) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 7, 4, 8) --> nclu = 3, kwan[ka] = 4 Loop npass = 2: (ka,kb) = (12,20) for(j ..) -> jma=5, jtel(.,z) = (6, 3) --> splitting: ka=12, ner[ka]=2 => (nzf, jtel2, jres, km) = (0, 6, 3, 18) --> nclu = 4, kwan[ka] = 3 L500; found kwan[1] = 7 >= 2 ==> Loop again Loop npass = 3: (ka,kb) = (1,7) for(j ..) -> jma=2, jtel(.,z) = (2, 5) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 2, 5, 3) --> nclu = 5, kwan[ka] = 5 Loop npass = 3: (ka,kb) = (8,11) for(j ..) -> jma=2, jtel(.,z) = (2, 2) --> splitting: ka=8, ner[ka]=7 => (nzf, jtel2, jres, km) = (0, 2, 2, 10) --> nclu = 6, kwan[ka] = 2 Loop npass = 3: (ka,kb) = (12,17) for(j ..) -> jma=3, jtel(.,z) = (3, 3) --> splitting: ka=12, ner[ka]=2 => (nzf, jtel2, jres, km) = (1, 3, 3, 15) --> nclu = 7, kwan[ka] = 3 Loop npass = 3: (ka,kb) = (18,20) for(j ..) -> jma=1, jtel(.,z) = (1, 2) --> splitting: ka=18, ner[ka]=3 => (nzf, jtel2, jres, km) = (0, 1, 2, 19) --> nclu = 8, kwan[ka] = 2 L500; found kwan[1] = 2 >= 2 ==> Loop again Loop npass = 4: (ka,kb) = (1,2) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 1, 1, 2) --> nclu = 9, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (3,7) for(j ..) -> jma=4, jtel(.,z) = (2, 3) --> splitting: ka=3, ner[ka]=11 => (nzf, jtel2, jres, km) = (0, 2, 3, 5) --> nclu = 10, kwan[ka] = 3 Loop npass = 4: (ka,kb) = (8,9) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> splitting: ka=8, ner[ka]=7 => (nzf, jtel2, jres, km) = (1, 1, 1, 9) --> nclu = 11, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (10,11) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 11, kwan[ka] = -2 Loop npass = 4: (ka,kb) = (12,14) for(j ..) -> jma=2, jtel(.,z) = (1, 2) --> splitting: ka=12, ner[ka]=2 => (nzf, jtel2, jres, km) = (0, 1, 2, 13) --> nclu = 12, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (15,17) for(j ..) -> jma=2, jtel(.,z) = (1, 2) --> _NO_ splitting --> nclu = 12, kwan[ka] = -3 Loop npass = 4: (ka,kb) = (19,20) for(j ..) -> jma=2, jtel(.,z) = (1, 2) --> _NO_ splitting --> nclu = 12, kwan[ka] = -2 L500; found kwan[3] = 2 >= 2 ==> Loop again Loop npass = 5: (ka,kb) = (3,4) for(j ..) -> jma=3, jtel(.,z) = (1, 1) --> splitting: ka=3, ner[ka]=11 => (nzf, jtel2, jres, km) = (0, 1, 1, 4) --> nclu = 13, kwan[ka] = 1 Loop npass = 5: (ka,kb) = (5,7) for(j ..) -> jma=5, jtel(.,z) = (1, 2) --> splitting: ka=5, ner[ka]=12 => (nzf, jtel2, jres, km) = (0, 1, 2, 6) --> nclu = 14, kwan[ka] = 2 Loop npass = 5: (ka,kb) = (13,14) for(j ..) -> jma=5, jtel(.,z) = (1, 2) --> _NO_ splitting --> nclu = 14, kwan[ka] = -2 L500; found kwan[6] = 2 >= 2 ==> Loop again Loop npass = 6: (ka,kb) = (6,7) for(j ..) -> jma=5, jtel(.,z) = (1, 2) --> _NO_ splitting --> nclu = 14, kwan[ka] = -2 mona(x, ..) fit; x of dimension 20x6 Because of NA's, revised data: war fly ver end gro hai ant 0 1 0 0 1 0 bee 1 1 0 0 1 1 cat 1 0 0 0 0 1 cpl 0 0 0 0 0 1 chi 1 0 0 1 1 1 cow 1 0 1 0 1 1 duc 1 1 1 0 1 0 eag 1 1 1 1 0 0 ele 1 0 1 1 1 0 fly 0 1 0 0 0 0 fro 0 0 1 1 0 0 her 0 0 1 0 1 0 lio 1 0 1 0 1 1 liz 0 0 1 0 0 0 lob 0 0 0 1 0 0 man 1 0 0 1 1 1 rab 1 0 1 0 1 1 sal 0 0 1 0 0 0 spi 0 0 0 0 0 1 wha 1 0 1 1 1 0 Order of objects: [1] ant fly fro lob her liz sal duc eag ele wha bee chi man cow lio rab cat cpl [20] spi Variable used: [1] gro fly ver end gro NULL war end fly NULL hai fly NULL ver NULL [16] NULL gro war NULL Separation step: [1] 4 3 5 4 5 0 2 4 3 0 1 4 0 3 0 0 2 3 0 Available components: [1] "data" "hasNA" "order" "variable" "step" "order.lab" [7] "call" seed = 13 Loop npass = 1: (ka,kb) = (1,20) for(j ..) -> jma=1, jtel(.,z) = (10, 10) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 10, 10, 11) --> nclu = 2, kwan[ka] = 10 L500; found kwan[1] = 10 >= 2 ==> Loop again Loop npass = 2: (ka,kb) = (1,10) for(j ..) -> jma=6, jtel(.,z) = (2, 8) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 8, 2, 9) --> nclu = 3, kwan[ka] = 2 Loop npass = 2: (ka,kb) = (11,20) for(j ..) -> jma=6, jtel(.,z) = (6, 4) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (0, 6, 4, 17) --> nclu = 4, kwan[ka] = 4 L500; found kwan[1] = 8 >= 2 ==> Loop again Loop npass = 3: (ka,kb) = (1,8) for(j ..) -> jma=2, jtel(.,z) = (2, 6) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 6, 2, 7) --> nclu = 5, kwan[ka] = 2 Loop npass = 3: (ka,kb) = (9,10) for(j ..) -> jma=2, jtel(.,z) = (2, 6) --> _NO_ splitting --> nclu = 5, kwan[ka] = -2 Loop npass = 3: (ka,kb) = (11,16) for(j ..) -> jma=5, jtel(.,z) = (5, 1) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 1, 5, 12) --> nclu = 6, kwan[ka] = 5 Loop npass = 3: (ka,kb) = (17,20) for(j ..) -> jma=2, jtel(.,z) = (2, 2) --> splitting: ka=17, ner[ka]=7 => (nzf, jtel2, jres, km) = (0, 2, 2, 19) --> nclu = 7, kwan[ka] = 2 L500; found kwan[1] = 6 >= 2 ==> Loop again Loop npass = 4: (ka,kb) = (1,6) for(j ..) -> jma=3, jtel(.,z) = (4, 2) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 2, 4, 3) --> nclu = 8, kwan[ka] = 4 Loop npass = 4: (ka,kb) = (7,8) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=7, ner[ka]=2 => (nzf, jtel2, jres, km) = (0, 1, 1, 8) --> nclu = 9, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (12,16) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 9, kwan[ka] = -5 Loop npass = 4: (ka,kb) = (17,18) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> splitting: ka=17, ner[ka]=7 => (nzf, jtel2, jres, km) = (1, 1, 1, 18) --> nclu = 10, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (19,20) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 10, kwan[ka] = -2 L500; found kwan[1] = 2 >= 2 ==> Loop again Loop npass = 5: (ka,kb) = (1,2) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 10, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (3,6) for(j ..) -> jma=5, jtel(.,z) = (3, 1) --> splitting: ka=3, ner[ka]=11 => (nzf, jtel2, jres, km) = (0, 3, 1, 6) --> nclu = 11, kwan[ka] = 1 L500; found kwan[3] = 3 >= 2 ==> Loop again Loop npass = 6: (ka,kb) = (3,5) for(j ..) -> jma=5, jtel(.,z) = (3, 1) --> _NO_ splitting --> nclu = 11, kwan[ka] = -3 mona(x, ..) fit; x of dimension 20x6 Because of NA's, revised data: war fly ver end gro hai ant 0 0 0 0 1 0 bee 0 1 0 0 1 0 cat 1 0 1 0 0 1 cpl 0 0 0 0 0 1 chi 1 0 1 0 1 1 cow 1 0 1 0 1 1 duc 1 1 1 0 1 0 eag 1 1 1 1 0 0 ele 1 0 1 1 1 0 fly 0 1 0 0 0 0 fro 0 0 1 0 1 0 her 0 0 1 0 1 0 lio 1 0 1 0 1 1 liz 0 0 1 0 0 0 lob 0 0 0 0 1 0 man 1 0 1 0 1 1 rab 1 0 1 0 1 1 sal 0 0 1 0 1 0 spi 0 0 0 0 0 1 wha 1 0 1 1 1 0 Order of objects: [1] ant lob fro her sal liz bee fly cpl spi cat chi cow lio man rab duc eag ele [20] wha Variable used: [1] NULL ver NULL NULL gro fly gro hai NULL war gro NULL NULL NULL NULL [16] hai end fly NULL Separation step: [1] 0 4 0 0 5 3 4 2 0 1 3 0 0 0 0 2 4 3 0 Available components: [1] "data" "hasNA" "order" "variable" "step" "order.lab" [7] "call" seed = 14 Loop npass = 1: (ka,kb) = (1,20) for(j ..) -> jma=1, jtel(.,z) = (10, 10) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 10, 10, 11) --> nclu = 2, kwan[ka] = 10 L500; found kwan[1] = 10 >= 2 ==> Loop again Loop npass = 2: (ka,kb) = (1,10) for(j ..) -> jma=3, jtel(.,z) = (4, 6) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 6, 4, 7) --> nclu = 3, kwan[ka] = 4 Loop npass = 2: (ka,kb) = (11,20) for(j ..) -> jma=2, jtel(.,z) = (2, 8) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 8, 2, 19) --> nclu = 4, kwan[ka] = 2 L500; found kwan[1] = 6 >= 2 ==> Loop again Loop npass = 3: (ka,kb) = (1,6) for(j ..) -> jma=4, jtel(.,z) = (1, 5) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 5, 1, 6) --> nclu = 5, kwan[ka] = 1 Loop npass = 3: (ka,kb) = (7,10) for(j ..) -> jma=4, jtel(.,z) = (1, 3) --> splitting: ka=7, ner[ka]=11 => (nzf, jtel2, jres, km) = (0, 1, 3, 8) --> nclu = 6, kwan[ka] = 3 Loop npass = 3: (ka,kb) = (11,18) for(j ..) -> jma=4, jtel(.,z) = (5, 3) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 3, 5, 14) --> nclu = 7, kwan[ka] = 5 Loop npass = 3: (ka,kb) = (19,20) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> splitting: ka=19, ner[ka]=7 => (nzf, jtel2, jres, km) = (1, 1, 1, 20) --> nclu = 8, kwan[ka] = 1 L500; found kwan[1] = 5 >= 2 ==> Loop again Loop npass = 4: (ka,kb) = (1,5) for(j ..) -> jma=2, jtel(.,z) = (2, 3) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 3, 2, 4) --> nclu = 9, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (8,10) for(j ..) -> jma=2, jtel(.,z) = (2, 3) --> _NO_ splitting --> nclu = 9, kwan[ka] = -3 Loop npass = 4: (ka,kb) = (11,13) for(j ..) -> jma=5, jtel(.,z) = (2, 1) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 1, 2, 12) --> nclu = 10, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (14,18) for(j ..) -> jma=6, jtel(.,z) = (3, 2) --> splitting: ka=14, ner[ka]=5 => (nzf, jtel2, jres, km) = (0, 3, 2, 17) --> nclu = 11, kwan[ka] = 2 L500; found kwan[1] = 3 >= 2 ==> Loop again Loop npass = 5: (ka,kb) = (1,3) for(j ..) -> jma=5, jtel(.,z) = (2, 1) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 2, 1, 3) --> nclu = 12, kwan[ka] = 1 Loop npass = 5: (ka,kb) = (4,5) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=4, ner[ka]=2 => (nzf, jtel2, jres, km) = (0, 1, 1, 5) --> nclu = 13, kwan[ka] = 1 Loop npass = 5: (ka,kb) = (12,13) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 13, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (14,16) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 13, kwan[ka] = -3 Loop npass = 5: (ka,kb) = (17,18) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 13, kwan[ka] = -2 L500; found kwan[1] = 2 >= 2 ==> Loop again Loop npass = 6: (ka,kb) = (1,2) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 13, kwan[ka] = -2 mona(x, ..) fit; x of dimension 20x6 Because of NA's, revised data: war fly ver end gro hai ant 0 0 0 0 1 0 bee 0 1 0 0 1 1 cat 1 0 1 0 0 1 cpl 0 0 0 0 0 1 chi 1 0 1 1 1 1 cow 1 0 1 0 1 1 duc 1 1 1 0 1 0 eag 1 1 1 1 0 0 ele 1 0 1 1 1 0 fly 0 1 0 0 0 0 fro 0 0 1 1 1 0 her 0 0 1 0 1 0 lio 1 0 1 1 1 1 liz 0 0 1 0 1 0 lob 0 0 0 0 1 0 man 1 0 1 1 1 1 rab 1 0 1 0 1 1 sal 0 0 1 0 1 0 spi 0 0 0 1 1 1 wha 1 0 1 1 1 0 Order of objects: [1] ant lob cpl bee fly spi fro her liz sal cat cow rab chi lio man ele wha duc [20] eag Variable used: [1] NULL gro fly gro end ver end NULL NULL war gro NULL end NULL NULL [16] hai NULL fly end Separation step: [1] 0 5 4 5 3 2 3 0 0 1 4 0 3 0 0 4 0 2 3 Available components: [1] "data" "hasNA" "order" "variable" "step" "order.lab" [7] "call" seed = 15 Loop npass = 1: (ka,kb) = (1,20) for(j ..) -> jma=1, jtel(.,z) = (10, 10) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 10, 10, 11) --> nclu = 2, kwan[ka] = 10 L500; found kwan[1] = 10 >= 2 ==> Loop again Loop npass = 2: (ka,kb) = (1,10) for(j ..) -> jma=3, jtel(.,z) = (5, 5) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 5, 5, 6) --> nclu = 3, kwan[ka] = 5 Loop npass = 2: (ka,kb) = (11,20) for(j ..) -> jma=2, jtel(.,z) = (2, 8) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 8, 2, 19) --> nclu = 4, kwan[ka] = 2 L500; found kwan[1] = 5 >= 2 ==> Loop again Loop npass = 3: (ka,kb) = (1,5) for(j ..) -> jma=2, jtel(.,z) = (2, 3) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 3, 2, 4) --> nclu = 5, kwan[ka] = 2 Loop npass = 3: (ka,kb) = (6,10) for(j ..) -> jma=4, jtel(.,z) = (4, 1) --> splitting: ka=6, ner[ka]=11 => (nzf, jtel2, jres, km) = (0, 4, 1, 10) --> nclu = 6, kwan[ka] = 1 Loop npass = 3: (ka,kb) = (11,18) for(j ..) -> jma=4, jtel(.,z) = (5, 3) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 3, 5, 14) --> nclu = 7, kwan[ka] = 5 Loop npass = 3: (ka,kb) = (19,20) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> splitting: ka=19, ner[ka]=7 => (nzf, jtel2, jres, km) = (1, 1, 1, 20) --> nclu = 8, kwan[ka] = 1 L500; found kwan[1] = 3 >= 2 ==> Loop again Loop npass = 4: (ka,kb) = (1,3) for(j ..) -> jma=5, jtel(.,z) = (1, 2) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 1, 2, 2) --> nclu = 9, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (4,5) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=4, ner[ka]=2 => (nzf, jtel2, jres, km) = (0, 1, 1, 5) --> nclu = 10, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (6,9) for(j ..) -> jma=5, jtel(.,z) = (1, 3) --> splitting: ka=6, ner[ka]=11 => (nzf, jtel2, jres, km) = (1, 3, 1, 9) --> nclu = 11, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (11,13) for(j ..) -> jma=5, jtel(.,z) = (1, 2) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 2, 1, 13) --> nclu = 12, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (14,18) for(j ..) -> jma=5, jtel(.,z) = (4, 1) --> splitting: ka=14, ner[ka]=5 => (nzf, jtel2, jres, km) = (0, 4, 1, 18) --> nclu = 13, kwan[ka] = 1 L500; found kwan[2] = 2 >= 2 ==> Loop again Loop npass = 5: (ka,kb) = (2,3) for(j ..) -> jma=5, jtel(.,z) = (4, 1) --> _NO_ splitting --> nclu = 13, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (6,8) for(j ..) -> jma=6, jtel(.,z) = (1, 2) --> splitting: ka=6, ner[ka]=11 => (nzf, jtel2, jres, km) = (1, 2, 1, 8) --> nclu = 14, kwan[ka] = 1 Loop npass = 5: (ka,kb) = (11,12) for(j ..) -> jma=6, jtel(.,z) = (1, 2) --> _NO_ splitting --> nclu = 14, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (14,17) for(j ..) -> jma=6, jtel(.,z) = (3, 1) --> splitting: ka=14, ner[ka]=5 => (nzf, jtel2, jres, km) = (0, 3, 1, 17) --> nclu = 15, kwan[ka] = 1 L500; found kwan[6] = 2 >= 2 ==> Loop again Loop npass = 6: (ka,kb) = (6,7) for(j ..) -> jma=6, jtel(.,z) = (3, 1) --> _NO_ splitting --> nclu = 15, kwan[ka] = -2 Loop npass = 6: (ka,kb) = (14,16) for(j ..) -> jma=6, jtel(.,z) = (3, 1) --> _NO_ splitting --> nclu = 15, kwan[ka] = -3 mona(x, ..) fit; x of dimension 20x6 Because of NA's, revised data: war fly ver end gro hai ant 0 0 0 0 1 0 bee 0 1 0 0 1 1 cat 1 0 1 0 0 1 cpl 0 0 0 0 0 1 chi 1 0 1 1 1 1 cow 1 0 1 0 0 1 duc 1 1 1 0 1 0 eag 1 1 1 1 0 0 ele 1 0 1 1 1 1 fly 0 1 0 0 0 0 fro 0 0 1 1 0 0 her 0 0 1 1 1 0 lio 1 0 1 1 0 1 liz 0 0 1 0 0 0 lob 0 0 0 0 0 1 man 1 0 1 1 1 1 rab 1 0 1 0 1 1 sal 0 0 1 1 0 0 spi 0 0 1 1 0 1 wha 1 0 1 1 1 0 Order of objects: [1] ant cpl lob bee fly fro sal spi her liz cat cow rab chi ele man wha lio duc [20] eag Variable used: [1] gro NULL fly gro ver NULL hai gro end war NULL gro end NULL NULL [16] hai gro fly end Separation step: [1] 4 0 3 4 2 0 5 4 3 1 0 4 3 0 0 5 4 2 3 Available components: [1] "data" "hasNA" "order" "variable" "step" "order.lab" [7] "call" seed = 16 Loop npass = 1: (ka,kb) = (1,20) for(j ..) -> jma=3, jtel(.,z) = (14, 6) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 6, 14, 7) --> nclu = 2, kwan[ka] = 14 L500; found kwan[1] = 6 >= 2 ==> Loop again Loop npass = 2: (ka,kb) = (1,6) for(j ..) -> jma=2, jtel(.,z) = (2, 4) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 4, 2, 5) --> nclu = 3, kwan[ka] = 2 Loop npass = 2: (ka,kb) = (7,20) for(j ..) -> jma=1, jtel(.,z) = (11, 3) --> splitting: ka=7, ner[ka]=3 => (nzf, jtel2, jres, km) = (0, 11, 3, 18) --> nclu = 4, kwan[ka] = 3 L500; found kwan[1] = 4 >= 2 ==> Loop again Loop npass = 3: (ka,kb) = (1,4) for(j ..) -> jma=5, jtel(.,z) = (1, 3) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 1, 3, 2) --> nclu = 5, kwan[ka] = 3 Loop npass = 3: (ka,kb) = (5,6) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=5, ner[ka]=2 => (nzf, jtel2, jres, km) = (0, 1, 1, 6) --> nclu = 6, kwan[ka] = 1 Loop npass = 3: (ka,kb) = (7,17) for(j ..) -> jma=6, jtel(.,z) = (6, 5) --> splitting: ka=7, ner[ka]=3 => (nzf, jtel2, jres, km) = (0, 6, 5, 13) --> nclu = 7, kwan[ka] = 5 Loop npass = 3: (ka,kb) = (18,20) for(j ..) -> jma=4, jtel(.,z) = (1, 2) --> splitting: ka=18, ner[ka]=11 => (nzf, jtel2, jres, km) = (0, 1, 2, 19) --> nclu = 8, kwan[ka] = 2 L500; found kwan[2] = 3 >= 2 ==> Loop again Loop npass = 4: (ka,kb) = (2,4) for(j ..) -> jma=6, jtel(.,z) = (2, 1) --> splitting: ka=2, ner[ka]=4 => (nzf, jtel2, jres, km) = (0, 2, 1, 4) --> nclu = 9, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (7,12) for(j ..) -> jma=4, jtel(.,z) = (3, 3) --> splitting: ka=7, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 3, 3, 10) --> nclu = 10, kwan[ka] = 3 Loop npass = 4: (ka,kb) = (13,17) for(j ..) -> jma=2, jtel(.,z) = (2, 3) --> splitting: ka=13, ner[ka]=7 => (nzf, jtel2, jres, km) = (0, 2, 3, 15) --> nclu = 11, kwan[ka] = 3 Loop npass = 4: (ka,kb) = (19,20) for(j ..) -> jma=2, jtel(.,z) = (2, 3) --> _NO_ splitting --> nclu = 11, kwan[ka] = -2 L500; found kwan[2] = 2 >= 2 ==> Loop again Loop npass = 5: (ka,kb) = (2,3) for(j ..) -> jma=2, jtel(.,z) = (2, 3) --> _NO_ splitting --> nclu = 11, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (7,9) for(j ..) -> jma=5, jtel(.,z) = (2, 1) --> splitting: ka=7, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 1, 2, 8) --> nclu = 12, kwan[ka] = 2 Loop npass = 5: (ka,kb) = (10,12) for(j ..) -> jma=5, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 12, kwan[ka] = -3 Loop npass = 5: (ka,kb) = (13,14) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> splitting: ka=13, ner[ka]=7 => (nzf, jtel2, jres, km) = (1, 1, 1, 14) --> nclu = 13, kwan[ka] = 1 Loop npass = 5: (ka,kb) = (15,17) for(j ..) -> jma=4, jtel(.,z) = (2, 1) --> splitting: ka=15, ner[ka]=9 => (nzf, jtel2, jres, km) = (0, 2, 1, 17) --> nclu = 14, kwan[ka] = 1 L500; found kwan[8] = 2 >= 2 ==> Loop again Loop npass = 6: (ka,kb) = (8,9) for(j ..) -> jma=4, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 14, kwan[ka] = -2 Loop npass = 6: (ka,kb) = (15,16) for(j ..) -> jma=4, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 14, kwan[ka] = -2 mona(x, ..) fit; x of dimension 20x6 Because of NA's, revised data: war fly ver end gro hai ant 0 0 0 0 1 0 bee 0 1 0 0 1 1 cat 1 0 1 0 0 1 cpl 0 0 0 0 0 1 chi 1 0 1 1 1 1 cow 1 0 1 0 1 1 duc 1 1 1 0 1 0 eag 1 1 1 1 0 0 ele 1 0 1 1 1 0 fly 0 1 0 0 0 0 fro 0 0 1 1 1 0 her 0 0 1 0 1 0 lio 1 0 1 1 1 1 liz 1 0 1 0 0 0 lob 0 0 0 0 0 0 man 1 0 1 1 1 1 rab 1 0 1 0 1 1 sal 0 0 1 0 1 0 spi 0 0 0 0 0 1 wha 1 0 1 1 1 0 Order of objects: [1] ant cpl spi lob bee fly cat cow rab chi lio man duc eag ele wha liz fro her [20] sal Variable used: [1] gro NULL hai fly gro ver gro NULL end NULL NULL hai end fly NULL [16] end war end NULL Separation step: [1] 3 0 4 2 3 1 5 0 4 0 0 3 5 4 0 5 2 3 0 Available components: [1] "data" "hasNA" "order" "variable" "step" "order.lab" [7] "call" seed = 17 Error in mona(ani.N2, trace = TRUE) : No clustering performed, all variables have at least one missing value. seed = 18 Loop npass = 1: (ka,kb) = (1,20) for(j ..) -> jma=3, jtel(.,z) = (14, 6) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 6, 14, 7) --> nclu = 2, kwan[ka] = 14 L500; found kwan[1] = 6 >= 2 ==> Loop again Loop npass = 2: (ka,kb) = (1,6) for(j ..) -> jma=2, jtel(.,z) = (3, 3) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 3, 3, 4) --> nclu = 3, kwan[ka] = 3 Loop npass = 2: (ka,kb) = (7,20) for(j ..) -> jma=6, jtel(.,z) = (6, 8) --> splitting: ka=7, ner[ka]=3 => (nzf, jtel2, jres, km) = (0, 6, 8, 13) --> nclu = 4, kwan[ka] = 8 L500; found kwan[1] = 3 >= 2 ==> Loop again Loop npass = 3: (ka,kb) = (1,3) for(j ..) -> jma=5, jtel(.,z) = (2, 1) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 2, 1, 3) --> nclu = 5, kwan[ka] = 1 Loop npass = 3: (ka,kb) = (4,6) for(j ..) -> jma=6, jtel(.,z) = (2, 1) --> splitting: ka=4, ner[ka]=4 => (nzf, jtel2, jres, km) = (0, 2, 1, 6) --> nclu = 6, kwan[ka] = 1 Loop npass = 3: (ka,kb) = (7,12) for(j ..) -> jma=4, jtel(.,z) = (3, 3) --> splitting: ka=7, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 3, 3, 10) --> nclu = 7, kwan[ka] = 3 Loop npass = 3: (ka,kb) = (13,20) for(j ..) -> jma=1, jtel(.,z) = (4, 4) --> splitting: ka=13, ner[ka]=7 => (nzf, jtel2, jres, km) = (0, 4, 4, 17) --> nclu = 8, kwan[ka] = 4 L500; found kwan[1] = 2 >= 2 ==> Loop again Loop npass = 4: (ka,kb) = (1,2) for(j ..) -> jma=6, jtel(.,z) = (1, 1) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 1, 1, 2) --> nclu = 9, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (4,5) for(j ..) -> jma=6, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 9, kwan[ka] = -2 Loop npass = 4: (ka,kb) = (7,9) for(j ..) -> jma=5, jtel(.,z) = (2, 1) --> splitting: ka=7, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 1, 2, 8) --> nclu = 10, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (10,12) for(j ..) -> jma=5, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 10, kwan[ka] = -3 Loop npass = 4: (ka,kb) = (13,16) for(j ..) -> jma=2, jtel(.,z) = (2, 2) --> splitting: ka=13, ner[ka]=7 => (nzf, jtel2, jres, km) = (0, 2, 2, 15) --> nclu = 11, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (17,20) for(j ..) -> jma=4, jtel(.,z) = (2, 2) --> splitting: ka=17, ner[ka]=11 => (nzf, jtel2, jres, km) = (0, 2, 2, 19) --> nclu = 12, kwan[ka] = 2 L500; found kwan[8] = 2 >= 2 ==> Loop again Loop npass = 5: (ka,kb) = (8,9) for(j ..) -> jma=4, jtel(.,z) = (2, 2) --> _NO_ splitting --> nclu = 12, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (13,14) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=13, ner[ka]=7 => (nzf, jtel2, jres, km) = (0, 1, 1, 14) --> nclu = 13, kwan[ka] = 1 Loop npass = 5: (ka,kb) = (15,16) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 13, kwan[ka] = -2 Loop npass = 5: (ka,kb) = (17,18) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=17, ner[ka]=11 => (nzf, jtel2, jres, km) = (0, 1, 1, 18) --> nclu = 14, kwan[ka] = 1 Loop npass = 5: (ka,kb) = (19,20) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 14, kwan[ka] = -2 mona(x, ..) fit; x of dimension 20x6 Because of NA's, revised data: war fly ver end gro hai ant 0 1 0 0 1 0 bee 0 1 0 0 1 1 cat 1 0 1 0 0 1 cpl 0 0 0 0 0 1 chi 1 0 1 1 1 1 cow 1 0 1 0 1 1 duc 1 1 1 1 1 0 eag 1 1 1 1 0 0 ele 1 0 1 1 1 0 fly 0 1 0 0 0 0 fro 0 0 1 1 1 0 her 0 0 1 0 1 0 lio 1 0 1 1 1 1 liz 0 0 1 1 0 0 lob 0 0 0 0 0 0 man 1 0 1 1 1 1 rab 1 0 1 0 1 1 sal 0 0 1 0 1 0 spi 0 0 0 0 0 1 wha 1 0 1 1 1 0 Order of objects: [1] ant bee fly cpl spi lob cat cow rab chi lio man duc eag ele wha fro liz her [20] sal Variable used: [1] hai gro fly NULL hai ver gro NULL end NULL NULL hai gro fly NULL [16] war gro end NULL Separation step: [1] 4 3 2 0 3 1 4 0 3 0 0 2 5 4 0 3 5 4 0 Available components: [1] "data" "hasNA" "order" "variable" "step" "order.lab" [7] "call" seed = 19 Loop npass = 1: (ka,kb) = (1,20) for(j ..) -> jma=1, jtel(.,z) = (10, 10) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 10, 10, 11) --> nclu = 2, kwan[ka] = 10 L500; found kwan[1] = 10 >= 2 ==> Loop again Loop npass = 2: (ka,kb) = (1,10) for(j ..) -> jma=3, jtel(.,z) = (3, 7) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 7, 3, 8) --> nclu = 3, kwan[ka] = 3 Loop npass = 2: (ka,kb) = (11,20) for(j ..) -> jma=6, jtel(.,z) = (6, 4) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (0, 6, 4, 17) --> nclu = 4, kwan[ka] = 4 L500; found kwan[1] = 7 >= 2 ==> Loop again Loop npass = 3: (ka,kb) = (1,7) for(j ..) -> jma=5, jtel(.,z) = (2, 5) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 2, 5, 3) --> nclu = 5, kwan[ka] = 5 Loop npass = 3: (ka,kb) = (8,10) for(j ..) -> jma=5, jtel(.,z) = (2, 5) --> _NO_ splitting --> nclu = 5, kwan[ka] = -3 Loop npass = 3: (ka,kb) = (11,16) for(j ..) -> jma=4, jtel(.,z) = (3, 3) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 3, 3, 14) --> nclu = 6, kwan[ka] = 3 Loop npass = 3: (ka,kb) = (17,20) for(j ..) -> jma=2, jtel(.,z) = (2, 2) --> splitting: ka=17, ner[ka]=7 => (nzf, jtel2, jres, km) = (0, 2, 2, 19) --> nclu = 7, kwan[ka] = 2 L500; found kwan[1] = 2 >= 2 ==> Loop again Loop npass = 4: (ka,kb) = (1,2) for(j ..) -> jma=2, jtel(.,z) = (2, 2) --> _NO_ splitting --> nclu = 7, kwan[ka] = -2 Loop npass = 4: (ka,kb) = (3,7) for(j ..) -> jma=2, jtel(.,z) = (2, 3) --> splitting: ka=3, ner[ka]=2 => (nzf, jtel2, jres, km) = (0, 2, 3, 5) --> nclu = 8, kwan[ka] = 3 Loop npass = 4: (ka,kb) = (11,13) for(j ..) -> jma=2, jtel(.,z) = (2, 3) --> _NO_ splitting --> nclu = 8, kwan[ka] = -3 Loop npass = 4: (ka,kb) = (14,16) for(j ..) -> jma=2, jtel(.,z) = (2, 3) --> _NO_ splitting --> nclu = 8, kwan[ka] = -3 Loop npass = 4: (ka,kb) = (17,18) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> splitting: ka=17, ner[ka]=7 => (nzf, jtel2, jres, km) = (1, 1, 1, 18) --> nclu = 9, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (19,20) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 9, kwan[ka] = -2 L500; found kwan[3] = 2 >= 2 ==> Loop again Loop npass = 5: (ka,kb) = (3,4) for(j ..) -> jma=6, jtel(.,z) = (1, 1) --> splitting: ka=3, ner[ka]=2 => (nzf, jtel2, jres, km) = (0, 1, 1, 4) --> nclu = 10, kwan[ka] = 1 Loop npass = 5: (ka,kb) = (5,7) for(j ..) -> jma=6, jtel(.,z) = (2, 1) --> splitting: ka=5, ner[ka]=4 => (nzf, jtel2, jres, km) = (0, 2, 1, 7) --> nclu = 11, kwan[ka] = 1 L500; found kwan[5] = 2 >= 2 ==> Loop again Loop npass = 6: (ka,kb) = (5,6) for(j ..) -> jma=6, jtel(.,z) = (2, 1) --> _NO_ splitting --> nclu = 11, kwan[ka] = -2 mona(x, ..) fit; x of dimension 20x6 Because of NA's, revised data: war fly ver end gro hai ant 0 0 0 0 1 0 bee 0 1 0 0 0 1 cat 1 0 1 0 1 1 cpl 0 0 0 0 0 1 chi 1 0 1 1 1 1 cow 1 0 1 0 1 1 duc 1 1 1 0 1 0 eag 1 1 1 1 0 0 ele 1 0 1 1 1 0 fly 0 1 0 0 0 0 fro 0 0 1 0 0 0 her 0 0 0 0 1 0 lio 1 0 1 1 1 1 liz 0 0 1 0 0 0 lob 0 0 0 0 0 0 man 1 0 1 1 1 1 rab 1 0 1 0 1 1 sal 0 0 1 0 0 0 spi 0 0 0 0 0 1 wha 1 0 1 1 1 0 Order of objects: [1] ant her bee fly cpl spi lob fro liz sal cat cow rab chi lio man duc eag ele [20] wha Variable used: [1] NULL gro hai fly NULL hai ver NULL NULL war NULL NULL end NULL NULL [16] hai end fly NULL Separation step: [1] 0 3 5 4 0 5 2 0 0 1 0 0 3 0 0 2 4 3 0 Available components: [1] "data" "hasNA" "order" "variable" "step" "order.lab" [7] "call" seed = 20 Loop npass = 1: (ka,kb) = (1,20) for(j ..) -> jma=1, jtel(.,z) = (10, 10) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 10, 10, 11) --> nclu = 2, kwan[ka] = 10 L500; found kwan[1] = 10 >= 2 ==> Loop again Loop npass = 2: (ka,kb) = (1,10) for(j ..) -> jma=4, jtel(.,z) = (2, 8) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 8, 2, 9) --> nclu = 3, kwan[ka] = 2 Loop npass = 2: (ka,kb) = (11,20) for(j ..) -> jma=6, jtel(.,z) = (7, 3) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (0, 7, 3, 18) --> nclu = 4, kwan[ka] = 3 L500; found kwan[1] = 8 >= 2 ==> Loop again Loop npass = 3: (ka,kb) = (1,8) for(j ..) -> jma=6, jtel(.,z) = (2, 6) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (1, 6, 2, 7) --> nclu = 5, kwan[ka] = 2 Loop npass = 3: (ka,kb) = (9,10) for(j ..) -> jma=6, jtel(.,z) = (2, 6) --> _NO_ splitting --> nclu = 5, kwan[ka] = -2 Loop npass = 3: (ka,kb) = (11,17) for(j ..) -> jma=3, jtel(.,z) = (6, 1) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (0, 6, 1, 17) --> nclu = 6, kwan[ka] = 1 Loop npass = 3: (ka,kb) = (18,20) for(j ..) -> jma=2, jtel(.,z) = (2, 1) --> splitting: ka=18, ner[ka]=7 => (nzf, jtel2, jres, km) = (0, 2, 1, 20) --> nclu = 7, kwan[ka] = 1 L500; found kwan[1] = 6 >= 2 ==> Loop again Loop npass = 4: (ka,kb) = (1,6) for(j ..) -> jma=2, jtel(.,z) = (2, 4) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 2, 4, 3) --> nclu = 8, kwan[ka] = 4 Loop npass = 4: (ka,kb) = (7,8) for(j ..) -> jma=2, jtel(.,z) = (1, 1) --> splitting: ka=7, ner[ka]=2 => (nzf, jtel2, jres, km) = (0, 1, 1, 8) --> nclu = 9, kwan[ka] = 1 Loop npass = 4: (ka,kb) = (11,16) for(j ..) -> jma=4, jtel(.,z) = (2, 4) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 4, 2, 15) --> nclu = 10, kwan[ka] = 2 Loop npass = 4: (ka,kb) = (18,19) for(j ..) -> jma=4, jtel(.,z) = (1, 1) --> splitting: ka=18, ner[ka]=7 => (nzf, jtel2, jres, km) = (1, 1, 1, 19) --> nclu = 11, kwan[ka] = 1 L500; found kwan[1] = 2 >= 2 ==> Loop again Loop npass = 5: (ka,kb) = (1,2) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=1, ner[ka]=1 => (nzf, jtel2, jres, km) = (0, 1, 1, 2) --> nclu = 12, kwan[ka] = 1 Loop npass = 5: (ka,kb) = (3,6) for(j ..) -> jma=3, jtel(.,z) = (2, 2) --> splitting: ka=3, ner[ka]=12 => (nzf, jtel2, jres, km) = (0, 2, 2, 5) --> nclu = 13, kwan[ka] = 2 Loop npass = 5: (ka,kb) = (11,14) for(j ..) -> jma=5, jtel(.,z) = (2, 2) --> splitting: ka=11, ner[ka]=3 => (nzf, jtel2, jres, km) = (1, 2, 2, 13) --> nclu = 14, kwan[ka] = 2 Loop npass = 5: (ka,kb) = (15,16) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=15, ner[ka]=5 => (nzf, jtel2, jres, km) = (0, 1, 1, 16) --> nclu = 15, kwan[ka] = 1 L500; found kwan[3] = 2 >= 2 ==> Loop again Loop npass = 6: (ka,kb) = (3,4) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> splitting: ka=3, ner[ka]=12 => (nzf, jtel2, jres, km) = (0, 1, 1, 4) --> nclu = 16, kwan[ka] = 1 Loop npass = 6: (ka,kb) = (5,6) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 16, kwan[ka] = -2 Loop npass = 6: (ka,kb) = (11,12) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 16, kwan[ka] = -2 Loop npass = 6: (ka,kb) = (13,14) for(j ..) -> jma=5, jtel(.,z) = (1, 1) --> _NO_ splitting --> nclu = 16, kwan[ka] = -2 mona(x, ..) fit; x of dimension 20x6 Because of NA's, revised data: war fly ver end gro hai ant 0 1 0 0 1 0 bee 0 1 1 0 1 1 cat 1 0 1 0 0 1 cpl 1 0 0 0 0 1 chi 1 0 1 1 1 1 cow 1 0 1 0 0 1 duc 1 1 1 0 1 0 eag 1 1 1 1 0 0 ele 0 0 1 1 1 0 fly 0 1 0 0 0 0 fro 0 0 1 1 1 0 her 0 0 1 0 1 0 lio 1 0 1 0 1 1 liz 0 0 1 0 0 0 lob 0 0 0 0 1 0 man 1 0 1 1 0 1 rab 1 0 1 0 1 1 sal 0 0 0 0 1 0 spi 0 0 0 0 0 1 wha 1 0 1 1 1 0 Order of objects: [1] ant fly her liz lob sal bee spi ele fro cat cow lio rab chi man cpl duc eag [20] wha Variable used: [1] gro fly gro ver NULL hai fly end NULL war NULL gro NULL end gro [16] ver hai end fly Separation step: [1] 5 4 6 5 0 3 4 2 0 1 0 5 0 4 5 3 2 4 3 Available components: [1] "data" "hasNA" "order" "variable" "step" "order.lab" [7] "call" > > ## Check all "too many NA" and other illegal cases > ani.NA <- animals; ani.NA[4,] <- NA > aniNA <- within(animals, { end[2:9] <- NA }) > aniN2 <- animals; aniN2[cbind(1:6, c(3, 1, 4:6, 2))] <- NA > ani.non2 <- within(animals, end[7] <- 3 ) > ani.idNA <- within(animals, end[!is.na(end)] <- 1 ) > ## use tools::assertError() {once you don't use *.Rout.save anymore} > try( mona(ani.NA) ) Error in mona(ani.NA) : No clustering performed, an object was found with all values missing. > try( mona(aniNA) ) Error in mona(aniNA) : No clustering performed, found variable with more than half values missing. > try( mona(aniN2) ) Error in mona(aniN2) : No clustering performed, all variables have at least one missing value. > try( mona(ani.non2) ) Error in mona(ani.non2) : All variables must be binary (e.g., a factor with 2 levels, both present). > try( mona(ani.idNA) ) Error in mona(ani.idNA) : All variables must be binary (e.g., a factor with 2 levels, both present). > > if(require(MASS, lib.loc=.Library)) withAutoprint({ + set.seed(253) + n <- 512; p <- 3 + Sig <- diag(p); Sig[] <- 0.8 ^ abs(col(Sig) - row(Sig)) + x3 <- mvrnorm(n, rep(0,p), Sig) >= 0 + x <- cbind(x3, rbinom(n, size=1, prob = 1/2)) + + sapply(as.data.frame(x), table) + + mx <- mona(x) + str(mx) + lapply(mx[c(1,3,4)], table) + mx # (too much, but still) + }) Loading required package: MASS > set.seed(253) > n <- 512 > p <- 3 > Sig <- diag(p) > Sig[] <- 0.8^abs(col(Sig) - row(Sig)) > x3 <- mvrnorm(n, rep(0, p), Sig) >= 0 > x <- cbind(x3, rbinom(n, size = 1, prob = 1/2)) > sapply(as.data.frame(x), table) V1 V2 V3 V4 0 250 252 256 280 1 262 260 256 232 > mx <- mona(x) > str(mx) List of 7 $ data : int [1:512, 1:4] 0 0 1 1 0 0 0 1 1 1 ... $ hasNA : logi FALSE $ order : int [1:512] 1 5 7 11 15 25 34 35 41 42 ... $ variable : int [1:511] 0 0 0 0 0 0 0 0 0 0 ... $ step : int [1:511] 0 0 0 0 0 0 0 0 0 0 ... $ order.lab: NULL $ call : language mona(x = x) - attr(*, "class")= chr "mona" > lapply(mx[c(1, 3, 4)], table) $data 0 1 1038 1010 $order 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 501 502 503 504 505 506 507 508 509 510 511 512 1 1 1 1 1 1 1 1 1 1 1 1 $variable 0 1 2 3 4 496 2 1 4 8 > mx mona(x, ..) fit; x of dimension 512x4 Order of objects: [1] 1 5 7 11 15 25 34 35 41 42 55 58 60 66 94 111 123 141 [19] 142 152 157 161 162 163 167 172 174 178 190 194 199 200 204 205 206 218 [37] 222 231 236 239 242 243 246 249 264 267 275 276 284 289 291 297 303 305 [55] 308 316 326 333 335 336 343 356 369 370 381 386 387 400 405 406 414 433 [73] 434 438 446 447 453 462 498 20 23 28 30 31 40 70 71 73 78 79 [91] 80 91 97 99 109 114 121 122 124 125 130 136 146 149 153 168 171 175 [109] 184 185 196 198 208 210 216 224 227 254 258 269 271 273 274 290 293 294 [127] 299 310 313 319 332 339 354 358 360 367 372 376 384 392 394 398 399 402 [145] 412 418 419 428 429 431 436 440 444 445 449 451 455 459 460 469 472 483 [163] 488 493 500 506 13 64 104 189 212 257 278 334 341 365 389 396 411 448 [181] 471 487 503 27 92 102 127 202 237 255 265 286 296 342 416 495 509 10 [199] 54 139 177 306 380 391 426 474 16 22 138 188 195 234 256 272 328 423 [217] 18 19 29 67 72 129 135 183 266 374 379 477 482 504 44 49 159 173 [235] 193 226 241 321 345 362 375 397 430 456 484 486 490 491 492 496 507 510 [253] 2 38 48 56 74 110 151 164 187 201 215 270 283 309 318 323 348 350 [271] 352 363 437 450 466 478 480 505 6 95 100 116 233 261 277 279 288 378 [289] 508 21 53 61 87 112 211 371 457 101 126 145 228 244 304 395 424 3 [307] 17 26 32 46 52 62 63 65 75 76 81 85 86 88 89 98 108 117 [325] 128 131 134 140 144 154 156 158 166 170 180 191 192 197 209 214 217 220 [343] 221 225 229 232 240 247 251 259 263 268 287 301 311 314 317 322 325 331 [361] 337 344 346 349 357 364 366 368 373 388 390 403 404 417 420 421 425 427 [379] 435 441 442 443 464 465 467 468 470 481 485 489 494 502 511 512 14 24 [397] 33 36 37 39 45 50 51 57 59 68 69 83 93 96 103 105 113 115 [415] 118 120 132 133 137 148 150 155 165 169 176 179 182 203 207 223 230 235 [433] 238 245 248 252 260 262 281 282 292 295 298 300 307 315 320 324 329 330 [451] 340 351 353 361 377 382 383 385 408 409 410 413 415 422 439 452 454 461 [469] 463 473 475 497 499 501 4 8 9 12 43 47 82 107 143 181 186 280 [487] 327 338 347 355 407 432 458 476 479 77 84 90 106 119 147 160 213 219 [505] 250 253 285 302 312 359 393 401 Variable used: [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [38] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [75] 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [112] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [149] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 [186] 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 [223] 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 [260] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 [297] 4 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [334] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [371] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 [408] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [445] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 [482] 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Separation step: [1] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [38] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [75] 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [112] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [149] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 [186] 0 0 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 [223] 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 [260] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 [297] 4 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [334] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [371] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 [408] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 [445] 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 [482] 0 0 0 0 0 0 0 0 0 0 0 0 0 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Available components: [1] "data" "hasNA" "order" "variable" "step" "order.lab" [7] "call" > > > try( + mona(cbind(1:0), trace=2) + ) -> et ## error: need p >= 2 Error in mona(cbind(1:0), trace = 2) : mona() needs at least p >= 2 variables (in current implementation) > stopifnot(inherits(et, "try-error"), + grepl("needs at least p >= 2", et)) > ## in the past, gave > ## Loop npass = 1: (ka,kb) = (1,2) > ## for(j ..) -> jma=1, jtel(.,z) = (17952088, 8) --> splitting: (nel; jres, ka, km) = (1; -17952086, 1, 17952089) > ## inner loop: for(k in ka:km) use ner[k]: 1 2 2 2 2 2 2 2 2 2 ..... [infinite loop] > > proc.time() user system elapsed 0.294 0.053 0.348 cluster/tests/clara-ex.R0000644000176200001440000000322513257174710014725 0ustar liggesusers#### These are *NOT* compared with output in the released version of ### 'cluster' currently library(cluster) source(system.file("test-tools.R", package = "cluster"), keep.source = FALSE) ## -> showProc.time() ... & doExtras data(xclara) ## Try 100 times *different* random samples -- for reliability: nSim <- 100 nCl <- 3 # = no.classes showProc.time() ## unknown problem: this is still platform dependent to some extent: set.seed(107)# << reproducibility; somewhat favorable with "small iDoubt" cl <- replicate(nSim, clara(xclara, nCl, rngR = TRUE)$cluster) tcl <- apply(cl,1, tabulate, nbins = nCl) showProc.time() ## those that are not always in same cluster (5 out of 3000 for this seed): (iDoubt <- which(apply(tcl,2, function(n) all(n < nSim)))) if(doExtras) { if(getRversion() < "3.2.1") lengths <- function (x, use.names = TRUE) vapply(x, length, 1L, USE.NAMES = use.names) rrr <- lapply(1:128, function(iseed) { set.seed(iseed) cat(iseed, if(iseed %% 10 == 0) "\n" else "") cl <- replicate(nSim, clara(xclara, nCl, rngR = TRUE)$cluster) tcl <- apply(cl,1, tabulate, nbins = nCl) which(apply(tcl,2, function(n) all(n < nSim))) }); cat("\n") showProc.time() cat("Number of cases which \"changed\" clusters:\n") print(lengths(rrr)) ## compare with "true" -- are the "changers" only those with small sil.width? ## __TODO!__ showSys.time(px <- pam(xclara,3))# 1.84 on lynne(2013) } ## doExtras if(length(iDoubt)) { # (not for all seeds) tabD <- tcl[,iDoubt, drop=FALSE] dimnames(tabD) <- list(cluster = paste(1:nCl), obs = format(iDoubt)) print( t(tabD) ) # how many times in which clusters } cluster/tests/clara.R0000644000176200001440000000655713450632521014320 0ustar liggesuserslibrary(cluster) ## generate 1500 objects, divided into 2 clusters. suppressWarnings(RNGversion("3.5.0")) # << as long as we don't have R >= 3.6.0 set.seed(144) x <- rbind(cbind(rnorm(700, 0,8), rnorm(700, 0,8)), cbind(rnorm(800,50,8), rnorm(800,10,8))) isEq <- function(x,y, epsF = 100) is.logical(r <- all.equal(x,y, tol = epsF * .Machine$double.eps)) && r .proctime00 <- proc.time() ## full size sample {should be = pam()}: n0 <- length(iSml <- c(1:70, 701:720)) summary(clara0 <- clara(x[iSml,], k = 2, sampsize = n0)) pam0 <- pam (x[iSml,], k = 2) stopifnot(identical(clara0$clustering, pam0$clustering) , isEq(clara0$objective, unname(pam0$objective[2])) ) summary(clara2 <- clara(x, 2)) clInd <- c("objective", "i.med", "medoids", "clusinfo") clInS <- c(clInd, "sample") ## clara() {as original code} always draws the *same* random samples !!!! clara(x, 2, samples = 50)[clInd] for(i in 1:20) print(clara(x[sample(nrow(x)),], 2, samples = 50)[clInd]) clara(x, 2, samples = 101)[clInd] clara(x, 2, samples = 149)[clInd] clara(x, 2, samples = 200)[clInd] ## Note that this last one is practically identical to the slower pam() one (ii <- sample(length(x), 20)) ## This was bogous (and lead to seg.faults); now properly gives error. ## but for these, now see ./clara-NAs.R if(FALSE) { ## ~~~~~~~~~~~~~ x[ii] <- NA try( clara(x, 2, samples = 50) ) } ###-- Larger example: 2000 objects, divided into 5 clusters. x5 <- rbind(cbind(rnorm(400, 0,4), rnorm(400, 0,4)), cbind(rnorm(400,10,8), rnorm(400,40,6)), cbind(rnorm(400,30,4), rnorm(400, 0,4)), cbind(rnorm(400,40,4), rnorm(400,20,2)), cbind(rnorm(400,50,4), rnorm(400,50,4))) ## plus 1 random dimension x5 <- cbind(x5, rnorm(nrow(x5))) clara(x5, 5) summary(clara(x5, 5, samples = 50)) ## 3 "half" samples: clara(x5, 5, samples = 999) clara(x5, 5, samples = 1000) clara(x5, 5, samples = 1001) clara(x5, 5, samples = 2000)#full sample ###--- Start a version of example(clara) ------- ## xclara : artificial data with 3 clusters of 1000 bivariate objects each. data(xclara) (clx3 <- clara(xclara, 3)) ## Plot similar to Figure 5 in Struyf et al (1996) plot(clx3) ## The rngR = TRUE case is currently in the non-strict tests ## ./clara-ex.R ## ~~~~~~~~~~~~ ###--- End version of example(clara) ------- ## small example(s): data(ruspini) clara(ruspini,4) rus <- data.matrix(ruspini); storage.mode(rus) <- "double" ru2 <- rus[c(1:7,21:28, 45:51, 61:69),] ru3 <- rus[c(1:4,21:25, 45:48, 61:63),] ru4 <- rus[c(1:2,21:22, 45:47),] ru5 <- rus[c(1:2,21, 45),] daisy(ru5, "manhattan") ## Dissimilarities : 11 118 143 107 132 89 ## no problem anymore, since 2002-12-28: ## sampsize >= k+1 is now enforced: ## clara(ru5, k=3, met="manhattan", sampsize=3,trace=2)[clInS] clara(ru5, k=3, met="manhattan", sampsize=4,trace=1)[clInS] daisy(ru4, "manhattan") ## this one (k=3) gave problems, from ss = 6 on ___ still after 2002-12-28 ___ : for(ss in 4:nrow(ru4)){ cat("---\n\nsample size = ",ss,"\n") print(clara(ru4,k=3,met="manhattan",sampsize=ss)[clInS]) } for(ss in 5:nrow(ru3)){ cat("---\n\nsample size = ",ss,"\n") print(clara(ru3,k=4,met="manhattan",sampsize=ss)[clInS]) } ## Last Line: cat('Time elapsed: ', proc.time() - .proctime00,'\n') ## Lynne (P IV, 1.6 GHz): 18.81; then (no NA; R 1.9.0-alpha): 15.07 ## nb-mm (P III,700 MHz): 27.97 cluster/tests/sweep-ex.R0000644000176200001440000000411011646600064014754 0ustar liggesusers#### NOT part of the cluster package! #### Find out what exactly sweep() in ../src/spannel.f is doing #### in order to eventually replace it with BLAS calls ! ### subroutine sweep (cov,nord,ixlo,nel,deter) ### =============================== ### is called only once as ### call sweep(cov,ndep,0,i,deter) ### where i in 0:ndep sweep1 <- function(cov, i, det = 1) { ## Purpose: ## ------------------------------------------------------------------------- ## Arguments: ## ------------------------------------------------------------------------- ## Author: Martin Maechler, Date: 22 Jan 2002, 08:58 if(!is.matrix(cov) || 0 != diff(D <- dim(cov))) stop("'cov' must be a square matrix") if((nord <- as.integer(D[1] - 1)) < 1)## cov[0:nord, 0:nord] stop("'cov' must be at least 2 x 2") if(0 > (i <- as.integer(i)) || i > nord) stop("'i' must be in 0:nord, where nord = nrow(cov)-1") storage.mode(cov) <- "double" .C(cluster:::cl_sweep, cov, nord, ixlo = 0:0, i = i, deter=det) } sweepAll <- function(cov, det = 1) { ## Purpose: ## ------------------------------------------------------------------------- ## Arguments: ## ------------------------------------------------------------------------- ## Author: Martin Maechler, Date: 22 Jan 2002, 08:58 if(!is.matrix(cov) || 0 != diff(D <- dim(cov))) stop("'cov' must be a square matrix") if((nord <- as.integer(D[1] - 1)) < 1)## cov[0:nord, 0:nord] stop("'cov' must be at least 2 x 2") storage.mode(cov) <- "double" for(i in 0:nord) { .C(cluster:::cl_sweep, cov, nord, ixlo = 0:0, i = i, deter = det, DUP = FALSE) # i.e. work on 'cov' and 'det' directly if(det <= 0) cat("** i = ", i, "; deter = ", format(det)," <= 0\n",sep="") } list(cov = cov, deter = det) } require(cluster) ## Examples with errors m1 <- cov(cbind(1, 1:5)) try(sweepAll(m1))# deter = 0; cov[2,2] = Inf ## ok (m2 <- cov(cbind(1:5, c(2:5,1), c(4:2,2,6)))) qr(m2, tol = .001)$rank sweepAll(m2) ## deter = 0 cluster/tests/ellipsoid-ex.Rout.save0000644000176200001440000001620713467043541017320 0ustar liggesusers R version 3.6.0 Patched (2019-05-14 r76502) -- "Planting of a Tree" Copyright (C) 2019 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) 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. > library(cluster) > > tools::assertWarning(eh <- ellipsoidhull(cbind(x=1:4, y = 1:4)), verbose=TRUE) #singular Error in Fortran routine computing the spanning ellipsoid, probably collinear data Asserted warning: algorithm possibly not converged in 5000 iterations > eh ## center ok, shape "0 volume" --> Warning 'ellipsoid' in 2 dimensions: center = ( 2.5 2.5 ); squared ave.radius d^2 = 0 and shape matrix = x y x 1.25 1.25 y 1.25 1.25 hence, area = 0 ** Warning: ** the algorithm did not terminate reliably! most probably because of collinear data > stopifnot(volume(eh) == 0) > > set.seed(157) > for(n in 4:10) { ## n=2 and 3 still differ -- platform dependently! + cat("n = ",n,"\n") + x2 <- rnorm(n) + print(ellipsoidhull(cbind(1:n, x2))) + print(ellipsoidhull(cbind(1:n, x2, 4*x2 + rnorm(n)))) + } n = 4 'ellipsoid' in 2 dimensions: center = ( 2.66215 0.82086 ); squared ave.radius d^2 = 2 and shape matrix = x2 1.55901 0.91804 x2 0.91804 0.67732 hence, area = 2.9008 'ellipsoid' in 3 dimensions: center = ( 2.50000 0.74629 2.95583 ); squared ave.radius d^2 = 3 and shape matrix = x2 1.25000 0.72591 1.8427 x2 0.72591 0.52562 1.5159 1.84268 1.51588 4.7918 hence, volume = 3.1969 n = 5 'ellipsoid' in 2 dimensions: center = ( 3.0726 1.2307 ); squared ave.radius d^2 = 2 and shape matrix = x2 2.21414 0.45527 x2 0.45527 2.39853 hence, area = 14.194 'ellipsoid' in 3 dimensions: center = ( 2.7989 1.1654 4.6782 ); squared ave.radius d^2 = 3 and shape matrix = x2 1.92664 0.40109 1.4317 x2 0.40109 1.76625 6.9793 1.43170 6.97928 28.0530 hence, volume = 26.631 n = 6 'ellipsoid' in 2 dimensions: center = ( 3.04367 0.97016 ); squared ave.radius d^2 = 2 and shape matrix = x2 4.39182 0.30833 x2 0.30833 0.59967 hence, area = 10.011 'ellipsoid' in 3 dimensions: center = ( 3.3190 0.7678 3.2037 ); squared ave.radius d^2 = 3 and shape matrix = x2 2.786928 -0.044373 -1.1467 x2 -0.044373 0.559495 1.5496 -1.146728 1.549620 5.5025 hence, volume = 24.804 n = 7 'ellipsoid' in 2 dimensions: center = ( 3.98294 -0.16567 ); squared ave.radius d^2 = 2 and shape matrix = x2 4.62064 -0.83135 x2 -0.83135 0.37030 hence, area = 6.3453 'ellipsoid' in 3 dimensions: center = ( 4.24890 -0.25918 -0.76499 ); squared ave.radius d^2 = 3 and shape matrix = x2 4.6494 -0.93240 -4.0758 x2 -0.9324 0.39866 1.9725 -4.0758 1.97253 10.4366 hence, volume = 16.152 n = 8 'ellipsoid' in 2 dimensions: center = ( 3.6699 -0.4532 ); squared ave.radius d^2 = 2 and shape matrix = x2 9.4327 -2.5269 x2 -2.5269 3.7270 hence, area = 33.702 'ellipsoid' in 3 dimensions: center = ( 4.22030 -0.37953 -1.53922 ); squared ave.radius d^2 = 3 and shape matrix = x2 7.5211 -1.4804 -6.6587 x2 -1.4804 2.6972 11.8198 -6.6587 11.8198 52.6243 hence, volume = 84.024 n = 9 'ellipsoid' in 2 dimensions: center = ( 5.324396 -0.037779 ); squared ave.radius d^2 = 2 and shape matrix = x2 10.1098 -1.3708 x2 -1.3708 2.1341 hence, area = 27.885 'ellipsoid' in 3 dimensions: center = ( 5.44700 -0.12504 -1.13538 ); squared ave.radius d^2 = 3 and shape matrix = x2 7.0364 -1.2424 -5.5741 x2 -1.2424 1.7652 7.3654 -5.5741 7.3654 31.5558 hence, volume = 64.161 n = 10 'ellipsoid' in 2 dimensions: center = ( 4.85439 0.28401 ); squared ave.radius d^2 = 2 and shape matrix = x2 13.932 0.64900 x2 0.649 0.95132 hence, area = 22.508 'ellipsoid' in 3 dimensions: center = ( 5.12537 0.25024 0.86441 ); squared ave.radius d^2 = 3 and shape matrix = x2 9.29343 0.56973 1.4143 x2 0.56973 0.76519 1.8941 1.41427 1.89409 6.3803 hence, volume = 73.753 > > set.seed(1) > x <- rt(100, df = 4) > y <- 100 + 5 * x + rnorm(100) > ellipsoidhull(cbind(x,y)) 'ellipsoid' in 2 dimensions: center = ( -1.3874 93.0589 ); squared ave.radius d^2 = 2 and shape matrix = x y x 32.924 160.54 y 160.543 785.88 hence, area = 62.993 > z <- 10 - 8 * x + y + rnorm(100) > (e3 <- ellipsoidhull(cbind(x,y,z))) 'ellipsoid' in 3 dimensions: center = ( -0.71678 96.09950 111.61029 ); squared ave.radius d^2 = 3 and shape matrix = x y z x 26.005 126.41 -80.284 y 126.410 616.94 -387.459 z -80.284 -387.46 254.006 hence, volume = 301.25 > d3o <- cbind(x,y + rt(100,3), 2 * x^2 + rt(100, 2)) > (e. <- ellipsoidhull(d3o, ret.sq = TRUE)) 'ellipsoid' in 3 dimensions: center = ( 0.32491 101.68998 39.48045 ); squared ave.radius d^2 = 3 and shape matrix = x x 19.655 94.364 48.739 94.364 490.860 181.022 48.739 181.022 1551.980 hence, volume = 21856 > stopifnot(all.equal(e.$sqdist, + with(e., mahalanobis(d3o, center=loc, cov=cov)), + tol = 1e-13)) > d5 <- cbind(d3o, 2*abs(y)^1.5 + rt(100,3), 3*x - sqrt(abs(y))) > (e5 <- ellipsoidhull(d5, ret.sq = TRUE)) 'ellipsoid' in 5 dimensions: center = ( -0.32451 98.54780 37.33619 1973.88383 -10.81891 ); squared ave.radius d^2 = 5 and shape matrix = x x 17.8372 87.0277 8.3389 2607.9 49.117 87.0277 446.9453 -2.0502 12745.4 239.470 8.3389 -2.0502 1192.8439 2447.8 24.458 2607.9264 12745.3826 2447.8006 384472.1 7179.239 49.1172 239.4703 24.4582 7179.2 135.260 hence, volume = 191410 > tail(sort(e5$sqdist)) ## 4 values 5.00039 ... 5.0099 [1] 4.999915 5.000005 5.000010 5.000088 5.001444 5.009849 > > (e5.1e77 <- ellipsoidhull(1e77*d5)) 'ellipsoid' in 5 dimensions: center = ( -3.2451e+76 9.8548e+78 3.7336e+78 1.9739e+80 -1.0819e+78 ); squared ave.radius d^2 = 5 and shape matrix = x x 1.7837e+155 8.7028e+155 8.3389e+154 2.6079e+157 4.9117e+155 8.7028e+155 4.4695e+156 -2.0502e+154 1.2745e+158 2.3947e+156 8.3389e+154 -2.0502e+154 1.1928e+157 2.4478e+157 2.4458e+155 2.6079e+157 1.2745e+158 2.4478e+157 3.8447e+159 7.1792e+157 4.9117e+155 2.3947e+156 2.4458e+155 7.1792e+157 1.3526e+156 hence, volume = exp(898.66) > stopifnot(# proof correct scaling c^5 + all.equal(volume(e5.1e77, log=TRUE) - volume(e5, log=TRUE), + ncol(d5) * 77* log(10)) + ) > > proc.time() user system elapsed 0.117 0.034 0.210 cluster/tests/diana-ex.Rout.save0000644000176200001440000004205013257174710016403 0ustar liggesusers R version 3.5.0 alpha (2018-03-28 r74481) Copyright (C) 2018 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit) 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. > library(cluster) > options(digits = 6) > data(votes.repub) > di.votes <- daisy(votes.repub) > > .p00 <- proc.time() > summary(diana(votes.repub, metric = "manhattan", stand = TRUE)) Merge: [,1] [,2] [1,] -7 -32 [2,] -13 -35 [3,] -12 -50 [4,] 1 -30 [5,] -26 -28 [6,] -5 -37 [7,] -22 -38 [8,] -21 -39 [9,] -16 -27 [10,] 4 2 [11,] -25 -48 [12,] -42 -46 [13,] -6 -14 [14,] -34 -41 [15,] -8 -20 [16,] 5 -31 [17,] 10 7 [18,] -17 -47 [19,] -3 -44 [20,] -33 12 [21,] 15 18 [22,] 17 -29 [23,] 22 -49 [24,] 21 11 [25,] 23 -15 [26,] -11 -19 [27,] 3 9 [28,] 8 -23 [29,] 19 16 [30,] 27 14 [31,] 6 25 [32,] -1 -10 [33,] 31 13 [34,] 29 -36 [35,] -2 -45 [36,] -9 -43 [37,] 24 20 [38,] 32 -4 [39,] -24 -40 [40,] 38 -18 [41,] 33 30 [42,] 34 37 [43,] 35 26 [44,] 41 28 [45,] 40 36 [46,] 42 44 [47,] 45 39 [48,] 43 46 [49,] 47 48 Order of objects: [1] Alabama Georgia Arkansas Louisiana Florida [6] Texas Mississippi South Carolina Alaska Vermont [11] Hawaii Maine Arizona Utah Montana [16] Nevada New Mexico Oklahoma Delaware Maryland [21] Kentucky Washington Missouri West Virginia North Carolina [26] Tennessee Virginia California Oregon Connecticut [31] New York New Jersey Illinois Ohio Michigan [36] Pennsylvania New Hampshire Wisconsin Iowa Colorado [41] Indiana Idaho Wyoming Kansas Nebraska [46] North Dakota South Dakota Massachusetts Rhode Island Minnesota Height: [1] 27.36345 33.96925 39.65826 48.53428 31.89965 72.59850 35.69152 [8] 167.58020 31.58222 43.84601 24.48796 85.55248 18.39339 25.67631 [15] 11.49397 17.45552 28.62550 42.54480 16.48510 20.04450 17.87516 [22] 21.98373 14.21808 33.61071 18.39733 14.75762 56.55675 11.70132 [29] 27.05887 8.38200 11.36820 13.25237 9.23004 17.83484 12.70819 [36] 20.66714 21.03997 23.66586 28.60541 15.31703 40.33905 10.46294 [43] 24.83525 12.80419 26.36292 16.25192 47.25773 12.79160 24.87206 Divisive coefficient: [1] 0.886918 1225 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 8.38 25.54 34.51 45.06 56.02 167.60 Metric : manhattan Number of objects : 50 Available components: [1] "order" "height" "dc" "merge" "diss" "call" [7] "order.lab" "data" > summary(diana(di.votes, keep.diss = FALSE)) Merge: [,1] [,2] [1,] -12 -50 [2,] -13 -32 [3,] -14 -35 [4,] -7 -29 [5,] -21 -39 [6,] -3 -28 [7,] -25 -48 [8,] -16 -27 [9,] -15 -41 [10,] 2 -30 [11,] 6 -26 [12,] -33 -42 [13,] 12 -46 [14,] 1 -44 [15,] 10 3 [16,] -22 -38 [17,] -11 -19 [18,] -5 -47 [19,] -17 -20 [20,] -2 -45 [21,] 14 -31 [22,] -37 -49 [23,] 9 8 [24,] 4 15 [25,] -8 19 [26,] -6 21 [27,] 5 -23 [28,] 24 16 [29,] 26 -36 [30,] 11 29 [31,] -1 -10 [32,] 28 22 [33,] 23 -34 [34,] 7 13 [35,] -4 -9 [36,] 20 17 [37,] -24 -40 [38,] 31 -43 [39,] 32 33 [40,] 25 34 [41,] 30 18 [42,] 35 -18 [43,] 38 42 [44,] 39 27 [45,] 41 40 [46,] 36 44 [47,] 43 37 [48,] 46 45 [49,] 47 48 Order of objects: [1] Alabama Georgia Texas Arkansas Florida [6] Louisiana Mississippi South Carolina Alaska Vermont [11] Hawaii Maine Connecticut New Hampshire Illinois [16] New York New Jersey Indiana Ohio Michigan [21] Pennsylvania Oregon Wisconsin Iowa South Dakota [26] Kansas Nebraska North Dakota Massachusetts Rhode Island [31] Minnesota Arizona Nevada Montana Colorado [36] Idaho Wyoming Utah New Mexico Oklahoma [41] California Washington Delaware Kentucky Maryland [46] Missouri West Virginia North Carolina Tennessee Virginia Height: [1] 48.2397 63.1862 72.9221 56.1363 72.9221 116.7048 63.0951 281.9508 [9] 33.8330 58.0384 32.7611 106.7448 20.5216 39.1728 19.8436 27.0243 [17] 31.4966 20.2258 47.1690 31.6595 49.2428 36.7667 64.4821 26.1547 [25] 37.4564 25.9221 50.7201 77.1184 22.6334 44.4594 178.4119 23.4206 [33] 27.8273 48.0483 43.7055 17.1992 31.1988 34.0510 48.0483 70.4868 [41] 33.2328 81.0764 43.3829 33.4744 66.7591 25.3953 54.7306 29.5099 [49] 30.1541 Divisive coefficient: [1] 0.878225 Available components: [1] "order" "height" "dc" "merge" "diss" "call" [7] "order.lab" > cat('Time elapsed: ', proc.time() - .p00,'\n') Time elapsed: 0.006 0.003 0.008 0 0 > > data(agriculture) > data(ruspini) > > .p0 <- proc.time() > dia.agr <- diana(agriculture) > drusp0 <- diana(ruspini, keep.diss=FALSE, keep.data=FALSE) > drusp1 <- diana(ruspini, metric = "manhattan") > cat('Time elapsed: ', proc.time() - .p0,'\n') Time elapsed: 0.002 0 0.003 0 0 > > summary(dia.agr) Merge: [,1] [,2] [1,] -1 -10 [2,] -2 -9 [3,] 1 -3 [4,] -6 -8 [5,] -5 -7 [6,] 3 -12 [7,] -4 -11 [8,] 6 4 [9,] 8 2 [10,] 7 5 [11,] 9 10 Order of objects: [1] B NL D UK F I DK L GR P E IRL Height: [1] 1.64924 2.43516 4.85077 6.72309 2.77308 8.05295 2.22036 24.03539 [9] 5.16236 12.56742 3.14006 Divisive coefficient: [1] 0.871106 66 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 1.65 4.36 7.99 9.59 13.25 24.04 Metric : euclidean Number of objects : 12 Available components: [1] "order" "height" "dc" "merge" "diss" "call" [7] "order.lab" "data" > summary(drusp0) Merge: [,1] [,2] [1,] -18 -19 [2,] -55 -56 [3,] -27 -28 [4,] -49 -51 [5,] -33 -34 [6,] -23 -24 [7,] -59 -60 [8,] -29 -30 [9,] -67 -69 [10,] -36 -39 [11,] -32 -35 [12,] -50 -54 [13,] -37 -38 [14,] -70 -71 [15,] -64 -68 [16,] -62 -66 [17,] -12 -13 [18,] -16 1 [19,] -9 -10 [20,] -42 -43 [21,] -15 -17 [22,] -47 -48 [23,] 12 -52 [24,] -21 -22 [25,] 9 14 [26,] 2 -57 [27,] -73 -74 [28,] 6 -25 [29,] -26 11 [30,] 4 -53 [31,] 3 8 [32,] -11 17 [33,] -6 -8 [34,] -2 -3 [35,] 10 -40 [36,] -14 21 [37,] -65 25 [38,] -4 33 [39,] 36 18 [40,] 29 5 [41,] 26 7 [42,] -1 34 [43,] 24 28 [44,] 16 -63 [45,] -46 22 [46,] -31 35 [47,] 27 -75 [48,] 37 -72 [49,] 43 31 [50,] 30 23 [51,] 13 20 [52,] 15 48 [53,] 32 -20 [54,] 41 -58 [55,] 42 -5 [56,] 40 46 [57,] -44 -45 [58,] 19 39 [59,] 38 -7 [60,] 51 -41 [61,] -61 44 [62,] 50 54 [63,] 52 47 [64,] 61 63 [65,] 49 56 [66,] 59 53 [67,] 55 58 [68,] 57 62 [69,] 65 60 [70,] 67 66 [71,] 68 45 [72,] 69 71 [73,] 70 64 [74,] 73 72 Order of objects: [1] 1 2 3 5 9 10 14 15 17 16 18 19 4 6 8 7 11 12 13 20 61 62 66 63 64 [26] 68 65 67 69 70 71 72 73 74 75 21 22 23 24 25 27 28 29 30 26 32 35 33 34 31 [51] 36 39 40 37 38 42 43 41 44 45 49 51 53 50 54 52 55 56 57 59 60 58 46 47 48 Height: [1] 10.04988 6.40312 16.12452 29.12044 4.12311 17.02939 8.48528 [8] 4.24264 9.21954 4.12311 1.41421 40.24922 8.94427 6.32456 [15] 19.02630 28.84441 6.32456 4.12311 14.14214 102.07840 21.40093 [22] 4.12311 10.81665 27.07397 3.60555 13.60147 8.54400 2.82843 [29] 5.09902 3.60555 12.80625 22.80351 5.65685 12.36932 154.49595 [36] 4.47214 10.77033 2.23607 5.83095 13.03840 2.00000 6.32456 [43] 2.82843 28.16026 6.08276 3.00000 9.43398 2.23607 16.27882 [50] 11.04536 3.00000 6.70820 36.61967 3.60555 13.34166 4.24264 [57] 20.02498 94.57801 17.02939 35.35534 2.23607 6.32456 13.15295 [64] 3.16228 4.47214 22.20360 2.00000 5.38516 9.84886 2.82843 [71] 15.29706 47.63402 11.00000 4.47214 Divisive coefficient: [1] 0.960566 Available components: [1] "order" "height" "dc" "merge" "diss" "call" [7] "order.lab" > summary(drusp1) Merge: [,1] [,2] [1,] -55 -56 [2,] -27 -28 [3,] -18 -19 [4,] -49 -51 [5,] -33 -34 [6,] -32 -35 [7,] -23 -24 [8,] -59 -60 [9,] -50 -54 [10,] -29 -30 [11,] -67 -69 [12,] -37 -38 [13,] 11 -71 [14,] -64 -68 [15,] -62 -66 [16,] -12 -13 [17,] -16 3 [18,] -9 -10 [19,] -47 -48 [20,] 9 -52 [21,] -42 -43 [22,] -39 -40 [23,] -21 -22 [24,] 13 -70 [25,] -15 -17 [26,] 1 -57 [27,] -26 6 [28,] 4 -53 [29,] 7 -25 [30,] 2 10 [31,] -11 16 [32,] -6 -8 [33,] -31 -36 [34,] -74 -75 [35,] -2 -3 [36,] -46 19 [37,] -65 24 [38,] -14 17 [39,] -4 32 [40,] 38 25 [41,] -1 35 [42,] 26 8 [43,] 27 5 [44,] 23 30 [45,] 28 20 [46,] 15 -63 [47,] 43 33 [48,] 44 29 [49,] 46 -73 [50,] 31 -20 [51,] 42 -58 [52,] -44 -45 [53,] 12 22 [54,] 37 -72 [55,] 14 54 [56,] 39 -7 [57,] 41 -5 [58,] 53 21 [59,] 18 40 [60,] 48 47 [61,] -61 49 [62,] 45 51 [63,] 58 -41 [64,] 55 34 [65,] 61 64 [66,] 57 59 [67,] 56 50 [68,] 52 62 [69,] 60 63 [70,] 66 67 [71,] 68 36 [72,] 69 71 [73,] 70 65 [74,] 73 72 Order of objects: [1] 1 2 3 5 9 10 14 16 18 19 15 17 4 6 8 7 11 12 13 20 61 62 66 63 73 [26] 64 68 65 67 69 71 70 72 74 75 21 22 27 28 29 30 23 24 25 26 32 35 33 34 31 [51] 36 37 38 39 40 42 43 41 44 45 49 51 53 50 54 52 55 56 57 59 60 58 46 47 48 Height: [1] 12 9 22 36 5 24 11 5 2 12 6 54 12 8 20 40 8 5 16 [20] 142 30 5 15 16 33 5 19 11 4 5 6 18 32 9 187 6 14 2 [39] 8 4 16 3 8 26 7 3 13 3 16 9 51 5 18 6 24 6 32 [58] 123 18 48 3 8 15 4 6 31 2 7 13 4 18 67 11 6 Divisive coefficient: [1] 0.958075 2775 dissimilarities, summarized : Min. 1st Qu. Median Mean 3rd Qu. Max. 2.0 52.5 97.0 91.0 128.0 187.0 Metric : manhattan Number of objects : 75 Available components: [1] "order" "height" "dc" "merge" "diss" "call" [7] "order.lab" "data" > str (drusp1) List of 8 $ order : int [1:75] 1 2 3 5 9 10 14 16 18 19 ... $ height : num [1:74] 12 9 22 36 5 24 11 5 2 12 ... $ dc : num 0.958 $ merge : int [1:74, 1:2] -55 -27 -18 -49 -33 -32 -23 -59 -50 -29 ... $ diss : 'dissimilarity' num [1:2775] 11 12 29 13 25 43 33 22 27 39 ... ..- attr(*, "Size")= int 75 ..- attr(*, "Metric")= chr "manhattan" ..- attr(*, "Labels")= chr [1:75] "1" "2" "3" "4" ... $ call : language diana(x = ruspini, metric = "manhattan") $ order.lab: chr [1:75] "1" "2" "3" "5" ... $ data : int [1:75, 1:2] 4 5 10 9 13 13 12 15 18 19 ... ..- attr(*, "dimnames")=List of 2 .. ..$ : chr [1:75] "1" "2" "3" "4" ... .. ..$ : chr [1:2] "x" "y" - attr(*, "class")= chr [1:2] "diana" "twins" > > ## From system.file("scripts/ch11.R", package = "MASS") > data(swiss) > swiss.x <- as.matrix(swiss[,-1]) > .p1 <- proc.time() > dCH <- diana(swiss.x) > cat('Time elapsed: ', proc.time() - .p1,'\n') Time elapsed: 0.001 0 0.001 0 0 > str(as.dendrogram(as.hclust(dCH)))# keep back-compatible --[dendrogram w/ 2 branches and 47 members at h = 127] |--[dendrogram w/ 2 branches and 31 members at h = 99.2] | |--[dendrogram w/ 2 branches and 11 members at h = 60.9] | | |--[dendrogram w/ 2 branches and 8 members at h = 29.1] | | | |--[dendrogram w/ 2 branches and 5 members at h = 22.7] | | | | |--[dendrogram w/ 2 branches and 4 members at h = 17.4] | | | | | |--[dendrogram w/ 2 branches and 3 members at h = 11.7] | | | | | | |--leaf "Courtelary" | | | | | | `--[dendrogram w/ 2 branches and 2 members at h = 7.48] | | | | | | |--leaf "Le Locle" | | | | | | `--leaf "ValdeTravers" | | | | | `--leaf "La Chauxdfnd" | | | | `--leaf "La Vallee" | | | `--[dendrogram w/ 2 branches and 3 members at h = 19] | | | |--[dendrogram w/ 2 branches and 2 members at h = 11.5] | | | | |--leaf "Lausanne" | | | | `--leaf "Neuchatel" | | | `--leaf "Vevey" | | `--[dendrogram w/ 2 branches and 3 members at h = 56.1] | | |--leaf "V. De Geneve" | | `--[dendrogram w/ 2 branches and 2 members at h = 21.4] | | |--leaf "Rive Droite" | | `--leaf "Rive Gauche" | `--[dendrogram w/ 2 branches and 20 members at h = 48.4] | |--leaf "Moutier" | `--[dendrogram w/ 2 branches and 19 members at h = 44.3] | |--[dendrogram w/ 2 branches and 18 members at h = 39.1] | | |--[dendrogram w/ 2 branches and 6 members at h = 21.9] | | | |--[dendrogram w/ 2 branches and 4 members at h = 12.1] | | | | |--[dendrogram w/ 2 branches and 2 members at h = 10.8] | | | | | |--leaf "Neuveville" | | | | | `--leaf "Boudry" | | | | `--[dendrogram w/ 2 branches and 2 members at h = 4.56] | | | | |--leaf "Grandson" | | | | `--leaf "Val de Ruz" | | | `--[dendrogram w/ 2 branches and 2 members at h = 13.5] | | | |--leaf "Nyone" | | | `--leaf "Yverdon" | | `--[dendrogram w/ 2 branches and 12 members at h = 20.4] | | |--[dendrogram w/ 2 branches and 7 members at h = 15.1] | | | |--[dendrogram w/ 2 branches and 5 members at h = 11.6] | | | | |--[dendrogram w/ 2 branches and 4 members at h = 8.05] | | | | | |--[dendrogram w/ 2 branches and 3 members at h = 6.79] | | | | | | |--[dendrogram w/ 2 branches and 2 members at h = 4.79] | | | | | | | |--leaf "Aigle" | | | | | | | `--leaf "Morges" | | | | | | `--leaf "Rolle" | | | | | `--leaf "Avenches" | | | | `--leaf "Orbe" | | | `--[dendrogram w/ 2 branches and 2 members at h = 6.04] | | | |--leaf "Moudon" | | | `--leaf "Payerne" | | `--[dendrogram w/ 2 branches and 5 members at h = 17.3] | | |--[dendrogram w/ 2 branches and 4 members at h = 11.2] | | | |--[dendrogram w/ 2 branches and 2 members at h = 7.57] | | | | |--leaf "Aubonne" | | | | `--leaf "Oron" | | | `--[dendrogram w/ 2 branches and 2 members at h = 6.35] | | | |--leaf "Cossonay" | | | `--leaf "Lavaux" | | `--leaf "Paysd'enhaut" | `--leaf "Echallens" `--[dendrogram w/ 2 branches and 16 members at h = 56.2] |--[dendrogram w/ 2 branches and 5 members at h = 20.4] | |--[dendrogram w/ 2 branches and 3 members at h = 12.7] | | |--leaf "Delemont" | | `--[dendrogram w/ 2 branches and 2 members at h = 9.4] | | |--leaf "Franches-Mnt" | | `--leaf "Porrentruy" | `--[dendrogram w/ 2 branches and 2 members at h = 13] | |--leaf "Gruyere" | `--leaf "Sarine" `--[dendrogram w/ 2 branches and 11 members at h = 30] |--[dendrogram w/ 2 branches and 5 members at h = 12.9] | |--[dendrogram w/ 2 branches and 4 members at h = 11.9] | | |--[dendrogram w/ 2 branches and 3 members at h = 8.45] | | | |--leaf "Broye" | | | `--[dendrogram w/ 2 branches and 2 members at h = 4.14] | | | |--leaf "Glane" | | | `--leaf "Veveyse" | | `--leaf "Sion" | `--leaf "Monthey" `--[dendrogram w/ 2 branches and 6 members at h = 16] |--[dendrogram w/ 2 branches and 4 members at h = 7.42] | |--[dendrogram w/ 2 branches and 3 members at h = 5.94] | | |--[dendrogram w/ 2 branches and 2 members at h = 2.05] | | | |--leaf "Conthey" | | | `--leaf "Sierre" | | `--leaf "Herens" | `--leaf "Entremont" `--[dendrogram w/ 2 branches and 2 members at h = 5.09] |--leaf "Martigwy" `--leaf "St Maurice" > > proc.time() user system elapsed 0.192 0.044 0.292 cluster/tests/silhouette-default.R0000644000176200001440000000677014402061503017034 0ustar liggesusers## This came from a bug report on R-help by ge yreyt ## Date: Mon, 9 Jun 2003 16:06:53 -0400 (EDT) library(cluster) if(FALSE) # manual testing library(cluster, lib="~/R/Pkgs/cluster.Rcheck") data(iris) .proctime00 <- proc.time() mdist <- as.dist(1 - cor(t(iris[,1:4])))#dissimlarity ## this is always the same: hc <- diana(mdist, diss = TRUE, stand = FALSE) maxk <- 15 # at most 15 clusters silh.wid <- numeric(maxk) # myind[k] := the silh.value for k clusters silh.wid[1] <- NA # 1-cluster: silhouette not defined op <- par(mfrow = c(4,4), mar = .1+ c(2,1,2,1), mgp=c(1.5, .6,0)) for(k in 2:maxk) { cat("\n", k,":\n==\n") k.gr <- cutree(as.hclust(hc), k = k) cat("grouping table: "); print(table(k.gr)) si <- silhouette(k.gr, mdist) cat("silhouette:\n"); print(summary(si)) plot(si, main = paste("k =",k), col = 2:(k+1), do.n.k=FALSE, do.clus.stat=FALSE) silh.wid[k] <- summary(si)$avg.width ## === } par(op) summary(si.p <- silhouette(50 - k.gr, mdist)) stopifnot(identical(si.p[,3], si[,3]), identical(si.p[, 1:2], 50 - si[, 1:2])) # the widths: silh.wid #select the number of k clusters with the largest si value : (myk <- which.min(silh.wid)) # -> 8 (here) postscript(file="silhouette-ex.ps") ## MM: plot to see how the decision is made plot(silh.wid, type = 'b', col= "blue", xlab = "k") axis(1, at=myk, col.axis= "red", font.axis= 2) ##--- PAM()'s silhouette should give same as silh*.default()! Eq <- function(x,y, tol = 1e-12) x == y | abs(x - y) < tol * abs((x+y)/2) for(k in 2:40) { cat("\n", k,":\n==\n") p.k <- pam(mdist, k = k) k.gr <- p.k$clustering si.p <- silhouette(p.k) si.g <- silhouette(k.gr, mdist) ## since the obs.order may differ (within cluster): si.g <- si.g[ as.integer(rownames(si.p)), ] cat("grouping table: "); print(table(k.gr)) if(!isTRUE(all.equal(c(si.g), c(si.p)))) { cat("silhouettes differ:") if(any(neq <- !Eq(si.g[,3], si.p[,3]))) { cat("\n") print( cbind(si.p[], si.g[,2:3])[ neq, ] ) } else cat(" -- but not in col.3 !\n") } } ## "pathological" case where a_i == b_i == 0 : D6 <- structure(c(0, 0, 0, 0.4, 1, 0.05, 1, 1, 0, 1, 1, 0, 0.25, 1, 1), Labels = LETTERS[1:6], Size = 6, call = as.name("manually"), class = "dist", Diag = FALSE, Upper = FALSE) D6 kl6 <- c(1,1, 2,2, 3,3) (skD6 <- silhouette(kl6, D6))# had one NaN summary(skD6) plot(silhouette(kl6, D6))# gives error in earlier cluster versions dev.off() ## checking compatibility with R-only version silhouetteR <- asNamespace("cluster")$silhouetteR noCall <- function(si) `attr<-`(si, "call", NULL) # only 'call' is different: stopifnot(all.equal(noCall(skD6), noCall(silhouetteR(kl6, D6)))) ## k=1 : pam(*, k=1) works, but silhouette() is not defined; ## --- FIXME: silhouette.partition() fails: "invalid partition .."; (which is not strictly true ## ------ -> give something like NA ((or a *different* error message) ## the other methods just give NA (no object!) ## drop "call" *and* "iOrd" noCliO <- function(si) noCall(`attr<-`(si, "iOrd", NULL)) for(k in 2:7) { p.k <- pam(ruspini, k=k) ## order the silhouette to be *as* the default: ## spk <- silhouette(p.k); opk <- spk[order(as.numeric(rownames(spk))), ] ## rather sort*() the other: stopifnot(all.equal(noCall(silhouette(p.k)), noCliO(sortSilhouette(silhouetteR(p.k$clustering, p.k$diss))))) } ## Last Line: cat('Time elapsed: ', proc.time() - .proctime00,'\n') cluster/README0000644000176200001440000000271513655010241012615 0ustar liggesusersORIGINAL README : This directory contains code, help and examples for CLUS, an S-PLUS package for clustering, as described in ``Clustering in an Object-Oriented Environment'' by Anja Struyf, Mia Hubert, and Peter J. Rousseeuw (Journal of Statistical Software, volume 1). ------------------------------------------------------------------------ See http://www.stat.ucla.edu/journals/jss/ for the original version. The current port is based on material now on http://www.agoras.ua.ac.be/ KH 1998/05/21 --------- For historical reasons, we keep R/README-Splus which has no relevance to the R package. --------------------- TODO {see ./TODO-MM for MM's private 'todo' list; ./DONE-MM for things done} 3) daisy() for the case of mixed variables should allow a weight vector (of length p = #vars) for up- or downweighing variables. daisy() really should accept the other methods mva's dist() does _and_ it should use dist's C API -- but we have no C API for package code, ARRGH! 4) Eliminate the many Fortran (g77 -Wall) warnings of the form >> mona.f:101: warning: `jma' might be used uninitialized in this function 6) Mona objects describe a hierarchical clustering; they could also inherit from twins, and hence have a pltree() method for plotting the hierarchical tree. 8b) Think about "merging" the plot.agnes and plot.diana methods. ------------------ Martin , since 1999 cluster/INDEX0000644000176200001440000000526710366141463012543 0ustar liggesusersagnes Agglomerative Nesting clara Clustering Large Applications daisy Dissimilarity Matrix Calculation diana DIvisive ANAlysis Clustering fanny Fuzzy Analysis Clustering mona MONothetic Analysis Clustering of Binary Variables pam Partitioning Around Medoids dissimilarity.object Dissimilarity Matrix Object partition.object Partitioning Object twins.object Hierarchical Clustering Object agnes.object Agglomerative Nesting (AGNES) Object clara.object Clustering Large Applications (CLARA) Object diana.object Divisive Analysis (DIANA) Object fanny.object Fuzzy Analysis (FANNY) Object mona.object Monothetic Analysis (MONA) Object pam.object Partitioning Around Medoids (PAM) Object sizeDiss Sample Size of Dissimilarity Like Object clusplot Cluster Plot - Generic Function clusplot.default Bivariate Cluster Plot (Clusplot) Default Method clusplot.partition Bivariate Clusplot of a Partitioning Object coef.hclust Agglomerative Coefficient for 'hclust' Objects pltree Clustering Trees - Generic Function pltree.twins Clustering Tree of a Hierarchical Clustering bannerplot Plot Banner (of Hierarchical Clustering) silhouette Compute or Extract Silhouette Information from Clustering ellipsoidhull Compute the Ellipsoid Hull or Spanning Ellipsoid of a Point Set predict.ellipsoid Predict Method for Ellipsoid Objects volume.ellipsoid Compute the Volume of Planar Object lower.to.upper.tri.inds Permute Indices for Triangular Matrices plot.agnes Plots of an Agglomerative Hierarchical Clustering plot.diana Plots of a Divisive Hierarchical Clustering plot.mona Banner of Monothetic Divisive Hierarchical Clusterings plot.partition Plot of a Partition of the Data Set print.dissimilarity Print and Summary Methods for Dissimilarity Objects print.agnes Print Method for AGNES Objects print.clara Print Method for CLARA Objects print.diana Print Method for DIANA Objects print.fanny Print Method for FANNY Objects print.mona Print Method for MONA Objects print.pam Print Method for PAM Objects summary.agnes Summary Method for 'agnes' Objects summary.clara Summary Method for 'clara' Objects summary.diana Summary Method for 'diana' Objects summary.fanny Summary Method for 'fanny' Objects summary.mona Summary Method for 'mona' Objects summary.pam Summary Method for PAM Objects cluster-internal Internal cluster functions DATASETS agriculture European Union Agricultural Workforces animals Attributes of Animals flower Flower Characteristics pluton Isotopic Composition Plutonium Batches ruspini Ruspini Data votes.repub Votes for Republican Candidate in Presidential Elections xclara Bivariate Data Set with 3 Clusters cluster/MD50000644000176200001440000002003414764341102012244 0ustar liggesusers6da12079996ad0aa5be2f30ee7a9e457 *ChangeLog 904736b64cd31b4e2435c40562f1a59e *DESCRIPTION 824c6b9820b7fc963b52b185b8284481 *INDEX 2608df4d8982fd4507474f11d3ff532e *NAMESPACE 8de82c7d42bd4a27c27c25462ae2a307 *PORTING 35176f2601b3bb53e380af1484cd8fd8 *R/0aaa.R 9359fc46e0f395db60348a454f306f1e *R/agnes.q 7b627a908de775e7bfa9f179d58093c4 *R/clara.q bed5408efbdb993cc54ce6f895319081 *R/clusGap.R a6de142daacb2b59b3f4426bafc30244 *R/clusGapGen.R e93355a6f7ad8d8486e6db4db52200a9 *R/coef.R c2b2ec71b0b89e5b3e359f28f414edaa *R/daisy.q 4a741f9c34a274c7225f632831163150 *R/diana.q 086784f30e63fed4d559d1a329afbd90 *R/ellipsoidhull.R 86a134c01b58fae094b8b064c4af3d60 *R/fanny.q df15a742d85b586d51bd4b031cb08cb6 *R/internal.R 4012a3c0301944867bf595d25fcf30df *R/medoids.R 4b26b60ba9fa843ec62c7164c52f5d97 *R/mona.q e41c1e99c0ab0a0f7fdb917a9009714c *R/pam.q dd4bfe2b3eb91cbcf11d2b17719d6977 *R/plothier.q c34b277489cb1ee06bc551c8af1f46e8 *R/plotpart.q d463b191ae7a1d1e4681fd14cd8e4f75 *R/silhouette.R f1d53c5f24897b5ab0e6014be9be7844 *R/zzz.R 0d5b196c8cf0ac67c43144fa14ddf275 *README f574b7bc08229c73a354bb195d07c7f3 *build/partial.rdb ac189f8e6e1314c01a700f6a31ee4506 *data/agriculture.tab 1046f7a750dbbac2724fd910aff561e7 *data/animals.tab c8f60e65b0356698f6b08c23c07e2a94 *data/chorSub.rda 0f34ac1e10d178fa04a4babb705d5b27 *data/flower.R 0772c2f9932873c7dd6551208cd0725b *data/plantTraits.rda 1022570c32295066506ad7b26439f7bf *data/pluton.tab eda904e011e79ea5a25602125d558d04 *data/ruspini.tab e816e6c67444107ab47ff3bf2f6023f2 *data/votes.repub.tab be46f45035b177b940393db459789282 *data/xclara.rda 8ea8fc7e56eda28f71352a336a430c41 *inst/CITATION cc886b5d45dfb7ec272ac106d193a792 *inst/NEWS.Rd b893034dcbb4b4977b53fd19020a0d3c *inst/po/de/LC_MESSAGES/R-cluster.mo 2ea75383dd4fa4a009b55dea63dbde24 *inst/po/de/LC_MESSAGES/cluster.mo 840f1f5936dff1331afb6f1e1ceca80b *inst/po/en@quot/LC_MESSAGES/R-cluster.mo 05c20b9b69d42de97502ba03e6b2da2d *inst/po/en@quot/LC_MESSAGES/cluster.mo ad357e74e543aaff82ca7b0b0f74fa68 *inst/po/fr/LC_MESSAGES/R-cluster.mo 0f1e6825d9f4d929a4c7498117ef7db1 *inst/po/fr/LC_MESSAGES/cluster.mo 82634ef9907c55c2ef3479c593faab6d *inst/po/it/LC_MESSAGES/R-cluster.mo ea65ee7c4b7e355625c73bde508aace2 *inst/po/it/LC_MESSAGES/cluster.mo 25285dfff1fc041a6f04a20bfaa4f2c2 *inst/po/ko/LC_MESSAGES/R-cluster.mo 267db8d66a7fad4e18c03e82f11ca1cb *inst/po/ko/LC_MESSAGES/cluster.mo cc7ea78bc6cc7e884961af02737dfee6 *inst/po/lt/LC_MESSAGES/R-cluster.mo 938d93266ced643f1bf45d1310693359 *inst/po/lt/LC_MESSAGES/cluster.mo 637e48432ffbf0d87e7b193733915c3a *inst/po/pl/LC_MESSAGES/R-cluster.mo 0a1fb45a19b929335c79d7a52ad8a571 *inst/test-tools.R ed2e964e5d6161569122a689789a31e9 *man/agnes.Rd 29d26f3fb10f3462291c10d441865e71 *man/agnes.object.Rd 7db03338761019b70d064ffe1eddcc5d *man/agriculture.Rd ba26ba311f46bfec382d98fbc1f00e15 *man/animals.Rd 80586a34dc1e14f840ebae455aeb9736 *man/bannerplot.Rd 0b1033484c0b66ff9451427930e92987 *man/chorSub.Rd e889c7c3f0f1f3af2077f340fb6da047 *man/clara.Rd b86f299b6994b98e2112843516f3108a *man/clara.object.Rd 81d75ba5deba81321d7497541217c272 *man/clusGap.Rd a5f2cf76037484266bc7c13da95dd920 *man/clusplot.default.Rd e3fa8178735e3ceca1babba4a103b349 *man/clusplot.partition.Rd 467fc5df7bed2d2d9d7a61062ae33afe *man/cluster-internal.Rd 20b35f88ced8e679778892a732a43369 *man/coef.hclust.Rd 40462aa82254bd1c4af74bccc9fcea9f *man/daisy.Rd 34e555482bdabb2da8cf740880a40071 *man/diana.Rd a98a5c13b3c67135bf586770887fda9b *man/dissimilarity.object.Rd 31f0b74e9b3ed9255335f9b0c321531a *man/ellipsoidhull.Rd 6fcf7eee2ff0505f51021bf65f468fbf *man/fanny.Rd 7d549aed091402cecc8a398085e4bb86 *man/fanny.object.Rd 640ccd3b30259638bf56033b8fbc7822 *man/flower.Rd f9c1ca445301e6c2ed69986d96ab5676 *man/lower.to.upper.tri.inds.Rd 1c49ac1b2f8b20068386e8089633f8a9 *man/medoids.Rd b75d0f093fc09421ee5d5d12ddd7fcc1 *man/mona.Rd 546379a2e048bf7ef7a69aff87f4ca50 *man/mona.object.Rd cadf16bfc025ac3e091e19e253525917 *man/pam.Rd 21795cc8b4bd9b63b24f44e5ffeeccb2 *man/pam.object.Rd 351d76eba52f0dff7f468b04c4d52fcd *man/partition.object.Rd 40fe00964d4215ce1b2390e8f18e9dc0 *man/plantTraits.Rd a2e45d8b373be70e45c9d49c1779672e *man/plot.agnes.Rd d5cdf876f8d1b10a51cca74cde4624ae *man/plot.diana.Rd 8173e5fa51104ac7c45c0eb8da210dcf *man/plot.mona.Rd ee6a690d0f2c7a25f3b8f77881778137 *man/plot.partition.Rd 9706671a297441462a314548093230fd *man/pltree.Rd 84b2723e904c2b1897a00043106b458e *man/pluton.Rd d7edca4aea0edca6e7139092e85e67db *man/predict.ellipsoid.Rd ece1532629f0e06a65f6670e5b9bd459 *man/print.agnes.Rd b6384eb685030609ae9edd06434949b0 *man/print.clara.Rd e0c63f114cc0bf71fe53964b5f883255 *man/print.diana.Rd b32046c766441c7fc75f644734c690b1 *man/print.dissimilarity.Rd 1ce3568140412485f727b2d9193ba09c *man/print.fanny.Rd 0dcf3dd3c5afbb216939ca9158c32192 *man/print.mona.Rd b1c1625935a5c22d81aa2e73d3b80457 *man/print.pam.Rd 7cd999938af26fb5c97e4d45ab9ea982 *man/ruspini.Rd 34286e20d862287131b21099f0b07ca0 *man/silhouette.Rd 8beea8b2090f7e91d0a0b69ec2013718 *man/sizeDiss.Rd 0df193ca0559bef700c60048d76d0516 *man/summary.agnes.Rd f3ed5c8171d049bbd17293ba6704d0aa *man/summary.clara.Rd 964d099b6a9ab924dfe49779e8f13f03 *man/summary.diana.Rd 6a4b775e10738bf3472bcc35a64c7623 *man/summary.mona.Rd 5cc8d9a8fa53b437121d841475d46b46 *man/summary.pam.Rd 1f622b89b4b8b0e93e3f0abd65122ee4 *man/twins.object.Rd d030948d78b63ac02577e92e6bd02fbf *man/volume.ellipsoid.Rd 0510d0816550f6d3c258652912053a1d *man/votes.repub.Rd 0ebf97dd08eb6f33180418891f1cbbdb *man/xclara.Rd 900b5ec45f5ff8bf53adef3512b80da6 *po/R-cluster.pot 55b5b72251e7d08fb28939c08d602a9e *po/R-de.po e9b5293e63746638be1f3570dbeb4fe3 *po/R-en@quot.po c7756534b86bf7bfec444829a2712f70 *po/R-fr.po 13b4f0d8424c2a8f0ff32ef83369b3be *po/R-it.po fbde69de7e2873014af2d1f1cd7d8ce2 *po/R-ko.po 5d3f9c805de26d4b8df6afed5a76d7b5 *po/R-lt.po 23e4554ebc8438a475c14cbe47339ffe *po/R-pl.po cf46a3d4667775038358d6f1d7c24840 *po/cluster.pot 45803ff36e74500a0da41c09b0d43757 *po/de.po 9989513cc0477d082ab4cb8b2029f67e *po/fr.po 8e801cb9f9656267990839510473d98b *po/it.po 3f32b18576c5075747167bc68aa5afb7 *po/ko.po 936cef3d2f0a000c782afcff2e22c2f7 *po/lt.po f0e6eff96b52c258c95a83a46f15a0e1 *po/update-me.sh 08f13532ecc8b51f0dd10693e016c7ab *src/clara.c 5582f98b5a9ae329c712b4019deb934a *src/cluster.h 9bc868b06157f7841f69288b5625d784 *src/daisy.c 54c866595919cad05468f6648525f6e8 *src/dysta.c 9e51e85d6df0adb491e01ab65f8c561e *src/fanny.c 23cea00d2feab57a92e8c2393c7f4b8a *src/ind_2.h 4227c0119bf3e593beb5ab84259b9c9d *src/init.c 7cb95ac5e410f3ce834bbf4d56f6d174 *src/mona.c 671fe9bfc3dee7cfd55ac939ba55a5b9 *src/pam.c a1171c691cb59eac9a05e50fb41ac1f4 *src/sildist.c f42f05132aaf001ddd333e3e109692e0 *src/spannel.c 6533185f3d4cc5d9bf7306008ebe1a41 *src/twins.c 3a5f551aa7bf022f970394e5026ff25f *tests/agnes-ex.R ac9104069856cd281cd680c840328c02 *tests/agnes-ex.Rout.save 4f0447578ed53dceaf09a6c20a417348 *tests/clara-NAs.R 7d4d11e857be342e5cd57be47da4b09f *tests/clara-NAs.Rout.save 39e1daac5198726c9d921a5d5bb122cb *tests/clara-ex.R 42f8973d593613ee4ab262bcbfd885f2 *tests/clara-ex.Rout.save e0f23aba341da858776391293ecd8811 *tests/clara-gower.R 75f50fcefc8b754be68d03b2b9c2d0de *tests/clara.R 447814633e00f9ae6af348b4fa90b2b5 *tests/clara.Rout.save 79c68eadc1e1f72d909b7c015a278cc7 *tests/clusplot-out.R ea8a86f78e84fb61bdeff42f43a0a767 *tests/clusplot-out.Rout.save f18c30498088665569965cf10886b878 *tests/daisy-ex.R b5c8776a732bdeddafa93372e543462a *tests/daisy-ex.Rout.save 27d4307ca493cd273dc2e944d5bbc955 *tests/diana-boots.R 4fc11382af41801e16128f96e17a70e7 *tests/diana-ex.R 474c2d78169cdf88d34616a9bada8b31 *tests/diana-ex.Rout.save 91d99ad3fb3f40d86d99f6f22486f061 *tests/ellipsoid-ex.R cb6e997786f07076f6a6bcf959cdeb12 *tests/ellipsoid-ex.Rout.save 98cb2990962a714f816157c3df612151 *tests/fanny-ex.R 85d898fa81b5e023c13783a71e3f2d26 *tests/fanny-ex.Rout.save b0a44d44e3394a7032e56178eab47bbf *tests/mona.R 9af49d734f91bdb910e058e9bdeefdcd *tests/mona.Rout.save 1602f86b7b3b703a2c20ae545df1bb85 *tests/pam.R 2de74c28817658f7e2eba1f72939dc57 *tests/pam.Rout.save 3a29bf13a18b047da2aeae4286a48591 *tests/silhouette-default.R 6defe0d6af8e75b40da302b4072bdec4 *tests/silhouette-default.Rout.save d9cdce1776e344a6f4f2574cee6ef487 *tests/sweep-ex.R cluster/po/0000755000176200001440000000000014764135160012360 5ustar liggesuserscluster/po/R-lt.po0000644000176200001440000003210614044453203013530 0ustar liggesusersmsgid "" msgstr "" "Project-Id-Version: cluster 2.1.1\n" "POT-Creation-Date: 2021-01-30 22:00\n" "PO-Revision-Date: 2021-05-05 10:17+0200\n" "Last-Translator: GabrielÄ— StupurienÄ— \n" "Language-Team: none\n" "Language: LT\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.4.2\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && (n%100<11 || n%100>19) ? 0 : n" "%10>=2 && n%10<=9 && (n%100<11 || n%100>19) ? 1 : 2);\n" msgid "invalid clustering method" msgstr "neleistinas grupavimo metodas" msgid "ambiguous clustering method" msgstr "neaiÅ¡kus klasterizavimo metodas" msgid "'par.method' must be of length 1, 3, or 4" msgstr "'par.method' turi bÅ«ti 1, 3 arba 4 ilgio" msgid "NA-values in the dissimilarity matrix not allowed." msgstr "NA reikÅ¡mÄ—s skirtumo matricoje neleidžiamos." msgid "'x' is not and cannot be converted to class \"dissimilarity\"" msgstr "'x' nÄ—ra ir negali bÅ«ti konvertuojamas į klasÄ™ \"dissimilarity\"" msgid "x is not a numeric dataframe or matrix." msgstr "x nÄ—ra skaitinÄ— duomenų sistema ar matrica." msgid "need at least 2 objects to cluster" msgstr "reikia bent 2 objektų į klasterį" msgid "No clustering performed, NA-values in the dissimilarity matrix." msgstr "Nebuvo atliktas grupavimas, NA reikÅ¡mÄ—s skirtumo matricoje." msgid "'x' is a \"dist\" object, but should be a data matrix or frame" msgstr "" "'x' yra \"dist\" objektas, bet turÄ—tų bÅ«ti duomenų matrica arba sistema" msgid "The number of cluster should be at least 1 and at most n-1." msgstr "" "Klasterio skaiÄius turi bÅ«ti ne mažesnis kaip 1 ir ne daugiau kaip n-1." msgid "'sampsize' should be at least %d = max(2, 1+ number of clusters)" msgstr "'sampsize' turi bÅ«ti bent %d = max(2, 1+ klasterių skaiÄius)" msgid "'sampsize' = %d should not be larger than the number of objects, %d" msgstr "'sampsize' = %d neturÄ—tų bÅ«ti didesnis už objektų skaiÄių, %d" msgid "'samples' should be at least 1" msgstr "'samples' turÄ—tų bÅ«ti ne mažesni kaip 1" msgid "when 'medoids.x' is FALSE, 'keep.data' must be too" msgstr "kai 'medoids.x' yra FALSE, 'keep.data' turi bÅ«ti taip pat" msgid "" "Distance computations with NAs: using correct instead of pre-2016 wrong " "formula.\n" "Use 'correct.d=FALSE' to get previous results or set 'correct.d=TRUE' " "explicitly\n" "to suppress this warning." msgstr "" "Atstumo skaiÄiavimai su NA: naudojant teisingÄ…, o ne iki 2016 m. neteisingÄ… " "formulÄ™.\n" "Naudokite 'correct.d=FALSE', kad gautumÄ—te ankstesnius rezultatus, arba " "aiÅ¡kiai nustatykite 'correct.d=TRUE', kad\n" " slÄ—pti šį įspÄ—jimÄ…." msgid "invalid 'correct.d'" msgstr "neleistinas 'correct.d'" msgid "" "Each of the random samples contains objects between which no distance can be " "computed." msgstr "" "Kiekviename atsitiktinių pavyzdžių sudÄ—tyje yra objektų, tarp kurių negalima " "apskaiÄiuoti atstumo." msgid "" "For each of the %d samples, at least one object was found which could not be " "assigned to a cluster (because of missing values)." msgstr "" "Kiekvienam iÅ¡ %d pavyzdžių buvo rastas bent vienas objektas, kurio nepavyko " "priskirti klasteriui (dÄ—l trÅ«kstamų reikÅ¡mių)." msgid "invalid 'jstop' from .C(cl_clara,.):" msgstr "negaliojantis 'jstop' iÅ¡ .C(cl_clara,.):" msgid "'B' has to be a positive integer" msgstr "'B' turi bÅ«ti teigiamas skaiÄius" msgid "invalid 'spaceH0':" msgstr "neleistinas 'spaceH0':" msgid "index has to be a function or a list of function" msgstr "indeksas turi bÅ«ti funkcija arba funkcijų sÄ…raÅ¡as" msgid "invalid 'twins' object" msgstr "neleistinas 'twins' objektas" msgid "x is not a dataframe or a numeric matrix." msgstr "x nÄ—ra duomenų sistema arba skaitinÄ— matrica." msgid "invalid %s; must be named list" msgstr "negaliojantys %s; turi bÅ«ti įvardytas sÄ…raÅ¡as" msgid "%s has invalid column names" msgstr "%s turi neleistinus stulpelių pavadinimus" msgid "%s must be in 1:ncol(x)" msgstr "%s turi bÅ«ti 1:ncol(x)" msgid "%s must contain column names or numbers" msgstr "%s turi bÅ«ti stulpelių pavadinimai arba skaiÄiai" msgid "at least one binary variable has more than 2 levels." msgstr "bent vienas dvejetainis kintamasis turi daugiau nei 2 lygius." msgid "at least one binary variable has not 2 different levels." msgstr "bent vienas dvejetainis kintamasis neturi 2 skirtingų lygių." msgid "at least one binary variable has values not in {0,1,NA}" msgstr "bent vieno dvejetainio kintamojo reikÅ¡mÄ—s nÄ—ra {0,1,NA}" msgid "binary variable(s) %s treated as interval scaled" msgstr "" "dvejetainis kintamasis (-ieji) %s traktuojamas (-i) kaip intervalo mastelis" msgid "%s has constant columns %s; these are standardized to 0" msgstr "%s turi pastovius stulpelius %s; jie standartizuojami į 0" msgid "with mixed variables, metric \"gower\" is used automatically" msgstr "su miÅ¡riais kintamaisiais, metrika \"gower\" naudojama automatiÅ¡kai" msgid "'weights' must be of length p (or 1)" msgstr "'weights' ilgis turi bÅ«ti p (arba 1)" msgid "invalid type %s for column numbers %s" msgstr "neleistinas tipas %s stulpelių numeriams %s" msgid "NA values in the dissimilarity matrix not allowed." msgstr "NA reikÅ¡mÄ—s skirtumo matricoje neleidžiamos." msgid "No clustering performed, NA's in dissimilarity matrix." msgstr "Nebuvo atliktas grupavimas, NA skirtumo matricoje." msgid "'x' must be numeric n x p matrix" msgstr "'x' turi bÅ«ti skaitinÄ— [n x p] matrica" msgid "omitting NAs" msgstr "praleidžiami NA" msgid "no points without missing values" msgstr "nÄ—ra taÅ¡kų be trÅ«kstamų reikÅ¡mių" msgid "computed some negative or all 0 probabilities" msgstr "apskaiÄiavo kai kurias neigiamas arba visas 0 tikimybes" msgid "algorithm possibly not converged in %d iterations" msgstr "algoritmas galbÅ«t nekonvergavo %d iteracijose" msgid "'A' must be p x p cov-matrix defining an ellipsoid" msgstr "'A' turi bÅ«ti [p x p] kovariacijos matrica, apibrėžianti elipsoidÄ…" msgid "ellipsoidPoints() not yet implemented for p >= 3 dim." msgstr "ellipsoidPoints() dar neįgyvendintas p > = 3 dim." msgid "'k' (number of clusters) must be in {1,2, .., n/2 -1}" msgstr "'k' (klasterių skaiÄius) turi bÅ«ti {1,2, .., n/2 -1}" msgid "'memb.exp' must be a finite number > 1" msgstr "'memb.exp' turi bÅ«ti baigtinis skaiÄius > 1" msgid "'maxit' must be non-negative integer" msgstr "'maxit' turi bÅ«ti ne neigiamas sveikasis skaiÄius" msgid "'iniMem.p' must be a nonnegative n * k matrix with rowSums == 1" msgstr "'iniMem.p' turi bÅ«ti ne neigiama [n * k] matrica su rowSums == 1" msgid "FANNY algorithm has not converged in 'maxit' = %d iterations" msgstr "FANNY algoritmas nekonvergavo 'maxit' = %d iteracijose" msgid "the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ?" msgstr "visos priklausomybÄ—s yra labai artimos 1/k. Gal sumažinti 'memb.exp' ?" msgid "'m', a membership matrix, must be nonnegative with rowSums == 1" msgstr "'m', priklausomybių matrica, turi bÅ«ti neneigiama su rowSums == 1" msgid "'n' must be >= 2" msgstr "'n' turi bÅ«ti >= 2" msgid "x must be a matrix or data frame." msgstr "x turi bÅ«ti matrica arba duomenų sistema." msgid "" "All variables must be binary (e.g., a factor with 2 levels, both present)." msgstr "" "Visi kintamieji turi bÅ«ti dvejetainiai (pvz., koeficientas su 2 lygiais)." msgid "mona() needs at least p >= 2 variables (in current implementation)" msgstr "mona() reikia bent p > = 2 kintamųjų (dabartiniame įgyvendinime)" msgid "No clustering performed, an object was found with all values missing." msgstr "" "Grupavimas nebuvo atliktas, rastas objektas su visomis trÅ«kstamomis " "reikÅ¡mÄ—mis." msgid "" "No clustering performed, found variable with more than half values missing." msgstr "" "Nebuvo atliktas grupavimas, rastas kintamasis, kuriame trÅ«ksta daugiau nei " "pusÄ—s reikÅ¡mių." msgid "" "No clustering performed, a variable was found with all non missing values " "identical." msgstr "" "Grupavimas neatliktas, rastas kintamasis su visomis identiÅ¡komis " "netrÅ«kstamomis reikÅ¡mÄ—mis." msgid "No clustering performed, all variables have at least one missing value." msgstr "" "Grupavimas nebuvo atliktas, visi kintamieji turi bent vienÄ… trÅ«kstamÄ… " "reikÅ¡mÄ™." msgid "Cannot keep data when 'x' is a dissimilarity!" msgstr "Negalima saugoti duomenų, kai 'x' yra skirtumas!" msgid "have %d observations, but not more than %d are allowed" msgstr "turi %d pastabų, taÄiau leidžiama ne daugiau kaip %d" msgid "Number of clusters 'k' must be in {1,2, .., n-1}; hence n >= 2" msgstr "Klasterių skaiÄius 'k' turi bÅ«ti {1,2, .., n-1}; taigi n >= 2" msgid "Set either 'variant' or 'pamonce', but not both" msgstr "Nustatykite 'variant' arba 'pamonce', bet ne abu" msgid "" "'medoids' must be NULL or vector of %d distinct indices in {1,2, .., n}, n=%d" msgstr "'medoids' turi bÅ«ti NULL arba %d indeksai { 1,2, .., n}, n=%d" msgid "No clustering performed, NAs in the computed dissimilarity matrix." msgstr "Nebuvo atliktas grupavimas, NA apskaiÄiuotoje skirtumo matricoje." msgid "error from .C(cl_pam, *): invalid medID's" msgstr "klaida iÅ¡ . C(cl_pam, *): negaliojantis medID" msgid "NA-values are not allowed in dist-like 'x'." msgstr "NA reikÅ¡mÄ—s neleidžiamos dist kaip 'x'." msgid "Distances must be result of dist or a square matrix." msgstr "Atstumai turi bÅ«ti dist rezultatas arba kvadratinÄ— matrica." msgid "the square matrix is not symmetric." msgstr "kvadratinÄ— matrica nÄ—ra simetriÅ¡ka." msgid ">>>>> funny case in clusplot.default() -- please report!" msgstr ">>>>> keistas atvejis clusplot.default() - praÅ¡ome praneÅ¡ti!" msgid "x is not a data matrix" msgstr "x nÄ—ra duomenų matrica" msgid "one or more objects contain only missing values" msgstr "viename ar daugiau objektų yra tik trÅ«kstamos reikÅ¡mÄ—s" msgid "one or more variables contain only missing values" msgstr "viename ar daugiau kintamųjų yra tik trÅ«kstamos reikÅ¡mÄ—s" msgid "" "Missing values were displaced by the median of the corresponding variable(s)" msgstr "" "TrÅ«kstamos reikÅ¡mÄ—s buvo perkeltos iÅ¡ atitinkamo (-ų) kintamojo (-ų) medianos" msgid "x is not numeric" msgstr "x nÄ—ra skaitinis" msgid "The clustering vector is of incorrect length" msgstr "Grupavimo vektorius yra netinkamo ilgio" msgid "NA-values are not allowed in clustering vector" msgstr "NA reikÅ¡mÄ—s neleidžiamos grupavimo vektoriuje" msgid "" "Error in C routine for the spanning ellipsoid,\n" " rank problem??" msgstr "" "AprÄ—pianÄio elipsoido, esanÄio C programoje klaida,\n" " rango problema??" msgid "'col.clus' should have length 4 when color is TRUE" msgstr "'col.clus' turi bÅ«ti ilgis 4, kai spalva yra TRUE" msgid "no diss nor data found, nor the original argument of %s" msgstr "nerasta nei diss, nei duomenų, nei pradinio %s argumento" msgid "no diss nor data found for clusplot()'" msgstr "nerasta jokių diss ir clusplot()' duomenų" msgid "invalid partition object" msgstr "neleistinas skaidinio objektas" msgid "" "full silhouette is only available for results of 'clara(*, keep.data = TRUE)'" msgstr "" "visas siluetas prieinamas tik 'clara(*, keep.data = TRUE)' rezultatams." msgid "specified both 'full' and 'subset'; will use 'subset'" msgstr "nurodyti abu 'full' ir 'subset'; bus naudojamas 'subset'" msgid "'full' must be FALSE, TRUE, or a number in [0, 1]" msgstr "'full' turi bÅ«ti FALSE, TRUE arba skaiÄius [0, 1]" msgid "'x' must only have integer codes" msgstr "'x' turi turÄ—ti tik sveikuosius kodus" msgid "Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'" msgstr "Reikia arba skirtumo 'dist' arba diss.matrix 'dmatrix'" msgid "'dmatrix' is not a dissimilarity matrix compatible to 'x'" msgstr "'dmatrix' nÄ—ra skirtumų matrica, suderinama su 'x'" msgid "clustering 'x' and dissimilarity 'dist' are incompatible" msgstr "grupavimas 'x' ir skirtumas 'dist' yra nesuderinami" msgid "invalid silhouette structure" msgstr "netinkama silueto struktÅ«ra" msgid "invalid 'silhouette' object" msgstr "neleistinas 'silhouette' objektas" msgid "No valid silhouette information (#{clusters} =? 1)" msgstr "NÄ—ra galiojanÄios silueto informacijos (#{clusters} =? 1)" msgid "Observation %s has *only* NAs --> omit it for clustering" msgid_plural "Observations %s have *only* NAs --> omit them for clustering!" msgstr[0] "StebÄ—jimas %s turi * tik * NA -- > praleisti jį grupavimui" msgstr[1] "StebÄ—jimai %s turi * tik * NA -- > praleisti jį grupavimui!" msgstr[2] "StebÄ—jimų %s turi * tik * NA -- > praleisti jį grupavimui!" msgid "%d observation (%s) has *only* NAs --> omit them for clustering!" msgid_plural "" "%d observations (%s ...) have *only* NAs --> omit them for clustering!" msgstr[0] "%d stebÄ—jimas (%s) turi * tik * NA -- > praleisti juos grupavimui!" msgstr[1] "%d stebÄ—jimai (%s) turi * tik * NA -- > praleisti juos grupavimui!" msgstr[2] "%d stebÄ—jimų (%s) turi * tik * NA -- > praleisti juos grupavimui!" msgid "setting 'logical' variable %s to type 'asymm'" msgid_plural "setting 'logical' variables %s to type 'asymm'" msgstr[0] "'logical' kintamojo %s nustatymas į tipÄ… 'asymm'" msgstr[1] "'logical' kintamųjų %s nustatymas į tipÄ… 'asymm'" msgstr[2] "'logical' kintamųjų %s nustatymas į tipÄ… 'asymm'" cluster/po/ko.po0000644000176200001440000000330414005347355013330 0ustar liggesusers# Korean translations for cluster package. # Recommended/cluster/po/ko.po # Maintainer: Martin Maechler # # This file is distributed under the same license as the R cluster package. # Chel Hee Lee , 2013-2015. # Reviewing process is completed (15-JAN-2015) # QC: PASS # Freezing on 06-FEB-2015 for R-3.1.3 # msgid "" msgstr "" "Project-Id-Version: cluster 1.15.2\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-30 22:00+0100\n" "PO-Revision-Date: 2015-02-06 21:56-0600\n" "Last-Translator:Chel Hee Lee \n" "Language-Team: Chel Hee Lee \n" "Language: ko\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" #: clara.c:101 #, c-format msgid "C level clara(): random k=%d > n **\n" msgstr "C level clara(): random k=%d > n **\n" #: clara.c:312 #, c-format msgid "" "clara()'s C level dysta2(nsam=%d, p=%d, nbest=%d, n=%d) gave 'toomany_NA'" msgstr "" "clara()'s C level dysta2(nsam=%d, p=%d, nbest=%d, n=%d) gave 'toomany_NA'" #: clara.c:348 clara.c:353 #, c-format msgid "C level dysta2(): nsel[%s= %d] = %d is outside 0..n, n=%d" msgstr "C level dysta2(): nsel[%s= %d] = %d is outside 0..n, n=%d" #: pam.c:161 msgid "Invalid 'medoids'" msgstr "" #: pam.c:1011 #, c-format msgid "pam(): Bug in C level cstat(), k=%d: ntt=0" msgstr "pam(): Bug in C level cstat(), k=%d: ntt=0" #: twins.c:153 #, c-format msgid "" "agnes(method=%d, par.method=*) lead to invalid merge; step %d, D(.,.)=%g" msgstr "" #: twins.c:260 #, c-format msgid "invalid method (code %d)" msgstr "메소드가 올바르지 않습니다 (code %d)." cluster/po/de.po0000644000176200001440000000326514005347355013315 0ustar liggesusers# # Translation of src/library/Recommended/cluster/po/cluster.pot to German # # Copyright (C) 2013 The R Foundation # # This file is distributed under the same license as the R package. # # Detlef Steuer , 2013-2015. msgid "" msgstr "" "Project-Id-Version: cluster 2.0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-30 22:00+0100\n" "PO-Revision-Date: 2015-02-02 12:30+0100\n" "Last-Translator: Detlef Steuer \n" "Language-Team: R Core \n" "Language: DE\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1;\n" #: clara.c:101 #, c-format msgid "C level clara(): random k=%d > n **\n" msgstr "C Level clara(): random k=%d > n **\n" #: clara.c:312 #, c-format msgid "" "clara()'s C level dysta2(nsam=%d, p=%d, nbest=%d, n=%d) gave 'toomany_NA'" msgstr "" "clara()'s C Level dysta2(nsam=%d, p=%d, nbest=%d, n=%d) ergab 'toomany_NA'" #: clara.c:348 clara.c:353 #, c-format msgid "C level dysta2(): nsel[%s= %d] = %d is outside 0..n, n=%d" msgstr "C Level dysta2(): nsel[%s= %d] = %d ist außerhalb von 0..n, n=%d" #: pam.c:161 msgid "Invalid 'medoids'" msgstr "unzulässige 'medoids'" #: pam.c:1011 #, c-format msgid "pam(): Bug in C level cstat(), k=%d: ntt=0" msgstr "pam(): Bug in C Level cstat(), k=%d: ntt=0" #: twins.c:153 #, c-format msgid "" "agnes(method=%d, par.method=*) lead to invalid merge; step %d, D(.,.)=%g" msgstr "" "agnes(method=%d, par.method=*) führte zu unzulässigem Zusammenfassen;\n" "Schritt %d, D(.,.)=%g" #: twins.c:260 #, c-format msgid "invalid method (code %d)" msgstr "unzulässige Methode (Kode %d)" cluster/po/update-me.sh0000755000176200001440000000224014465512654014603 0ustar liggesusers#!/bin/sh # #__>> Keep in sync with ~/R/Pkgs/Matrix/po/update-me.sh <<__ # ## Script for updating package-specific *.pot files ## written such that it should work for any package # R=${R:-R} thisdir=`dirname $0` ; cd $thisdir; thisdir=`pwd` echo "R = '$R' (`$R --version | head -1`) preliminary thisdir='$thisdir'" pkgDIR=`dirname $thisdir` pkg=`basename $pkgDIR` echo ' --> pkgDIR='$pkgDIR' ; pkg='$pkg # echo ''; echo '## FIXME ## use new Scheme from R 3.0.x on' # cd `$R RHOME`/po # make pkg-update PKG=$pkg PKGDIR=$pkgDIR L=update.log Rcd="require('tools'); update_pkg_po('$pkgDIR')" ## -------------------------------- as of R 3.0.0 echo $Rcd > $L echo $Rcd | $R --no-echo 2>&1 | tee -a $L echo 'end{make pkg-update}' ; echo '' echo 'Test with (e.g.)' echo ' LANGUAGE=de R --no-environ --no-save' ; echo '' echo 'and then something like' echo ' Matrix(1:6, 2,3) %*% Matrix(1:4, 2)'; echo '' echo 'Do check that you did *not* forget one of the *.po or generated *.mo files, via'; echo '' echo " svn st -v po inst/po | grep '^?'"; echo '' echo 'and commit with something like' echo " svn ci -m'updated for translators' po inst/po"; echo '' cluster/po/R-cluster.pot0000644000176200001440000001633514671755145015004 0ustar liggesusersmsgid "" msgstr "" "Project-Id-Version: cluster 2.1.3\n" "POT-Creation-Date: 2021-08-19 20:27\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" msgid "invalid clustering method" msgstr "" msgid "ambiguous clustering method" msgstr "" msgid "'par.method' must be of length 1, 3, or 4" msgstr "" msgid "NA-values in the dissimilarity matrix not allowed." msgstr "" msgid "'x' is not and cannot be converted to class \"dissimilarity\"" msgstr "" msgid "'x' is not a numeric dataframe or matrix." msgstr "" msgid "need at least 2 objects to cluster" msgstr "" msgid "No clustering performed, NA-values in the dissimilarity matrix." msgstr "" msgid "'x' is a \"dist\" object, but should be a data matrix or frame" msgstr "" msgid "The number of cluster should be at least 1 and at most n-1." msgstr "" msgid "'sampsize' should be at least %d = max(2, 1+ number of clusters)" msgstr "" msgid "'sampsize' = %d should not be larger than the number of objects, %d" msgstr "" msgid "'samples' should be at least 1" msgstr "" msgid "when 'medoids.x' is FALSE, 'keep.data' must be too" msgstr "" msgid "Distance computations with NAs: using correct instead of pre-2016 wrong formula.\nUse 'correct.d=FALSE' to get previous results or set 'correct.d=TRUE' explicitly\nto suppress this warning." msgstr "" msgid "invalid 'correct.d'" msgstr "" msgid "Each of the random samples contains objects between which no distance can be computed." msgstr "" msgid "For each of the %d samples, at least one object was found which could not be assigned to a cluster (because of missing values)." msgstr "" msgid "invalid 'jstop' from .C(cl_clara,.):" msgstr "" msgid "'B' has to be a positive integer" msgstr "" msgid "invalid 'spaceH0':" msgstr "" msgid "index has to be a function or a list of function" msgstr "" msgid "invalid 'twins' object" msgstr "" msgid "x is not a dataframe or a numeric matrix." msgstr "" msgid "invalid %s; must be named list" msgstr "" msgid "%s has invalid column names" msgstr "" msgid "%s must be in 1:ncol(x)" msgstr "" msgid "%s must contain column names or numbers" msgstr "" msgid "at least one binary variable has more than 2 levels." msgstr "" msgid "at least one binary variable has not 2 different levels." msgstr "" msgid "at least one binary variable has values not in {0,1,NA}" msgstr "" msgid "binary variable(s) %s treated as interval scaled" msgstr "" msgid "%s has constant columns %s; these are standardized to 0" msgstr "" msgid "with mixed variables, metric \"gower\" is used automatically" msgstr "" msgid "'weights' must be of length p (or 1)" msgstr "" msgid "invalid type %s for column numbers %s" msgstr "" msgid "NA values in the dissimilarity matrix not allowed." msgstr "" msgid "No clustering performed, NA's in dissimilarity matrix." msgstr "" msgid "'x' must be numeric n x p matrix" msgstr "" msgid "omitting NAs" msgstr "" msgid "no points without missing values" msgstr "" msgid "computed some negative or all 0 probabilities" msgstr "" msgid "algorithm possibly not converged in %d iterations" msgstr "" msgid "'A' must be p x p cov-matrix defining an ellipsoid" msgstr "" msgid "ellipsoidPoints() not yet implemented for p >= 3 dim." msgstr "" msgid "'k' (number of clusters) must be in {1,2, .., n/2 -1}" msgstr "" msgid "'memb.exp' must be a finite number > 1" msgstr "" msgid "'maxit' must be non-negative integer" msgstr "" msgid "'iniMem.p' must be a nonnegative n * k matrix with rowSums == 1" msgstr "" msgid "FANNY algorithm has not converged in 'maxit' = %d iterations" msgstr "" msgid "the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ?" msgstr "" msgid "'m', a membership matrix, must be nonnegative with rowSums == 1" msgstr "" msgid "'n' must be >= 2" msgstr "" msgid "x must be a matrix or data frame." msgstr "" msgid "All variables must be binary (e.g., a factor with 2 levels, both present)." msgstr "" msgid "mona() needs at least p >= 2 variables (in current implementation)" msgstr "" msgid "No clustering performed, an object was found with all values missing." msgstr "" msgid "No clustering performed, found variable with more than half values missing." msgstr "" msgid "No clustering performed, a variable was found with all non missing values identical." msgstr "" msgid "No clustering performed, all variables have at least one missing value." msgstr "" msgid "Cannot keep data when 'x' is a dissimilarity!" msgstr "" msgid "have %d observations, but not more than %d are allowed" msgstr "" msgid "Number of clusters 'k' must be in {1,2, .., n-1}; hence n >= 2" msgstr "" msgid "Set either 'variant' or 'pamonce', but not both" msgstr "" msgid "'medoids' must be NULL or vector of %d distinct indices in {1,2, .., n}, n=%d" msgstr "" msgid "No clustering performed, NAs in the computed dissimilarity matrix." msgstr "" msgid "error from .C(cl_pam, *): invalid medID's" msgstr "" msgid "NA-values are not allowed in dist-like 'x'." msgstr "" msgid "Distances must be result of dist or a square matrix." msgstr "" msgid "the square matrix is not symmetric." msgstr "" msgid ">>>>> funny case in clusplot.default() -- please report!" msgstr "" msgid "x is not a data matrix" msgstr "" msgid "one or more objects contain only missing values" msgstr "" msgid "one or more variables contain only missing values" msgstr "" msgid "Missing values were displaced by the median of the corresponding variable(s)" msgstr "" msgid "x is not numeric" msgstr "" msgid "The clustering vector is of incorrect length" msgstr "" msgid "NA-values are not allowed in clustering vector" msgstr "" msgid "Error in C routine for the spanning ellipsoid,\n rank problem??" msgstr "" msgid "'col.clus' should have length 4 when color is TRUE" msgstr "" msgid "no diss nor data found, nor the original argument of %s" msgstr "" msgid "no diss nor data found for 'clusplot()'" msgstr "" msgid "invalid partition object" msgstr "" msgid "full silhouette is only available for results of 'clara(*, keep.data = TRUE)'" msgstr "" msgid "specified both 'full' and 'subset'; will use 'subset'" msgstr "" msgid "'full' must be FALSE, TRUE, or a number in [0, 1]" msgstr "" msgid "'x' must only have integer codes" msgstr "" msgid "Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'" msgstr "" msgid "'dmatrix' is not a dissimilarity matrix compatible to 'x'" msgstr "" msgid "clustering 'x' and dissimilarity 'dist' are incompatible" msgstr "" msgid "invalid silhouette structure" msgstr "" msgid "invalid 'silhouette' object" msgstr "" msgid "No valid silhouette information (#{clusters} =? 1)" msgstr "" msgid "Observation %s has *only* NAs --> omit it for clustering" msgid_plural "Observations %s have *only* NAs --> omit them for clustering!" msgstr[0] "" msgstr[1] "" msgid "%d observation (%s) has *only* NAs --> omit them for clustering!" msgid_plural "%d observations (%s ...) have *only* NAs --> omit them for clustering!" msgstr[0] "" msgstr[1] "" msgid "setting 'logical' variable %s to type 'asymm'" msgid_plural "setting 'logical' variables %s to type 'asymm'" msgstr[0] "" msgstr[1] "" cluster/po/R-fr.po0000644000176200001440000003601514036313671013530 0ustar liggesusers# Translation of src/library/Recommended/cluster/po/R-cluster.pot to German # Copyright (C) 2013 The R Foundation # This file is distributed under the same license as the R package. # Philippe.Grosjean@umons.ac.be, 2014-2021 msgid "" msgstr "" "Project-Id-Version: cluster 1.14.5\n" "POT-Creation-Date: 2021-01-30 22:00\n" "PO-Revision-Date: 2021-04-12 18:49+0200\n" "Last-Translator: Philippe Grosjean \n" "Language-Team: none\n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.4.2\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" msgid "invalid clustering method" msgstr "méthode d'agrégation incorrecte" msgid "ambiguous clustering method" msgstr "méthode d'agrégation ambigüe" msgid "'par.method' must be of length 1, 3, or 4" msgstr "'par.method' doit être de longueur 1, 3 ou 4" msgid "NA-values in the dissimilarity matrix not allowed." msgstr "Les valeurs manquantes (NA) ne sont pas autorisées dans la matrice de dissimilarité." msgid "'x' is not and cannot be converted to class \"dissimilarity\"" msgstr "'x' n'est pas et ne peux pas être converti en un objet de classe \"dissimilarity\"" msgid "x is not a numeric dataframe or matrix." msgstr "x n'est pas un tableau de données (data frame) ou une matrice numérique." msgid "need at least 2 objects to cluster" msgstr "au moins deux objets sont nécessaires pour effectuer une agrégation" msgid "No clustering performed, NA-values in the dissimilarity matrix." msgstr "Aucune agrégation n'est réalisée, présence de NAs dans la matrice de dissimilarité." msgid "'x' is a \"dist\" object, but should be a data matrix or frame" msgstr "'x' est un objet \"dist\", mais il faut une matrice ou un tableau de données" msgid "The number of cluster should be at least 1 and at most n-1." msgstr "Le nombre de groupes doit être entre 1 et n-1 compris." msgid "'sampsize' should be at least %d = max(2, 1+ number of clusters)" msgstr "'sampsize' doit être au minimum %d = max(2, 1+ nombre de groupes)" msgid "'sampsize' = %d should not be larger than the number of objects, %d" msgstr "'sampsize' = %d ne peut être plus grand que le nombre d'objets, %d" msgid "'samples' should be at least 1" msgstr "'samples' doit valoir au moins 1" msgid "when 'medoids.x' is FALSE, 'keep.data' must be too" msgstr "lorsque 'medoids.x' est FALSE, 'keep.data' doit l'être aussi" msgid "" "Distance computations with NAs: using correct instead of pre-2016 wrong formula.\n" "Use 'correct.d=FALSE' to get previous results or set 'correct.d=TRUE' explicitly\n" "to suppress this warning." msgstr "" "Calcul de distances avec NAs : utilisation de la formule corrigée à la place de celle d’avant 2016 qui était erronnée.\n" "Utilisez 'correct.d=FALSE' pour obtenir les résultats d'avant, ou indiquez 'correct.d=TRUE' de manière explicite\n" "pour éliminer cet avis." msgid "invalid 'correct.d'" msgstr "'correct.d' incorrect" msgid "Each of the random samples contains objects between which no distance can be computed." msgstr "Chacun des échantillons aléatoires contient des objets entre lesquels aucune distance ne peut être calculée." msgid "For each of the %d samples, at least one object was found which could not be assigned to a cluster (because of missing values)." msgstr "Dans chacun des %d échantillons, au moins un objet ne peut être assigné à un groupe (parce qu'il contient des valeurs manquantes)" msgid "invalid 'jstop' from .C(cl_clara,.):" msgstr "'jstop' incorrect obtenu de .C(cl_clara,.) :" msgid "'B' has to be a positive integer" msgstr "'B' doit être un entier positif" msgid "invalid 'spaceH0':" msgstr "'spaceH0' incorrect :" msgid "index has to be a function or a list of function" msgstr "index doit être une fonction ou une liste de fonctions" msgid "invalid 'twins' object" msgstr "objet 'twins' incorrect" msgid "x is not a dataframe or a numeric matrix." msgstr "x n'est pas un tableau de données (data frame) ni une matrice numérique." msgid "invalid %s; must be named list" msgstr "%s incorrect ; doit être une liste nommée" msgid "%s has invalid column names" msgstr "%s a des noms de colonnes incorrects" msgid "%s must be in 1:ncol(x)" msgstr "%s doit être compris dans 1:ncol(x)" msgid "%s must contain column names or numbers" msgstr "%s doit contenir des noms de colonnes ou des nombres" msgid "at least one binary variable has more than 2 levels." msgstr "une des variables binaires au moins a plus de deux niveaux." msgid "at least one binary variable has not 2 different levels." msgstr "une des variables binaires au moins n'a pas deux niveaux." msgid "at least one binary variable has values not in {0,1,NA}" msgstr "une des variables binaires au moins a des valeurs autres que {0,1,NA}" msgid "binary variable(s) %s treated as interval scaled" msgstr "la ou les variables binaires %s sont traitées comme des intervalles standardisés" msgid "%s has constant columns %s; these are standardized to 0" msgstr "%s a des colonnes constantes %s ; elles sont standardisées à 0" msgid "with mixed variables, metric \"gower\" is used automatically" msgstr "avec des variables mélangées, la métrique \"gower\" est utilisée automatiquement" msgid "'weights' must be of length p (or 1)" msgstr "'weights' doit être de longueur p (ou 1)" msgid "invalid type %s for column numbers %s" msgstr "type invalide %s pour les numéros de colonnes %s" msgid "NA values in the dissimilarity matrix not allowed." msgstr "Les valeurs manquantes (NA) ne sont pas admises dans la matrice de dissimilarité." msgid "No clustering performed, NA's in dissimilarity matrix." msgstr "Aucune agrégation n'est réalisée, NAs dans la matrice de dissimilarité." msgid "'x' must be numeric n x p matrix" msgstr "'x' doit être une matrice numérique n x p" msgid "omitting NAs" msgstr "valeurs NAs ignorées" msgid "no points without missing values" msgstr "aucun point sans valeurs manquantes" msgid "computed some negative or all 0 probabilities" msgstr "des probabilités négatives ou toutes égales à zéro ont été calculées" msgid "algorithm possibly not converged in %d iterations" msgstr "l'algorithme n'a vraisemblablement pas convergé en %d itérations" msgid "'A' must be p x p cov-matrix defining an ellipsoid" msgstr "'A doit être une matrice de covariance p x p définissant un ellipsoïde" msgid "ellipsoidPoints() not yet implemented for p >= 3 dim." msgstr "ellipsoidPoints() pas encore implémenté pour p >= 3 dim." msgid "'k' (number of clusters) must be in {1,2, .., n/2 -1}" msgstr "'k' (nombre de groupes) doit être {1,2,…, n/2 -1}" msgid "'memb.exp' must be a finite number > 1" msgstr "'memb.exp' doit être un nombre fini > 1" msgid "'maxit' must be non-negative integer" msgstr "'maxit' doit être un entier non négatif" msgid "'iniMem.p' must be a nonnegative n * k matrix with rowSums == 1" msgstr "'iniMem.p' doit être une matrice n * k non négative avec rowSums == 1" msgid "FANNY algorithm has not converged in 'maxit' = %d iterations" msgstr "L’algorithme FANNY n'a pas convergé en 'maxit' = %d itérations" msgid "the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ?" msgstr "les appartenances sont toutes très proches de 1/k. Essayez en diminuant 'memb.exp' ?" msgid "'m', a membership matrix, must be nonnegative with rowSums == 1" msgstr "'m', une matrice d'appartenance, doit être non négative avec rowSums == 1" msgid "'n' must be >= 2" msgstr "'n' doit être >= 2" msgid "x must be a matrix or data frame." msgstr "x doit être une matrice ou un tableau de données (data frame)." msgid "All variables must be binary (e.g., a factor with 2 levels, both present)." msgstr "Toutes les variables doivent être booléennes (c'est-à-dire, des variables facteur à 2 niveaux présents)." msgid "mona() needs at least p >= 2 variables (in current implementation)" msgstr "mona() a besoin d'au moins p >= 2 variables (dans l'implémentation actuelle)" msgid "No clustering performed, an object was found with all values missing." msgstr "Aucune agrégation n'a été effectuée, un objet a toutes ses valeurs manquantes." msgid "No clustering performed, found variable with more than half values missing." msgstr "Aucune agrégation n'a été effectuée, une variable a plus de la moitié de ses valeurs manquantes." msgid "No clustering performed, a variable was found with all non missing values identical." msgstr "Aucune agrégation n'a été effectuée, une variable a toutes ses valeurs non manquantes identiques." msgid "No clustering performed, all variables have at least one missing value." msgstr "Aucune agrégation n'a été effectuée, toutes les variables ont au moins une valeur manquante." msgid "Cannot keep data when 'x' is a dissimilarity!" msgstr "Impossible de conserver les données lorsque 'x' est un objet dissimilarity !" msgid "have %d observations, but not more than %d are allowed" msgstr "il y a %d observations, mais pas plus de %d sont acceptées" msgid "Number of clusters 'k' must be in {1,2, .., n-1}; hence n >= 2" msgstr "Le nombre de groupes 'k' doit être dans {1,2, …, n-1} ; où n >= 2" msgid "Set either 'variant' or 'pamonce', but not both" msgstr "Spécifiez soit 'variant’, soit 'pamonce’, mais pas les deux en même temps" msgid "'medoids' must be NULL or vector of %d distinct indices in {1,2, .., n}, n=%d" msgstr "'medoids' doit être NULL ou un vecteur de %d valeurs d'indices distincts dans {1, 2, …, n}, n=%d" msgid "No clustering performed, NAs in the computed dissimilarity matrix." msgstr "Aucune agrégation n'a été effectuée, NAs dans la matrice de dissimilarité calculée." msgid "error from .C(cl_pam, *): invalid medID's" msgstr "erreur depuis .C(cl_pam, *) : medIDs incorrects" msgid "NA-values are not allowed in dist-like 'x'." msgstr "Les valeurs manquantes NA ne sont pas autorisées dans 'x' de type dist." msgid "Distances must be result of dist or a square matrix." msgstr "Les distances doivent résulter d'un objet dist ou d'une matrice carrée." msgid "the square matrix is not symmetric." msgstr "la matrice carrée n'est pas symétrique." msgid ">>>>> funny case in clusplot.default() -- please report!" msgstr ">>>>> cas pathologique dans clusplot.default() -- veuillez envoyer un rapport de bogue !" msgid "x is not a data matrix" msgstr "x n'est pas une matrice de données" msgid "one or more objects contain only missing values" msgstr "un ou plusieurs objets ne contiennent que des valeurs manquantes" msgid "one or more variables contain only missing values" msgstr "une ou plusieurs variables ne contiennent que des valeurs manquantes" msgid "Missing values were displaced by the median of the corresponding variable(s)" msgstr "Les valeurs manquantes ont été remplacées par la médiane de la ou des variables correspondantes" msgid "x is not numeric" msgstr "x n'est pas numérique" msgid "The clustering vector is of incorrect length" msgstr "Le vecteur d'agrégation est de longueur incorrecte" msgid "NA-values are not allowed in clustering vector" msgstr "Les valeurs manquantes NA ne sont pas autorisées dans le vecteur d'agrégation" msgid "" "Error in C routine for the spanning ellipsoid,\n" " rank problem??" msgstr "" "Erreur dans la routine C pour obtenir l'ellipsoïde de dispersion,\n" " problème de rang ??" msgid "'col.clus' should have length 4 when color is TRUE" msgstr "'col.clus' doit avoir une longueur de 4 lorsque color est TRUE" msgid "no diss nor data found, nor the original argument of %s" msgstr "pas de diss ni de données trouvées, ni même l'argument original de %s" msgid "no diss nor data found for clusplot()'" msgstr "pas de diss ni de données trouvées pour clusplot()'" msgid "invalid partition object" msgstr "objet de partitionnement incorrect" msgid "full silhouette is only available for results of 'clara(*, keep.data = TRUE)'" msgstr "la silhouette complète n'est disponible que pour les résultats de 'clara(*, keep.data = TRUE)'" msgid "specified both 'full' and 'subset'; will use 'subset'" msgstr "'full' et 'subset' tous deux spécifiés ; utilisation de 'subset’" msgid "'full' must be FALSE, TRUE, or a number in [0, 1]" msgstr "'full' doit être parmi FALSE, TRUE, ou un nombre de l’intervalle [0, 1]" msgid "'x' must only have integer codes" msgstr "'x' ne doit avoir que des codes entiers" msgid "Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'" msgstr "Il faut soit un objet 'dist' de dissimilarité ou une matrice de dissimilarité 'dmatrix'" msgid "'dmatrix' is not a dissimilarity matrix compatible to 'x'" msgstr "'dmatrix' n'est pas une matrice de dissimilarité compatible avec 'x'" msgid "clustering 'x' and dissimilarity 'dist' are incompatible" msgstr "l'agrégation 'x' et la matrice de dissimilarité 'dist' sont incompatibles" msgid "invalid silhouette structure" msgstr "structure de silhouette incorrecte" msgid "invalid 'silhouette' object" msgstr "objet 'silhouette' incorrect" msgid "No valid silhouette information (#{clusters} =? 1)" msgstr "Aucune valeur de silhouette n'est correcte (#{groupes} =? 1)" msgid "Observation %s has *only* NAs --> omit it for clustering" msgid_plural "Observations %s have *only* NAs --> omit them for clustering!" msgstr[0] "L'observation %s n'a *que* des NAs --> ignorée pour le regroupement" msgstr[1] "Les observations %s n'ont *que* des NAs --> ignorées pour le regroupement!" msgid "%d observation (%s) has *only* NAs --> omit them for clustering!" msgid_plural "%d observations (%s ...) have *only* NAs --> omit them for clustering!" msgstr[0] "%d observation (%s) n'a *que* des NAs --> ignorée pour le regroupement!" msgstr[1] "%d observations (%s) n'ont *que* des NAs --> ignorées pour le regroupement!" msgid "setting 'logical' variable %s to type 'asymm'" msgid_plural "setting 'logical' variables %s to type 'asymm'" msgstr[0] "la variable 'logical' %s est transformée en type 'asymm'" msgstr[1] "les variables 'logical' %s sont transformées en type 'asymm'" #~ msgid "NAdiss" #~ msgstr "NAdiss" #~ msgid "non.diss" #~ msgstr "non.diss" #~ msgid "no distance can be computed." #~ msgstr "aucune distance n'a été calculée." #~ msgid "For each of the" #~ msgstr "Pour chacun des" #~ msgid "" #~ "samples, at least one object was found which\n" #~ " could not" #~ msgstr "" #~ "échantillons, au moins un objet a été trouvé qui\n" #~ " ne peut" #~ msgid "be assigned to a cluster (because of missing values)." #~ msgstr "être assigné à un groupe (à cause de valeurs manquantes)." #~ msgid "invalid" #~ msgstr "incorrect" #~ msgid "type" #~ msgstr "type" #~ msgid "type$" #~ msgstr "type$" #~ msgid "binary variable(s)" #~ msgstr "variable(s) binaire(s)" #~ msgid "x" #~ msgstr "x" #~ msgid "has constant columns" #~ msgstr "a des colonnes constantes" #~ msgid "possibly not converged in" #~ msgstr "probablement pas de convergence en" #~ msgid "iterations" #~ msgstr "itérations" #~ msgid "'medoids' must be NULL or vector of" #~ msgstr "'medoids' doit être NULL ou un vecteur de" #~ msgid "rank problem??" #~ msgstr "problème de rang ??" #~ msgid "'clara(*, keep.data = TRUE)'" #~ msgstr "'clara(*, keep.data = TRUE)'" cluster/po/R-it.po0000644000176200001440000003233614035543433013537 0ustar liggesusers# R Italian translation # Copyright (C) The R Foundation # This file is distributed under the same license as the R package. # Daniele Medri , 2005-2021. # msgid "" msgstr "" "Project-Id-Version: R-cluster 2.0.8\n" "Report-Msgid-Bugs-To: bugs.r-project.org\n" "POT-Creation-Date: 2021-01-30 22:00\n" "PO-Revision-Date: \n" "Last-Translator: Daniele Medri \n" "Language-Team: Italian https://github.com/dmedri/R-italian-lang\n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 2.2.1\n" msgid "invalid clustering method" msgstr "metodo di clustering non valido" msgid "ambiguous clustering method" msgstr "metodo di clustering ambiguo" msgid "'par.method' must be of length 1, 3, or 4" msgstr "'par.method' dev'essere di lunghezza 1, 3 o 4" msgid "NA-values in the dissimilarity matrix not allowed." msgstr "I valori NA non sono ammessi in una matrice di dissimilarità." msgid "'x' is not and cannot be converted to class \"dissimilarity\"" msgstr "'x' non è e non può essere convertito alla classe \"dissimilarity\"" msgid "x is not a numeric dataframe or matrix." msgstr "x non è un data frame o una matrice numerica." msgid "need at least 2 objects to cluster" msgstr "richiede almeno 2 oggetti per l'analisi cluster" msgid "No clustering performed, NA-values in the dissimilarity matrix." msgstr "Nessun cluster generato, valori NA nella matrice di dissomiglianza." msgid "'x' is a \"dist\" object, but should be a data matrix or frame" msgstr "" "'x' è un oggetto \"dist\", ma dovrebbe essere un data frame o una matrice" msgid "The number of cluster should be at least 1 and at most n-1." msgstr "Il numerod i cluster dovrebbe essere almeno 1 e al massimo n-1." msgid "'sampsize' should be at least %d = max(2, 1+ number of clusters)" msgstr "'sampsize' dovrebbe essere almeno %d = max(2, 1+ numero di cluster)" msgid "'sampsize' = %d should not be larger than the number of objects, %d" msgstr "" "'sampsize' = %d non dovrebbe essere più grande del numero di oggetti, %d" msgid "'samples' should be at least 1" msgstr "'samples' dovrebbe essere almeno 1" msgid "when 'medoids.x' is FALSE, 'keep.data' must be too" msgstr "quando 'medoids.x' è FALSE, lo dev'essere anche 'keep.data'" msgid "" "Distance computations with NAs: using correct instead of pre-2016 wrong " "formula.\n" "Use 'correct.d=FALSE' to get previous results or set 'correct.d=TRUE' " "explicitly\n" "to suppress this warning." msgstr "" "Calcoli della distanza con NA: si utilizza la formula corretta anziché " "quella errata pre-2016.\n" "Si utilizzi 'correct.d = FALSE' per ottenere i risultati precedenti o si " "imposti 'correct.d = TRUE'\n" "per sopprimere questo avviso." msgid "invalid 'correct.d'" msgstr "'correct.d' non valido" msgid "" "Each of the random samples contains objects between which no distance can be " "computed." msgstr "" "Ognuno dei campioni casuali contiene oggetti tra i quali non si possono " "calcolare distanze." msgid "" "For each of the %d samples, at least one object was found which could not be " "assigned to a cluster (because of missing values)." msgstr "" "Per ognuno dei %d campioni, è stato trovato almeno un oggetto che non può " "essere assegnato ad un cluster (a causa di valori mancanti)." msgid "invalid 'jstop' from .C(cl_clara,.):" msgstr "'jstop' non valido da .C(cl_clara,.):" msgid "'B' has to be a positive integer" msgstr "'B' dev'essere un intero positivo" msgid "invalid 'spaceH0':" msgstr "'spaceH0' non valido:" msgid "index has to be a function or a list of function" msgstr "l'indice dev'essere una funzione o una lista di funzioni" msgid "invalid 'twins' object" msgstr "oggetto 'twins' non valido" msgid "x is not a dataframe or a numeric matrix." msgstr "x non è un data frame o una matrice numerica." msgid "invalid %s; must be named list" msgstr "%s non valido; dev'essere una lista nominata" msgid "%s has invalid column names" msgstr "%s ha nomi colonna non validi" msgid "%s must be in 1:ncol(x)" msgstr "%s dev'essere in 1:ncol(x)" msgid "%s must contain column names or numbers" msgstr "%s deve contenere numeri o nomi di colonna" msgid "at least one binary variable has more than 2 levels." msgstr "almeno una variabile binaria ha più di 2 livelli." msgid "at least one binary variable has not 2 different levels." msgstr "almeno una variabile binaria non ha 2 livelli differenti." msgid "at least one binary variable has values not in {0,1,NA}" msgstr "almeno una variabile binaria ha valori esterni a {0, 1, NA}" msgid "binary variable(s) %s treated as interval scaled" msgstr "variabili binarie %s trattate come intervallo ridimensionato" msgid "%s has constant columns %s; these are standardized to 0" msgstr "%s ha colonne costanti %s; queste sono standardizzate a 0" msgid "with mixed variables, metric \"gower\" is used automatically" msgstr "" "con variabili miste, la metrica \"gower\" è utilizzata in maniera automatica" msgid "'weights' must be of length p (or 1)" msgstr "'weights' dev'essere di lunghezza p (o 1)" msgid "invalid type %s for column numbers %s" msgstr "tipo %s non valido per i numeri di colonna %s" msgid "NA values in the dissimilarity matrix not allowed." msgstr "I valori NA non sono ammessi in una matrice di dissimilarità." msgid "No clustering performed, NA's in dissimilarity matrix." msgstr "Nessun cluster generato, valori NA nella matrice di dissomiglianza." msgid "'x' must be numeric n x p matrix" msgstr "'x' dev'essere una matrice numerica n x p" msgid "omitting NAs" msgstr "si omettono gli NA" msgid "no points without missing values" msgstr "nessun punto senza valori mancanti" msgid "computed some negative or all 0 probabilities" msgstr "calcolate alcune probabilità negative o tutte 0" msgid "algorithm possibly not converged in %d iterations" msgstr "l'algoritmo potrebbe non convergere in %d iterazioni" msgid "'A' must be p x p cov-matrix defining an ellipsoid" msgstr "" "'A' dev'essere una matrice di covarianza p x p che definisce un ellissoide" msgid "ellipsoidPoints() not yet implemented for p >= 3 dim." msgstr "ellipsoidPoints() non ancora implementato per p >= 3 dimensioni." msgid "'k' (number of clusters) must be in {1,2, .., n/2 -1}" msgstr "'k' (il numero di cluster) dev'essere in {1,2, .., n/2 -1}" msgid "'memb.exp' must be a finite number > 1" msgstr "'memb.exp' dev'essere un numero finito > 1" msgid "'maxit' must be non-negative integer" msgstr "'maxit' dev'essere un intero non negativo" msgid "'iniMem.p' must be a nonnegative n * k matrix with rowSums == 1" msgstr "'iniMem.p' dev'essere una matrice non-negativa n * k con rowSums == 1" msgid "FANNY algorithm has not converged in 'maxit' = %d iterations" msgstr "L'algoritmo FANNY senza convergenza con 'maxit' = %d iterazioni" msgid "the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ?" msgstr "" "le appartenenze sono tutte molto vicine a 1/k. Decrementare 'memb.exp'?" msgid "'m', a membership matrix, must be nonnegative with rowSums == 1" msgstr "" "'m', una matrice di appartenenza, dev'essere non negativa con rowSums == 1" msgid "'n' must be >= 2" msgstr "'n' dev'essere >= 2" msgid "x must be a matrix or data frame." msgstr "x dev'essere una matrice o un data frame." msgid "" "All variables must be binary (e.g., a factor with 2 levels, both present)." msgstr "" "Tutte le variabili devono essere binarie (es. un fattore a 2 livelli, " "entrambi presenti)." msgid "mona() needs at least p >= 2 variables (in current implementation)" msgstr "mona() richiede almeno p >= 2 variabili (nell'attuale implementazione)" msgid "No clustering performed, an object was found with all values missing." msgstr "Nessun cluster generato, un oggetto aveva tutti i valori mancanti." msgid "" "No clustering performed, found variable with more than half values missing." msgstr "" "Nessun cluster generato, trovata una variabile con più della metà dei valori " "mancanti." msgid "" "No clustering performed, a variable was found with all non missing values " "identical." msgstr "" "Nessun cluster generato, una variabile è stata trovata con tutti i valori " "non-mancanti identici." msgid "No clustering performed, all variables have at least one missing value." msgstr "" "Clustering interrotto, tutte le variabili hanno almeno un valore mancante." msgid "Cannot keep data when 'x' is a dissimilarity!" msgstr "Non è possibile conservare i dati quando 'x' è una dissomiglianza!" msgid "have %d observations, but not more than %d are allowed" msgstr "hanno %d osservazioni, ma non più di %d sono ammesse" msgid "Number of clusters 'k' must be in {1,2, .., n-1}; hence n >= 2" msgstr "Il numero di cluster 'k' dev'essere in {1,2, .., n-1}; perciò n >= 2" msgid "Set either 'variant' or 'pamonce', but not both" msgstr "Imposta \"variant\" o \"pamonce\", ma non entrambi" msgid "" "'medoids' must be NULL or vector of %d distinct indices in {1,2, .., n}, n=%d" msgstr "" "'medoids' dev'essere NULL o un vettore di %d indici distinti in {1,2, .., " "n}, n=%d" msgid "No clustering performed, NAs in the computed dissimilarity matrix." msgstr "Nessun cluster generato, valori NA nella matrice di dissomiglianza." msgid "error from .C(cl_pam, *): invalid medID's" msgstr "errore in .C(cl_pam, *): medID non valido" msgid "NA-values are not allowed in dist-like 'x'." msgstr "I valori NA non sono ammessi in dist-simile 'x'." msgid "Distances must be result of dist or a square matrix." msgstr "Le distanze devono essere il risultato di una matrice dist o quadrata." msgid "the square matrix is not symmetric." msgstr "la matrice quadrata non è simmetrica." msgid ">>>>> funny case in clusplot.default() -- please report!" msgstr ">>>>> caso insolito in clusplot.default() -- per piacere, riportalo!" msgid "x is not a data matrix" msgstr "x non è una matrice dati" msgid "one or more objects contain only missing values" msgstr "uno o più oggetti contiene solo valori mancanti" msgid "one or more variables contain only missing values" msgstr "una o più variabili contiene solo valori mancanti" msgid "" "Missing values were displaced by the median of the corresponding variable(s)" msgstr "" "I valori mancanti sono stati sostituiti con la mediana delle variabili " "corrispondenti" msgid "x is not numeric" msgstr "x non è numerico" msgid "The clustering vector is of incorrect length" msgstr "Il vettore di clustering è di lunghezza incorretta" msgid "NA-values are not allowed in clustering vector" msgstr "I valori NA non sono ammessi in un vettore di clustering" msgid "" "Error in C routine for the spanning ellipsoid,\n" " rank problem??" msgstr "" "Errore nella routine C per l'ellissoide di spanning,\n" " problema di rango?" msgid "'col.clus' should have length 4 when color is TRUE" msgstr "'col.clus' dev'essere di lunghezza 4 quando color è TRUE" msgid "no diss nor data found, nor the original argument of %s" msgstr "nessun diss o dato trovato, neppure l'argomento originale di %s" msgid "no diss nor data found for clusplot()'" msgstr "nessun diss o dato trovato per clusplot()'" msgid "invalid partition object" msgstr "oggetto partizione non valido" msgid "" "full silhouette is only available for results of 'clara(*, keep.data = TRUE)'" msgstr "" "la silhouette piena è disponibile solo per risultati di 'clara(*, keep.data " "= TRUE)'" msgid "specified both 'full' and 'subset'; will use 'subset'" msgstr "specificati 'full' e 'subset'; si utilizzerà 'subset'" msgid "'full' must be FALSE, TRUE, or a number in [0, 1]" msgstr "'full' dev'essere FALSE, TRUE, o un numero nell'intervallo [0, 1]" msgid "'x' must only have integer codes" msgstr "'x' deve avere unicamente codici interi" msgid "Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'" msgstr "Necessaria una differenza \"dist\" o una diss.matrix \"dmatrix\"" msgid "'dmatrix' is not a dissimilarity matrix compatible to 'x'" msgstr "'dmatrix' non è una matrice di dissomiglianza compatibile con 'x'" msgid "clustering 'x' and dissimilarity 'dist' are incompatible" msgstr "il clustering 'x' e le dissimilarità 'dist' sono incompatibili" msgid "invalid silhouette structure" msgstr "struttura silhouette non valida" msgid "invalid 'silhouette' object" msgstr "oggetto 'silhouette' non valido" msgid "No valid silhouette information (#{clusters} =? 1)" msgstr "Nessuna informazione valida di silhouette (#{clusters} =? 1)" msgid "Observation %s has *only* NAs --> omit it for clustering" msgid_plural "Observations %s have *only* NAs --> omit them for clustering!" msgstr[0] "L'osservazione %s ha *solo* NA --> omettetela dall'analisi" msgstr[1] "Le osservazioni %s hanno *solo* NA --> omettetele dall'analisi!" msgid "%d observation (%s) has *only* NAs --> omit them for clustering!" msgid_plural "" "%d observations (%s ...) have *only* NAs --> omit them for clustering!" msgstr[0] "%d osservazione (%s) ha *solo* NA --> omettetela dall'analisi!" msgstr[1] "%d osservazioni (%s) hanno *solo* NA --> omettetele dall'analisi!" msgid "setting 'logical' variable %s to type 'asymm'" msgid_plural "setting 'logical' variables %s to type 'asymm'" msgstr[0] "configurazione della variabile 'logical' %s nel tipo 'asymm'" msgstr[1] "configurazione delle variabili 'logical' %s nel tipo 'asymm'" cluster/po/R-pl.po0000644000176200001440000012555214005347355013543 0ustar liggesusersmsgid "" msgstr "" "Project-Id-Version: cluster 1.15.1\n" "Report-Msgid-Bugs-To: bugs.r-project.org\n" "POT-Creation-Date: 2021-01-30 22:00\n" "PO-Revision-Date: 2014-03-27 17:34+0100\n" "Last-Translator: Åukasz Daniel \n" "Language-Team: Åukasz Daniel \n" "Language: pl_PL\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n" "X-Poedit-SourceCharset: iso-8859-1\n" "X-Generator: Poedit 1.5.4\n" # cluster/R/agnes.R: 10 # stop("invalid clustering method") msgid "invalid clustering method" msgstr "niepoprawna metoda grupowania" # cluster/R/agnes.R: 11 # stop("ambiguous clustering method") msgid "ambiguous clustering method" msgstr "niejednoznaczna metoda grupowania" # cluster/R/agnes.R: 22 # stop("'par.method' must be of length 1, 3, or 4") msgid "'par.method' must be of length 1, 3, or 4" msgstr "'par.method' musi być dÅ‚ugoÅ›ci 1, 3, lub 4" # cluster/R/agnes.R: 28 # stop("NA values in the dissimilarity matrix not allowed.") # cluster/R/diana.R: 11 # stop("NA values in the dissimilarity matrix not allowed.") # cluster/R/pam.R: 13 # stop("NA values in the dissimilarity matrix not allowed.") # cluster/R/fanny.R: 12 # stop("NA values in the dissimilarity matrix not allowed.") msgid "NA-values in the dissimilarity matrix not allowed." msgstr "wartoÅ›ci NA w macierzy różnic nie sÄ… dozwolone." # cluster/R/agnes.R: 35 # stop(gettextf("%s is not and cannot be converted to class \"dissimilarity\"", dataname)) # cluster/R/diana.R: 18 # stop(gettextf("%s is not and cannot be converted to class \"dissimilarity\"", dataname)) # cluster/R/pam.R: 20 # stop(gettextf("%s is not and cannot be converted to class \"dissimilarity\"", dataname)) # cluster/R/fanny.R: 19 # stop(gettextf("%s is not and cannot be converted to class \"dissimilarity\"", dataname)) msgid "'x' is not and cannot be converted to class \"dissimilarity\"" msgstr "" "argument 'x' nie jest i nie może być przeksztaÅ‚cony na obiekt klasy " "\"dissimilarity\"" # cluster/R/agnes.R: 53 # stop(gettextf("%s is not a numeric dataframe or matrix.", dataname)) # cluster/R/clara.R: 15 # stop(gettextf("%s is not a numeric dataframe or matrix.", dataname)) # cluster/R/diana.R: 36 # stop(gettextf("%s is not a numeric dataframe or matrix.", dataname)) # cluster/R/pam.R: 40 # stop(gettextf("%s is not a numeric dataframe or matrix.", dataname)) # cluster/R/fanny.R: 37 # stop(gettextf("%s is not a numeric dataframe or matrix.", dataname)) msgid "x is not a numeric dataframe or matrix." msgstr "argument 'x' nie jest ramkÄ… liczbowÄ… ani też macierzÄ…" # cluster/R/agnes.R: 68 # stop("need at least 2 objects to cluster") msgid "need at least 2 objects to cluster" msgstr "potrzeba co najmniej 2 obiektów do grupowania" # cluster/R/agnes.R: 92 # stop("No clustering performed, NA values in the dissimilarity matrix.", "\n", sep = "" ) # cluster/R/fanny.R: 120 # stop("No clustering performed, NA values in the dissimilarity matrix.") msgid "No clustering performed, NA-values in the dissimilarity matrix." msgstr "Nie wykonano grupowania, wartoÅ›ci NA w macierzy różnic." # cluster/R/clara.R: 13 # stop(gettextf("%s is a \"dist\" object, but should be a data matrix or frame", dataname)) msgid "'x' is a \"dist\" object, but should be a data matrix or frame" msgstr "'x' jest obiektem klasy \"dist\", ale powinien być macierzÄ… lub ramkÄ…" # cluster/R/clara.R: 18 # stop("The number of cluster should be at least 1 and at most n-1." ) msgid "The number of cluster should be at least 1 and at most n-1." msgstr "Liczba grup powinna wynosić conajmniej 1 oraz co najwyżej n-1." # cluster/R/clara.R: 20 # stop(gettextf("'sampsize' should be at least %d = max(2, 1+ number of clusters)", max(2,k+1)), domain = "R-cluster") msgid "'sampsize' should be at least %d = max(2, 1+ number of clusters)" msgstr "'sampsize' powinien być co najmniej %d = max(2, 1+ liczba grup)" # cluster/R/clara.R: 22 # stop(gettextf("'sampsize' = %d should not be larger than the number of objects, %d", sampsize, n), domain = "R-cluster") msgid "'sampsize' = %d should not be larger than the number of objects, %d" msgstr "'sampsize' = %d nie powinien być wiÄ™kszy niż liczba obiektów, %d" # cluster/R/clara.R: 24 # stop("'samples' should be at least 1") msgid "'samples' should be at least 1" msgstr "'samples' powinno wynosić przynajmniej 1" # cluster/R/clara.R: 32 # stop("when 'medoids.x' is FALSE, 'keep.data' must be too") msgid "when 'medoids.x' is FALSE, 'keep.data' must be too" msgstr "kiedy 'medoids.x' jest FALSE, 'keep.data' musi być również FALSE" msgid "" "Distance computations with NAs: using correct instead of pre-2016 wrong " "formula.\n" "Use 'correct.d=FALSE' to get previous results or set 'correct.d=TRUE' " "explicitly\n" "to suppress this warning." msgstr "" # cluster/R/coef.R: 10 # stop("invalid 'twins' object") #, fuzzy msgid "invalid 'correct.d'" msgstr "niepoprawny obiekt 'twins'" # cluster/R/clara.R: 96 # stop("Each of the random samples contains objects between which no distance can be computed.") msgid "" "Each of the random samples contains objects between which no distance can be " "computed." msgstr "" "Każda z losowych próbek zawiera obiekty pomiÄ™dzy którymi żadna odlegÅ‚ość nie " "może być obliczona." # cluster/R/clara.R: 98 # stop(gettextf("For each of the %d samples, at least one object was found which could not be assigned to a cluster (because of missing values).", samples)) msgid "" "For each of the %d samples, at least one object was found which could not be " "assigned to a cluster (because of missing values)." msgstr "" "Dla każdej z %d próbek, co najmniej jeden obiekt zostaÅ‚ znaleziony, który " "nie mógÅ‚ być przypisany do grupy (z uwagi na brakujÄ…ce wartoÅ›ci)." # cluster/R/clara.R: 100 # stop(gettextf("invalid 'jstop' from .C(cl_clara,.): %s", res$jstop)) msgid "invalid 'jstop' from .C(cl_clara,.):" msgstr "niepoprawny 'jstop' z '.C(cl_clara,.)':" # cluster/R/clusGap.R: 20 # stop("'B' has to be a positive integer") msgid "'B' has to be a positive integer" msgstr "'B' musi być dodatniÄ… liczbÄ… caÅ‚kowitÄ…" #, fuzzy msgid "invalid 'spaceH0':" msgstr "niepoprawny typ" msgid "index has to be a function or a list of function" msgstr "" # cluster/R/coef.R: 10 # stop("invalid 'twins' object") msgid "invalid 'twins' object" msgstr "niepoprawny obiekt 'twins'" # cluster/R/daisy.R: 8 # stop(gettextf("%s is not a dataframe or a numeric matrix.", dataname)) msgid "x is not a dataframe or a numeric matrix." msgstr "argument 'x' nie jest ramkÄ… danych ani też macierzÄ… liczbowÄ…" # cluster/R/daisy.R: 15 # stop(gettextf("invalid %s; must be named list", sQuote("type"))) msgid "invalid %s; must be named list" msgstr "niepoprawne %s; musi być nazwanÄ… listÄ…" # cluster/R/daisy.R: 21 # stop(gettextf("%s has invalid column names", paste0("type$", nt))) msgid "%s has invalid column names" msgstr "%s posiada niepoprawne nazwy kolumn" # cluster/R/daisy.R: 25 # stop(gettextf("%s must be in 1:ncol(x)", paste0("type$", nt))) msgid "%s must be in 1:ncol(x)" msgstr "%s musi być w przedziale 1:ncol(x)" # cluster/R/daisy.R: 27 # stop(gettextf("%s must contain column names or numbers", paste0("type$", nt))) msgid "%s must contain column names or numbers" msgstr "%s musi zawierać nazwy kolumn lub liczby" # cluster/R/daisy.R: 38 # stop("at least one binary variable has more than 2 levels.") msgid "at least one binary variable has more than 2 levels." msgstr "przynajmniej jedna zmienna binarna posiada wiÄ™cej niż 2 poziomy." # cluster/R/daisy.R: 40 # warning("at least one binary variable has not 2 different levels.") msgid "at least one binary variable has not 2 different levels." msgstr "przynajmniej jedna zmienna binarna nie posiada 2 różnych poziomów." # cluster/R/daisy.R: 48 # stop("at least one binary variable has values not in {0,1,NA}") msgid "at least one binary variable has values not in {0,1,NA}" msgstr "przynajmniej jedna zmienna binarna posiada wartoÅ›ci poza {0, 1, NA}" # cluster/R/daisy.R: 71 # warning(gettextf("binary variable(s) %s treated as interval scaled", pColl(which(tI)[iBin]))) msgid "binary variable(s) %s treated as interval scaled" msgstr "zmienne binarne %s traktowane jako interwaÅ‚ zostaÅ‚y przeskalowane" # cluster/R/daisy.R: 92 # warning(gettextf("%s has constant columns %s; these are standardized to 0", sQuote("x"), pColl(which(sx == 0)))) msgid "%s has constant columns %s; these are standardized to 0" msgstr "%s posiada staÅ‚e kolumny %s; zostaÅ‚y one ustandaryzowane do zera" # cluster/R/daisy.R: 102 # warning("with mixed variables, metric \"gower\" is used automatically") msgid "with mixed variables, metric \"gower\" is used automatically" msgstr "z mieszanymi zmiennymi, metryka 'gower' jest używana automatycznie" # cluster/R/daisy.R: 117 # stop("'weights' must be of length p (or 1)") msgid "'weights' must be of length p (or 1)" msgstr "'weights' musi być o dÅ‚ugoÅ›ci 'p' (lub 1)" # cluster/R/daisy.R: 125 # stop(gettextf("invalid type %s for column numbers %s", type2[ina], pColl(which(is.na)))) msgid "invalid type %s for column numbers %s" msgstr "niepoprawny typ %s dla liczb kolumn %s" # cluster/R/agnes.R: 28 # stop("NA values in the dissimilarity matrix not allowed.") # cluster/R/diana.R: 11 # stop("NA values in the dissimilarity matrix not allowed.") # cluster/R/pam.R: 13 # stop("NA values in the dissimilarity matrix not allowed.") # cluster/R/fanny.R: 12 # stop("NA values in the dissimilarity matrix not allowed.") msgid "NA values in the dissimilarity matrix not allowed." msgstr "wartoÅ›ci NA w macierzy różnic nie sÄ… dozwolone." # cluster/R/diana.R: 76 # stop("No clustering performed, NA's in dissimilarity matrix.\n") msgid "No clustering performed, NA's in dissimilarity matrix." msgstr "Nie wykonano grupowania, wartoÅ›ci NA w macierzy różnic" # cluster/R/ellipsoidhull.R: 14 # stop("'x' must be numeric n x p matrix") msgid "'x' must be numeric n x p matrix" msgstr "'x' musi być liczbowÄ… macierzÄ… n x p" # cluster/R/ellipsoidhull.R: 16 # warning("omitting NAs") msgid "omitting NAs" msgstr "pomijanie wartoÅ›ci NA" # cluster/R/ellipsoidhull.R: 20 # stop("no points without missing values") msgid "no points without missing values" msgstr "brak punktów bez brakujÄ…cych wartoÅ›ci" # cluster/R/ellipsoidhull.R: 39 # stop("computed some negative or all 0 probabilities") msgid "computed some negative or all 0 probabilities" msgstr "" "niektóre wyliczone prawdopodobieÅ„stwa sÄ… ujemne lub wszystkie sÄ… zerami" # cluster/R/fanny.R: 107 # warning(gettextf( # "FANNY algorithm has not converged in 'maxit' = %d iterations", # maxit)) msgid "algorithm possibly not converged in %d iterations" msgstr "algorytm prawdopodobnie nie uzbieżniÅ‚ siÄ™ w %d iteracjach" # cluster/R/ellipsoidhull.R: 92 # stop("'A' must be p x p cov-matrix defining an ellipsoid") msgid "'A' must be p x p cov-matrix defining an ellipsoid" msgstr "'A' musi być macierzÄ… kowariancji p x p okreÅ›lajÄ…cÄ… elipsoidÄ™" # cluster/R/ellipsoidhull.R: 106 # stop("ellipsoidPoints() not yet implemented for p >= 3 dim.") msgid "ellipsoidPoints() not yet implemented for p >= 3 dim." msgstr "" "'ellipsoidPoints()' nie zostaÅ‚a jeszcze zaimplementowana dla p >= 3 wymiary." # cluster/R/fanny.R: 55 # stop("'k' (number of clusters) must be in {1,2, .., n/2 -1}") msgid "'k' (number of clusters) must be in {1,2, .., n/2 -1}" msgstr "'k' (liczba grup) musi mieÅ›cić siÄ™ w przedziale {1,2, .., n/2 -1}" # cluster/R/fanny.R: 58 # stop("'memb.exp' must be a finite number > 1") msgid "'memb.exp' must be a finite number > 1" msgstr "'memb.exp' musi być skoÅ„czonÄ… liczbÄ… > 1" # cluster/R/fanny.R: 60 # stop("'maxit' must be non-negative integer") msgid "'maxit' must be non-negative integer" msgstr "'maxit' musi być nieujemnÄ… liczbÄ… caÅ‚kowitÄ…" # cluster/R/fanny.R: 69 # stop("'iniMem.p' must be a nonnegative n * k matrix with rowSums == 1") msgid "'iniMem.p' must be a nonnegative n * k matrix with rowSums == 1" msgstr "'iniMem.p' musi być nieujemnÄ… maceirzÄ… n x k z rowSums == 1" # cluster/R/fanny.R: 107 # warning(gettextf( # "FANNY algorithm has not converged in 'maxit' = %d iterations", # maxit)) msgid "FANNY algorithm has not converged in 'maxit' = %d iterations" msgstr "algorytm FANNY nie uzbieżniÅ‚ siÄ™ w 'maxit' = %d iteracjach" # cluster/R/fanny.R: 144 # warning("the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ?") msgid "the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ?" msgstr "przynależnoÅ›ci sÄ… bardzo bliskie 1/k. Może zmniejszyć 'memb.exp'?" # cluster/R/fanny.R: 241 # stop("'m', a membership matrix, must be nonnegative with rowSums == 1") msgid "'m', a membership matrix, must be nonnegative with rowSums == 1" msgstr "macierz przynależnoÅ›ci 'm' musi być nieujemna z rowSums == 1" # cluster/R/internal.R: 18 # stop("'n' argument must be >= 2") # cluster/R/internal.R: 26 # stop("'n' argument must be >= 2") msgid "'n' must be >= 2" msgstr "argument 'n' musi być >= 2" # cluster/R/mona.R: 6 # stop("'x' must be a matrix or data frame.") msgid "x must be a matrix or data frame." msgstr "argument 'x' musi być macierzÄ… lub ramkÄ… danych." # cluster/R/mona.R: 10 # stop("All variables must be binary (factor with 2 levels).") #, fuzzy msgid "" "All variables must be binary (e.g., a factor with 2 levels, both present)." msgstr "Wszystkie zmienne muszÄ… być binarne (czynnik z dwoma poziomami)" msgid "mona() needs at least p >= 2 variables (in current implementation)" msgstr "" # cluster/R/mona.R: 40 # stop("No clustering performed, an object was found with all values missing.") msgid "No clustering performed, an object was found with all values missing." msgstr "" "Nie wykonano grupowania, znaleziono obiekt któremu brakowaÅ‚o wszystkich " "wartoÅ›ci." # cluster/R/mona.R: 40 # stop("No clustering performed, an object was found with all values missing.") msgid "" "No clustering performed, found variable with more than half values missing." msgstr "" "Nie wykonano grupowania, znaleziono obiekt któremu brakowaÅ‚o wszystkich " "wartoÅ›ci." # cluster/R/mona.R: 44 # stop("No clustering performed, a variable was found with all non missing values identical.") msgid "" "No clustering performed, a variable was found with all non missing values " "identical." msgstr "" "Nie wykonano grupowania, znaleziono zmiennÄ… z identycznymi niebrakujÄ…cymi " "wartoÅ›ciami." # cluster/R/mona.R: 46 # stop("No clustering performed, all variables have at least one missing value.") msgid "No clustering performed, all variables have at least one missing value." msgstr "" "Nie wykonano grupowania, wszystkie zmienne majÄ… co najmniej jednÄ… brakujÄ…cÄ… " "wartość." msgid "Cannot keep data when 'x' is a dissimilarity!" msgstr "" msgid "have %d observations, but not more than %d are allowed" msgstr "" # cluster/R/pam.R: 56 # stop("Number of clusters 'k' must be in {1,2, .., n-1}; hence n >= 2") msgid "Number of clusters 'k' must be in {1,2, .., n-1}; hence n >= 2" msgstr "" "Liczba grup 'k' musi zawierać siÄ™ w zbiorze {1,2, .., n-1}; tak wiÄ™c n >= 2" msgid "Set either 'variant' or 'pamonce', but not both" msgstr "" # cluster/R/pam.R: 64 # stop(gettextf("'medoids' must be NULL or vector of %d distinct indices in {1,2, .., n}, n=%d", k, n)) msgid "" "'medoids' must be NULL or vector of %d distinct indices in {1,2, .., n}, n=%d" msgstr "" "argument 'medoids' musi być wartoÅ›ciÄ… NULL lub wektorem %d różnych indeksów " "w {1,2, .., n}, n=%d" # cluster/R/pam.R: 109 # stop("No clustering performed, NAs in the computed dissimilarity matrix.") msgid "No clustering performed, NAs in the computed dissimilarity matrix." msgstr "Nie wykonano grupowania, wyliczono wartoÅ›ci NA w macierzy różnic." # cluster/R/pam.R: 116 # stop("error from .C(cl_pam, *): invalid medID's") msgid "error from .C(cl_pam, *): invalid medID's" msgstr "błąd w '.C(cl_pam, *)': niepoprawne 'medID'" # cluster/R/plotpart.R: 70 # stop("NA values are not allowed in dist-like 'x'.") msgid "NA-values are not allowed in dist-like 'x'." msgstr "wartoÅ›ci NA nie sÄ… dozwolone w 'x' typu odlegÅ‚oÅ›ci." # cluster/R/plotpart.R: 79 # stop("Distances must be result of dist or a square matrix.") msgid "Distances must be result of dist or a square matrix." msgstr "OdlegÅ‚oÅ›ci muszÄ… być wynikiem 'dist' lub macierzy kwadratowej." # cluster/R/plotpart.R: 81 # stop("the square matrix is not symmetric.") msgid "the square matrix is not symmetric." msgstr "macierz kwadratowa nie jest symetryczna." # cluster/R/plotpart.R: 94 # warning(">>>>> funny case in clusplot.default() -- please report!\n") msgid ">>>>> funny case in clusplot.default() -- please report!" msgstr "" ">>>>> zabawny przypadek w 'clusplot.default()' -- proszÄ™ zgÅ‚osić raport!" # cluster/R/plotpart.R: 116 # stop("'x' is not a data matrix") msgid "x is not a data matrix" msgstr "argument 'x' nie jest macierzÄ… danych" # cluster/R/plotpart.R: 120 # stop("one or more objects contain only missing values") msgid "one or more objects contain only missing values" msgstr "jeden lub wiÄ™cej obiektów zawierajÄ… jedynie wartoÅ›ci brakujÄ…ce" # cluster/R/plotpart.R: 122 # stop("one or more variables contain only missing values") msgid "one or more variables contain only missing values" msgstr "jeden lub wiÄ™cej zmiennych zawiera jedynie wartoÅ›ci brakujÄ…ce" # cluster/R/plotpart.R: 125 # message("Missing values were displaced by the median of the corresponding variable(s)") msgid "" "Missing values were displaced by the median of the corresponding variable(s)" msgstr "" "BrakujÄ…ce wartoÅ›ci zostaÅ‚y zastÄ…pione przez medianÄ™ odpowiednich zmiennych" # cluster/R/plotpart.R: 164 # stop("'x' is not numeric") msgid "x is not numeric" msgstr "argument 'x' nie jest liczbÄ…" # cluster/R/plotpart.R: 174 # stop("The clustering vector is of incorrect length") msgid "The clustering vector is of incorrect length" msgstr "Wektor grupujÄ…cy posiada niepoprawnÄ… dÅ‚ugość" # cluster/R/plotpart.R: 177 # stop("NA values are not allowed in clustering vector") msgid "NA-values are not allowed in clustering vector" msgstr "wartoÅ›ci NA sÄ… niedozwolone w wektorze grupujÄ…cym" # cluster/R/plotpart.R: 303 # warning("Error in Fortran routine for the spanning ellipsoid,\n rank problem??") #, fuzzy msgid "" "Error in C routine for the spanning ellipsoid,\n" " rank problem??" msgstr "" "Błąd w procedurze Fortran dla elipsoidy obejmujÄ…cej,\n" " problem rang?" # cluster/R/plotpart.R: 353 # stop("'col.clus' argument should have length 4 when color is TRUE") msgid "'col.clus' should have length 4 when color is TRUE" msgstr "" "argument 'col.clus' powinien mieć dÅ‚ugość 4, gdy 'color' ma wartość TRUE" # cluster/R/plotpart.R: 508 # stop(gettextf("no diss nor data found, nor the original argument of %s", deparse(x$call))) msgid "no diss nor data found, nor the original argument of %s" msgstr "nie znaleziono różnic ani danych, ani oryginalnego argumentu %s" # cluster/R/plotpart.R: 514 # stop("no diss nor data found for 'clusplot()' function") msgid "no diss nor data found for clusplot()'" msgstr "nie znaleziono różnic ani danych dla funkcji 'clusplot()'" # cluster/R/silhouette.R: 7 # stop("invalid partition object") msgid "invalid partition object" msgstr "niepoprawny obiekt podziaÅ‚u" # cluster/R/silhouette.R: 21 # stop("full silhouette is only available for results of 'clara(*, keep.data = TRUE)'") msgid "" "full silhouette is only available for results of 'clara(*, keep.data = TRUE)'" msgstr "" "peÅ‚na sylwetka jest dostÄ™pna jedynie dla wyników 'clara(*, keep.data = TRUE)'" msgid "specified both 'full' and 'subset'; will use 'subset'" msgstr "" msgid "'full' must be FALSE, TRUE, or a number in [0, 1]" msgstr "" # cluster/R/silhouette.R: 35 # stop("'x' must only have integer codes") # cluster/R/silhouette.R: 82 # stop("'x' must only have integer codes") msgid "'x' must only have integer codes" msgstr "'x' musi posiadać tylko kody bÄ™dÄ…ce liczbami caÅ‚kowitymi" # cluster/R/silhouette.R: 42 # stop("Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'") # cluster/R/silhouette.R: 94 # stop("Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'") msgid "Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'" msgstr "Potrzeba albo różnic 'dist' lub diss.matrix 'dmatrix'" # cluster/R/silhouette.R: 44 # stop("'dmatrix' is not a dissimilarity matrix compatible to 'x'") # cluster/R/silhouette.R: 96 # stop("'dmatrix' is not a dissimilarity matrix compatible to 'x'") msgid "'dmatrix' is not a dissimilarity matrix compatible to 'x'" msgstr "'dmatrix' nie jest macierzÄ… różnic kompatybilnÄ… z 'x'" # cluster/R/silhouette.R: 48 # stop("clustering 'x' and dissimilarity 'dist' are incompatible") # cluster/R/silhouette.R: 100 # stop("clustering 'x' and dissimilarity 'dist' are incompatible") msgid "clustering 'x' and dissimilarity 'dist' are incompatible" msgstr "grupowane 'x' oraz różnice 'dist' nie sÄ… kompatybilne" # cluster/R/silhouette.R: 134 # stop("invalid silhouette structure") msgid "invalid silhouette structure" msgstr "niepoprana struktura 'silhouette'" # cluster/R/silhouette.R: 158 # stop("invalid 'silhouette' object") msgid "invalid 'silhouette' object" msgstr "niepoprawny obiekt 'silhouette'" # cluster/R/silhouette.R: 210 # stop("No valid silhouette information (#{clusters} =? 1)") msgid "No valid silhouette information (#{clusters} =? 1)" msgstr "Brak poprawnej informacji o sylwetce (czy liczba grup =? 1)" # cluster/R/clara.R: 91 # stop(sprintf(ngettext(nNA, "Observation %s has *only* NAs --> omit it for clustering", "Observations %s have *only* NAs --> omit them for clustering!", domain = "R-cluster"), pasteC(i)), domain = NA) msgid "Observation %s has *only* NAs --> omit it for clustering" msgid_plural "Observations %s have *only* NAs --> omit them for clustering!" msgstr[0] "" "Obserwacja %s posiada *tylko* wartoÅ›ci NA --> pomijanie jej w grupowaniu" msgstr[1] "" "Obserwacje %s posiadajÄ… *tylko* wartoÅ›ci NA --> pomijanie ich w grupowaniu" msgstr[2] "" "Obserwacje %s posiadajÄ… *tylko* wartoÅ›ci NA --> pomijanie ich w grupowaniu" # cluster/R/clara.R: 93 # stop(sprintf(ngettext(nNA, "%d observation (%s) has *only* NAs --> omit them for clustering!", "%d observations (%s ...) have *only* NAs --> omit them for clustering!", domain = "R-cluster"), nNA, pasteC(i[1:12])), domain = NA) msgid "%d observation (%s) has *only* NAs --> omit them for clustering!" msgid_plural "" "%d observations (%s ...) have *only* NAs --> omit them for clustering!" msgstr[0] "" "%d obserwacja (%s) posiada *tylko* wartoÅ›ci NA --> pomijanie jej w grupowaniu" msgstr[1] "" "%d obserwacje (%s ...) posiadajÄ… *tylko* wartoÅ›ci NA --> pomijanie ich w " "grupowaniu" msgstr[2] "" "%d obserwacji (%s ...) posiadajÄ… *tylko* wartoÅ›ci NA --> pomijanie ich w " "grupowaniu" # cluster/R/daisy.R: 76 # warning(sprintf(ngettext(sum(ilog), # "setting 'logical' variable %s to type 'asymm'", # "setting 'logical' variables %s to type 'asymm'", domain = "R-cluster"), # pColl(which(ilog))), domain = NA) msgid "setting 'logical' variable %s to type 'asymm'" msgid_plural "setting 'logical' variables %s to type 'asymm'" msgstr[0] "ustawianie zmiennej 'logical' %s na tym 'asymm'" msgstr[1] "ustawianie zmiennych 'logical' %s na tym 'asymm'" msgstr[2] "ustawianie zmiennych 'logical' %s na tym 'asymm'" #~ msgid "NAdiss" #~ msgstr "NAdiss" #~ msgid "non.diss" #~ msgstr "non.diss" #~ msgid "no distance can be computed." #~ msgstr "żadna odlegÅ‚ość nie może zostać obliczona." #~ msgid "For each of the" #~ msgstr "Dla każdej z" #~ msgid "" #~ "samples, at least one object was found which\n" #~ " could not" #~ msgstr "próbek, co najmniej jeden obiekt zostaÅ‚ znaleziony, który nie mógÅ‚" #~ msgid "be assigned to a cluster (because of missing values)." #~ msgstr "być przypisany do grupy (z powodu brakujÄ…cych wartoÅ›ci)." #~ msgid "invalid" #~ msgstr "niepoprawny argument" #~ msgid "type" #~ msgstr "type" #~ msgid "type$" #~ msgstr "type$" #~ msgid "binary variable(s)" #~ msgstr "zmienne binarne" #~ msgid "x" #~ msgstr "x" #~ msgid "has constant columns" #~ msgstr "posiada staÅ‚e kolumny" # cluster/R/ellipsoidhull.R: 42 # warning(gettextf("algorithm possibly not converged in %d iterations", maxit)) #~ msgid "possibly not converged in" #~ msgstr "algorytm prawdopodobnie nie uzbieżniÅ‚ siÄ™ w" # cluster/man/plot.mona.Rd: 9 # gettext("Separation step", domain = "R-cluster") # cluster/R/plothier.R: 199 # gettext("Separation step", domain = "R-cluster") #~ msgid "iterations" #~ msgstr "iteracjach" # cluster/R/pam.R: 64 # stop(gettextf("'medoids' must be NULL or vector of %d distinct indices in {1,2, .., n}, n=%d", k, n)) #~ msgid "'medoids' must be NULL or vector of" #~ msgstr "'medoids' musi być wartoÅ›ciÄ… NULL lub wektorem" #~ msgid "rank problem??" #~ msgstr "problem rang?" #~ msgid "'clara(*, keep.data = TRUE)'" #~ msgstr "'clara(*, keep.data = TRUE)'" # cluster/R/agnes.R: 135 # gettext("Call: ", domain = "R-cluster") # cluster/R/clara.R: 141 # gettext("Call: ", domain = "R-cluster") #~ msgid "Call:" #~ msgstr "WywoÅ‚anie:" # cluster/R/agnes.R: 136 # gettext("Agglomerative coefficient: ", domain = "R-cluster") # cluster/R/agnes.R: 149 # gettext("Agglomerative coefficient: ", domain = "R-cluster") #~ msgid "Agglomerative coefficient:" #~ msgstr "Współczynnik aglomeracyjny:" # cluster/R/agnes.R: 137 # gettext("Order of objects:", domain = "R-cluster") # cluster/R/agnes.R: 150 # gettext("Order of objects:", domain = "R-cluster") # cluster/R/mona.R: 75 # gettext("Order of objects:", domain = "R-cluster") # cluster/R/diana.R: 115 # gettext("Order of objects:", domain = "R-cluster") # cluster/R/diana.R: 136 # gettext("Order of objects:", domain = "R-cluster") #~ msgid "Order of objects:" #~ msgstr "Kolejność (rzÄ…d) obiektów:" # cluster/R/agnes.R: 140 # gettext("Height (summary):", domain = "R-cluster") #~ msgid "Height (summary):" #~ msgstr "Wysokość (podsumowanie):" # cluster/R/agnes.R: 141 # gettext("Available components:", domain = "R-cluster") # cluster/R/agnes.R: 158 # gettext("Available components:", domain = "R-cluster") # cluster/R/mona.R: 82 # gettext("Available components:", domain = "R-cluster") # cluster/R/clara.R: 147 # gettext("Available components:", domain = "R-cluster") # cluster/R/clara.R: 179 # gettext("Available components:", domain = "R-cluster") # cluster/R/diana.R: 122 # gettext("Available components:", domain = "R-cluster") # cluster/R/diana.R: 143 # gettext("Available components:", domain = "R-cluster") # cluster/R/pam.R: 183 # gettext("Available components:", domain = "R-cluster") # cluster/R/pam.R: 213 # gettext("Available components:", domain = "R-cluster") # cluster/R/fanny.R: 189 # gettext("Available components:", domain = "R-cluster") # cluster/R/fanny.R: 214 # gettext("Available components:", domain = "R-cluster") #~ msgid "Available components:" #~ msgstr "DostÄ™pne komponenty:" # cluster/R/agnes.R: 148 # gettext("Object of class 'agnes' from call:", domain = "R-cluster") #~ msgid "Object of class 'agnes' from call:" #~ msgstr "Obiekt klasy \"agnes\" z wywoÅ‚ania:" # cluster/R/agnes.R: 153 # gettext("Merge:", domain = "R-cluster") # cluster/R/diana.R: 113 # gettext("Merge:", domain = "R-cluster") # cluster/R/diana.R: 135 # gettext("Merge:", domain = "R-cluster") #~ msgid "Merge:" #~ msgstr "Złączenie:" # cluster/R/agnes.R: 154 # gettext("Height:", domain = "R-cluster") # cluster/R/diana.R: 118 # gettext("Height:", domain = "R-cluster") # cluster/R/diana.R: 138 # gettext("Height:", domain = "R-cluster") #~ msgid "Height:" #~ msgstr "Wysokość:" # cluster/R/clara.R: 48 # gettextf("calling .C(cl_clara, ..., DUP = %s):", doDUP, domain = "R-cluster") #~ msgid "calling .C(cl_clara, ..., DUP = %s):" #~ msgstr "wywoÅ‚ywanie .C(cl_clara, ..., DUP = %s):" # cluster/R/clara.R: 142 # gettext("Medoids:", domain = "R-cluster") # cluster/R/clara.R: 160 # gettext("Medoids:", domain = "R-cluster") # cluster/R/pam.R: 175 # gettext("Medoids:", domain = "R-cluster") #~ msgid "Medoids:" #~ msgstr "Medoidy:" # cluster/R/clara.R: 143 # gettext("Objective function:", domain = "R-cluster") # cluster/R/clara.R: 161 # gettext("Objective function:", domain = "R-cluster") # cluster/R/pam.R: 177 # gettext("Objective function:", domain = "R-cluster") #~ msgid "Objective function:" #~ msgstr "Funkcja celu:" # cluster/R/clara.R: 144 # gettext("Clustering vector:", domain = "R-cluster") # cluster/R/clara.R: 171 # gettext("Clustering vector:", domain = "R-cluster") # cluster/R/pam.R: 176 # gettext("Clustering vector:", domain = "R-cluster") #~ msgid "Clustering vector:" #~ msgstr "Wektor grupujÄ…cy:" # cluster/R/clara.R: 145 # gettext("Cluster sizes:", domain = "R-cluster") #~ msgid "Cluster sizes:" #~ msgstr "Rozmiary grup:" # cluster/R/clara.R: 146 # gettext("Best sample:", domain = "R-cluster") # cluster/R/clara.R: 170 # gettext("Best sample:", domain = "R-cluster") #~ msgid "Best sample:" #~ msgstr "Najlepsza próbka:" # cluster/R/clara.R: 159 # gettext("Object of class 'clara' from call:", domain = "R-cluster") #~ msgid "Object of class 'clara' from call:" #~ msgstr "Obiekt klasy \"clara\" z wywoÅ‚ania:" # cluster/R/clara.R: 162 # gettext("Numerical information per cluster:", domain = "R-cluster") # cluster/R/pam.R: 197 # gettext("Numerical information per cluster:", domain = "R-cluster") #~ msgid "Numerical information per cluster:" #~ msgstr "Numeryczna informacja na grupÄ™:" # cluster/R/clara.R: 165 # gettext("Average silhouette width per cluster:", domain = "R-cluster") # cluster/R/pam.R: 205 # gettext("Average silhouette width per cluster:", domain = "R-cluster") # cluster/R/fanny.R: 206 # gettext("Average silhouette width per cluster:", domain = "R-cluster") #~ msgid "Average silhouette width per cluster:" #~ msgstr "PrzeciÄ™tna szerokość sylwetki na grupÄ™:" # cluster/R/clara.R: 167 # gettext("Average silhouette width of best sample: ", domain = "R-cluster") #~ msgid "Average silhouette width of best sample:" #~ msgstr "PrzeciÄ™tna szerokość sylwetki dla najlepszej próbki:" # cluster/R/clara.R: 173 # gettext("Silhouette plot information for best sample:", domain = "R-cluster") #~ msgid "Silhouette plot information for best sample:" #~ msgstr "Informacja o wykresie sylwetki dla najlepszej próbki:" # cluster/R/clusGap.R: 33 # gettextf("Clustering k = 1,2,..., K.max (= %d): .. ", K.max, domain = "R-cluster") #~ msgid "Clustering k = 1,2,..., K.max (= %d): .." #~ msgstr "Grupowanie k = 1,2,..., K.max (= %d): .." # cluster/R/clusGap.R: 36 # gettext("done", domain = "R-cluster") #~ msgid "done" #~ msgstr "wykonano" # cluster/R/clusGap.R: 46 # gettextf("Bootstrapping, b = 1,2,..., B (= %d) [one \".\" per sample]:", B, domain = "R-cluster") #~ msgid "Bootstrapping, b = 1,2,..., B (= %d) [one \".\" per sample]:" #~ msgstr "Bootstrapowanie, b = 1,2,..., B (= %d) [jeden \".\" na próbkÄ™]:" # cluster/R/clusGap.R: 127 # gettext("Clustering Gap statistic [\"clusGap\"].", domain = "R-cluster") #~ msgid "Clustering Gap statistic [\"clusGap\"]." #~ msgstr "Statystyka przerwy grupowania [\"clusGap\"]." # cluster/R/clusGap.R: 128 # gettextf("B=%d simulated reference sets, k = 1..%d", x$B, K, domain = "R-cluster") #~ msgid "B=%d simulated reference sets, k = 1..%d" #~ msgstr "B=%d symulowane zbiory referencyjne, k = 1..%d" # cluster/R/clusGap.R: 132 # gettextf(" --> Number of clusters (method '%s', SE.factor=%g): %d", method, SE.factor, nc, domain = "R-cluster") #~ msgid "--> Number of clusters (method '%s', SE.factor=%g): %d" #~ msgstr "--> Liczba grup (metoda '%s', SE.factor=%g): %d" # cluster/R/clusGap.R: 134 # gettextf(" --> Number of clusters (method '%s'): %d", method, nc, domain = "R-cluster") #~ msgid "--> Number of clusters (method '%s'): %d" #~ msgstr "--> Liczba grup (metoda '%s'): %d" # cluster/R/daisy.R: 157 # gettext("NA values in the dissimilarity matrix!") #~ msgid "NA values in the dissimilarity matrix!" #~ msgstr "WartoÅ›ci NA w macierzy odmiennoÅ›ci!" # cluster/R/daisy.R: 171 # gettext("Dissimilarities:", domain = "R-cluster") #~ msgid "Dissimilarities:" #~ msgstr "OdmiennoÅ›ci:" # cluster/R/daisy.R: 178 # gettext("Warning: ", domain = "R-cluster") # cluster/R/daisy.R: 208 # gettext("Warning: ", domain = "R-cluster") #~ msgid "Warning:" #~ msgstr "Ostrzeżenie:" # cluster/R/daisy.R: 179 # gettext("Metric: ", domain = "R-cluster") # cluster/R/daisy.R: 202 # gettext("Metric: ", domain = "R-cluster") #~ msgid "Metric:" #~ msgstr "Metryka:" # cluster/R/daisy.R: 181 # gettextf("Types = %s", paste(aT, collapse = ", "), domain = "R-cluster") # cluster/R/daisy.R: 204 # gettextf("Types = %s", paste(aT, collapse = ", "), domain = "R-cluster") #~ msgid "Types = %s" #~ msgstr "Typy = %s" # cluster/R/daisy.R: 183 # gettext("Number of objects:", domain = "R-cluster") # cluster/R/daisy.R: 206 # gettext("Number of objects:", domain = "R-cluster") #~ msgid "Number of objects:" #~ msgstr "Liczba obiektów:" # cluster/R/diana.R: 120 # gettext("Divisive coefficient:", domain = "R-cluster") # cluster/R/diana.R: 139 # gettext("Divisive coefficient:", domain = "R-cluster") #~ msgid "Divisive coefficient:" #~ msgstr "Współczynnik podziaÅ‚u:" # cluster/R/ellipsoidhull.R: 37 # gettext("Error in Fortran routine computing the spanning ellipsoid. Probably collinear data", domain = "R-cluster") #~ msgid "" #~ "Error in Fortran routine computing the spanning ellipsoid. Probably " #~ "collinear data" #~ msgstr "" #~ "Błąd w procedurze Fortran dla elipsoidy obejmujÄ…cej, prawdopodobnie " #~ "współliniowe dane" #~ msgid "" #~ "ellipsoid in %d dimensions:\n" #~ " center = (%s); squared ave.radius d^2 = %s\n" #~ " and shape matrix =" #~ msgstr "" #~ "elipsoida w %d wymiarach:\n" #~ " centrum = (%s); kwadrat przeciÄ™tnego promienia d^2 = %s\n" #~ " oraz macierz ksztaÅ‚tu =" # cluster/R/ellipsoidhull.R: 69 # gettextf(" ellipsoid's area = %s", format(volume(x), digits=digits), domain = "R-cluster") #~ msgid "ellipsoid's area = %s" #~ msgstr "powierzchnia elipsoidy = %s" # cluster/R/ellipsoidhull.R: 70 # gettextf(" ellipsoid's volume = %s", format(volume(x), digits=digits), domain = "R-cluster") #~ msgid "ellipsoid's volume = %s" #~ msgstr "objÄ™tość elipsoidy = %s" # cluster/R/ellipsoidhull.R: 73 # gettext("** Warning: ** the algorithm did not terminate reliably!\n most probably because of collinear data", domain = "R-cluster") #~ msgid "" #~ "** Warning: ** the algorithm did not terminate reliably!\n" #~ " most probably because of collinear data" #~ msgstr "" #~ "** Ostrzeżenie: ** algorytm nie zakoÅ„czyÅ‚ siÄ™ w sposób wiarygodny!\n" #~ " prawdopodobnie z powodu wspóliniowych danych" # cluster/R/ellipsoidhull.R: 75 # gettext("** Warning: ** the algorithm did not terminate reliably!\n (in the available number of iterations)", domain = "R-cluster") #~ msgid "" #~ "** Warning: ** the algorithm did not terminate reliably!\n" #~ " (in the available number of iterations)" #~ msgstr "" #~ "** Ostrzeżenie: ** algorytm nie zakoÅ„czyÅ‚ siÄ™ w sposób wiarygodny!\n" #~ " (w dostÄ™pnej liczbie iteracji)" # cluster/R/fanny.R: 172 # gettext("Fuzzy Clustering object of class 'fanny': ", domain = "R-cluster") #~ msgid "Fuzzy Clustering object of class 'fanny':" #~ msgstr "Obiekt rozmytego grupowania klasy \"fanny\":" # cluster/R/fanny.R: 179 # gettext("Membership coefficients (in percent, rounded):", domain = "R-cluster") #~ msgid "Membership coefficients (in percent, rounded):" #~ msgstr "Współczynnik czÅ‚onkostwa (w procentach, zaokrÄ…glony):" # cluster/R/fanny.R: 180 # gettext("Fuzzyness coefficients:", domain = "R-cluster") #~ msgid "Fuzzyness coefficients:" #~ msgstr "Współczynniki rozmycia:" # cluster/R/fanny.R: 181 # gettext("Closest hard clustering:", domain = "R-cluster") #~ msgid "Closest hard clustering:" #~ msgstr "Najbliższe twarde grupowanie:" # cluster/R/fanny.R: 183 # gettextf("k_crisp (= %d) < k !!", x$k.crisp, domain = "R-cluster") #~ msgid "k_crisp (= %d) < k !!" #~ msgstr "k_crisp (= %d) < k !!" # cluster/R/pam.R: 203 # gettext("Silhouette plot information:", domain = "R-cluster") # cluster/R/fanny.R: 204 # gettext("Silhouette plot information:", domain = "R-cluster") #~ msgid "Silhouette plot information:" #~ msgstr "Informacje o wykresie sylwetek:" # cluster/R/pam.R: 207 # gettext("Average silhouette width of total data set:", domain = "R-cluster") # cluster/R/fanny.R: 208 # gettext("Average silhouette width of total data set:", domain = "R-cluster") #~ msgid "Average silhouette width of total data set:" #~ msgstr "PrzeciÄ™tna szerokość sylwetki peÅ‚nego zbioru danych:" # cluster/R/mona.R: 42 # stop("No clustering performed, a variable was found with at least 50 percent missing values.") #~ msgid "" #~ "No clustering performed, a variable was found with at least 50 percent " #~ "missing values." #~ msgstr "" #~ "Nie wykonano grupowania, znaleziono zmiennÄ… z co najmniej 50 procent " #~ "brakujÄ…cych wartoÅ›ci." # cluster/R/mona.R: 73 # gettext("Revised data:", domain = "R-cluster") #~ msgid "Revised data:" #~ msgstr "PrzeglÄ…dniÄ™te dane:" # cluster/R/mona.R: 78 # gettext("Variable used:", domain = "R-cluster") #~ msgid "Variable used:" #~ msgstr "Użyte zmienne:" # cluster/R/mona.R: 80 # gettext("Separation step:", domain = "R-cluster") #~ msgid "Separation step:" #~ msgstr "Krok separacji:" # cluster/R/pam.R: 198 # gettext("Isolated clusters:", domain = "R-cluster") #~ msgid "Isolated clusters:" #~ msgstr "Izolowane grupy:" #~ msgid "L-clusters:" #~ msgstr "L-grupy:" # cluster/R/pam.R: 200 # gettext(" L*-clusters: ", domain = "R-cluster") #~ msgid "L*-clusters:" #~ msgstr "L*-grupy:" # cluster/R/plothier.R: 6 # gettextf("Dendrogram of %s", paste(deparse(x$call), collapse = ""), domain = "R-cluster") # cluster/R/plothier.R: 98 # gettextf("Dendrogram of %s", cl, domain = "R-cluster") # cluster/R/plothier.R: 153 # gettextf("Dendrogram of %s", cl, domain = "R-cluster") #~ msgid "Dendrogram of %s" #~ msgstr "Dendrogram %s" # cluster/man/pltree.twins.Rd: 11 # gettext("Height", domain = "R-cluster") # cluster/man/bannerplot.Rd: 11 # gettext("Height", domain = "R-cluster") # cluster/R/plothier.R: 7 # gettext("Height", domain = "R-cluster") # cluster/R/plothier.R: 24 # gettext("Height", domain = "R-cluster") #~ msgid "Height" #~ msgstr "Wysokość" # cluster/R/plothier.R: 91 # gettextf("Agglomerative Coefficient = %s", round(x$ac, digits = 2), domain = "R-cluster") #~ msgid "Agglomerative Coefficient = %s" #~ msgstr "Współczynnik aglomeracyjny = %s" # cluster/R/plothier.R: 97 # gettextf("Banner of %s", cl, domain = "R-cluster") # cluster/R/plothier.R: 152 # gettextf("Banner of %s", cl, domain = "R-cluster") # cluster/R/plothier.R: 198 # gettextf("Banner of %s", deparse(x$call), domain = "R-cluster") #~ msgid "Banner of %s" #~ msgstr "Baner %s" # cluster/R/plothier.R: 113 # gettext("Make a plot selection (or 0 to exit):", domain = "R-cluster") # cluster/R/plothier.R: 168 # gettext("Make a plot selection (or 0 to exit):", domain = "R-cluster") # cluster/R/plotpart.R: 26 # gettext("Make a plot selection (or 0 to exit):", domain = "R-cluster") #~ msgid "Make a plot selection (or 0 to exit):" #~ msgstr "Wybierz wykres (lub 0 aby wyjść):" # cluster/R/plothier.R: 146 # gettextf("Divisive Coefficient = %s", round(x$dc, digits = 2), domain = "R-cluster") #~ msgid "Divisive Coefficient = %s" #~ msgstr "Współczynnik podziaÅ‚u = %s" # cluster/R/plotpart.R: 154 # gettextf("CLUSPLOT(%s)", deparse(substitute(x))) #~ msgid "CLUSPLOT(%s)" #~ msgstr "CLUSPLOT(%s)" # cluster/R/plotpart.R: 155 # gettextf("These two components explain %s percent of the point variability.", round(100 * var.dec, digits = 2)) #~ msgid "These two components explain %s percent of the point variability." #~ msgstr "Te dwa komponenty wyjaÅ›niajÄ… %s procent zmiennoÅ›ci punktu." # cluster/man/clusplot.default.Rd: 23 # gettext("Component 1", domain = "R-cluster") # cluster/R/plotpart.R: 156 # gettext("Component 1", domain = "R-cluster") #~ msgid "Component 1" #~ msgstr "Komponent 1" #~ msgid "Component 2" #~ msgstr "Komponent 2" # cluster/R/plotpart.R: 198 # gettextf("cluster %d has only one observation ..", i, domain = "R-cluster") #~ msgid "cluster %d has only one observation .." #~ msgstr "grupa %d ma tylko jednÄ… obserwacjÄ™ .." # cluster/R/plotpart.R: 286 # gettext("span & rank2 : calling \"spannel\" ..", domain = "R-cluster") #~ msgid "span & rank2 : calling \"spannel\" .." #~ msgstr "span & rank2 : wywoÅ‚ywanie \"spannel\" .." # cluster/R/silhouette.R: 178 # gettextf("Silhouette of %d units in %d clusters from %s:", sum(csiz), k, deparse(x$call), domain = "R-cluster") # cluster/R/silhouette.R: 181 # gettextf("Silhouette of %d units in %d clusters from %s:", sum(csiz), k, deparse(x$call), domain = "R-cluster") #~ msgid "Silhouette of %d units in %d clusters from %s:" #~ msgstr "Sylwetka %d jednostek w %d klastrach z %s:" # cluster/R/silhouette.R: 179 # gettextf("Cluster sizes, ids = (%s), and average silhouette widths:", paste(x$codes, collapse=", "), domain = "R-cluster") # cluster/R/silhouette.R: 186 # gettextf("Cluster sizes, ids = (%s), and average silhouette widths:", paste(x$codes, collapse=", "), domain = "R-cluster") #~ msgid "Cluster sizes, ids = (%s), and average silhouette widths:" #~ msgstr "Rozmiary grup, ids = (%s), oraz przeciÄ™tne szerokoÅ›ci sylwetek:" # cluster/R/silhouette.R: 182 # gettextf("Cluster sizes and average silhouette widths:", domain = "R-cluster") # cluster/R/silhouette.R: 189 # gettext("Cluster sizes and average silhouette widths:", domain = "R-cluster") #~ msgid "Cluster sizes and average silhouette widths:" #~ msgstr "Rozmiary grup oraz przeciÄ™tne szerokoÅ›ci sylwetek:" # cluster/R/silhouette.R: 185 # gettextf("Silhouette of %d units in %d clusters:", sum(csiz), k, domain = "R-cluster") # cluster/R/silhouette.R: 188 # gettextf("Silhouette of %d units in %d clusters:", sum(csiz), k, domain = "R-cluster") #~ msgid "Silhouette of %d units in %d clusters:" #~ msgstr "Sylwetka %d jednostek w %d klastrach:" # cluster/R/silhouette.R: 194 # gettext("Individual silhouette widths:", domain = "R-cluster") #~ msgid "Individual silhouette widths:" #~ msgstr "Indywidualne szerokoÅ›ci sylwetki:" # cluster/R/silhouette.R: 220 # gettext("Silhouette plot", domain = "R-cluster") #~ msgid "Silhouette plot" #~ msgstr "Wykres sylwetki" # cluster/R/silhouette.R: 224 # gettextf("Silhouette plot of %s", sub("^FF","", deparse(cll)), domain = "R-cluster") #~ msgid "Silhouette plot of %s" #~ msgstr "Wykres sylwetki %s" # cluster/R/silhouette.R: 230 # gettext("Average silhouette width:", domain = "R-cluster") #~ msgid "Average silhouette width:" #~ msgstr "PrzeciÄ™tna szerokość sylwetki:" # cluster/R/daisy.R: 200 # sprintf(ngettext(x$n, "%d dissimilarity, summarized:", "%d dissimilarities, summarized:", domain = "R-cluster"), x$n) #~ msgid "%d dissimilarity, summarized:" #~ msgid_plural "%d dissimilarities, summarized:" #~ msgstr[0] "%d odmienność, podsumowanie:" #~ msgstr[1] "%d odmiennoÅ›ci, podsumowanie:" #~ msgstr[2] "%d odmiennoÅ›ci, podsumowanie:" #~ msgid "" #~ "%d observations (%s ...)\n" #~ "\thave *only* NAs --> na.omit() them for clustering!" #~ msgstr "" #~ "%d obserwacji (%s ...)\n" #~ "\tmajÄ… *tylko* wartoÅ›ci NA --> pomijanie ich w grupowaniu" #~ msgid "hence, area = %s" #~ msgstr "tak wiÄ™c powierzchnia = %s" #, fuzzy #~ msgid "R-cluster" #~ msgstr "L-grupy:" cluster/po/fr.po0000644000176200001440000000331414036313671013325 0ustar liggesusers# Translation of src/library/Recommended/cluster/po/cluster.pot to French # Copyright (C) 2013 The R Foundation # This file is distributed under the same license as the R package. # Philippe.Grosjean@umons.ac.be, 2014-2021 msgid "" msgstr "" "Project-Id-Version: cluster 2.0.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-30 22:00+0100\n" "PO-Revision-Date: 2021-02-11 10:56+0100\n" "Last-Translator: Philippe Grosjean \n" "Language-Team: R Core \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.4.2\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #: clara.c:101 #, c-format msgid "C level clara(): random k=%d > n **\n" msgstr "Code C de clara(): random k=%d > n **\n" #: clara.c:312 #, c-format msgid "clara()'s C level dysta2(nsam=%d, p=%d, nbest=%d, n=%d) gave 'toomany_NA'" msgstr "code C de clara(), dysta2(nsam=%d, p=%d, nbest=%d, n=%d) a donné 'toomany_NA'" #: clara.c:348 clara.c:353 #, c-format msgid "C level dysta2(): nsel[%s= %d] = %d is outside 0..n, n=%d" msgstr "Code C de dysta2(): nsel[%s= %d] = %d est en dehors de la plage 0..n, n=%d" #: pam.c:161 msgid "Invalid 'medoids'" msgstr "Les 'medoids' sont incorrects" #: pam.c:1011 #, c-format msgid "pam(): Bug in C level cstat(), k=%d: ntt=0" msgstr "pam() : Bogue dans le code C de cstat(), k=%d: ntt=0" #: twins.c:153 #, c-format msgid "agnes(method=%d, par.method=*) lead to invalid merge; step %d, D(.,.)=%g" msgstr "agnes(method=%d, par.method=*) conduit à une fusion incorrecte ; étape %d, D(.,.)=%g" #: twins.c:260 #, c-format msgid "invalid method (code %d)" msgstr "méthode incorrecte (code %d)" cluster/po/R-de.po0000644000176200001440000003571414044453203013511 0ustar liggesusers# Translation of src/library/Recommended/cluster/po/R-cluster.pot to German # Copyright (C) 2013-2019 The R Foundation # This file is distributed under the same license as the R package. msgid "" msgstr "" "Project-Id-Version: R-4.1.0 cluster 2.1.2\n" "Report-Msgid-Bugs-To: bugs.r-project.org\n" "POT-Creation-Date: 2021-01-30 22:00\n" "PO-Revision-Date: 2021-05-04 15:37+0200\n" "Last-Translator: Detlef Steuer \n" "Language-Team: R Core Team = 3 dim." msgstr "ellipsoidPoints() noch nicht für Dimensionen p>=3 implementiert" msgid "'k' (number of clusters) must be in {1,2, .., n/2 -1}" msgstr "'k' (Anzahl Cluster) muss aus {1, 2, ..., n/2 -1} sein" msgid "'memb.exp' must be a finite number > 1" msgstr "'memb.exp' muss endliche Zahl > 1 sein" msgid "'maxit' must be non-negative integer" msgstr "'maxit' muss nicht-negative Zahl sein" msgid "'iniMem.p' must be a nonnegative n * k matrix with rowSums == 1" msgstr "" "'iniMem.p' muss eine nicht-negative n x k Matrix mit Zeilensummen == 1 sein" msgid "FANNY algorithm has not converged in 'maxit' = %d iterations" msgstr "FANNY Algorithmus ist in 'maxit' = %d Iterationen nicht konvergiert" msgid "the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ?" msgstr "" "die Mitgliedswerte sind alle sehr nah an 1/k. Evtl. 'memb.exp' reduzieren?" msgid "'m', a membership matrix, must be nonnegative with rowSums == 1" msgstr "" "'m' ist eine Mitgliedswertmatrix, muss nicht-negativ sein mit Zeilensummen " "== 1" msgid "'n' must be >= 2" msgstr "'n' muss >= 2 sein" msgid "x must be a matrix or data frame." msgstr "x muss eine Matrix oder Dataframe sein" msgid "" "All variables must be binary (e.g., a factor with 2 levels, both present)." msgstr "" "Alle Variablen müssen binär sein (z.B. Faktor mit 2 vorhandenen Stufen)." msgid "mona() needs at least p >= 2 variables (in current implementation)" msgstr "" "mona() (in der aktuellen Implementierung) benötigt mindestens p >= 2 " "Variablen" msgid "No clustering performed, an object was found with all values missing." msgstr "" "Keine Clusterung durchgeführt. Objekt gefunden, bei dem alle Werte fehlend " "sind." msgid "" "No clustering performed, found variable with more than half values missing." msgstr "" "Keine Clusterung durchgeführt. Variable gefunden, mit mehr als der Hälfte " "fehlenden Werten." msgid "" "No clustering performed, a variable was found with all non missing values " "identical." msgstr "" "Keine Clusterung durchgeführt. Variable gefunden, bei der alle nicht " "fehlenden Werte identisch sind." msgid "No clustering performed, all variables have at least one missing value." msgstr "" "Keine Clusterung durchgeführt. Alle Variablen haben mindestens einen " "fehlenden Wert." msgid "Cannot keep data when 'x' is a dissimilarity!" msgstr "" "Kann Datenmatrix 'data' nicht beibehalten wenn 'x' eine 'dissimilarity' ist!" msgid "have %d observations, but not more than %d are allowed" msgstr "habe %d Beobachtungen, aber mehr als %d nicht erlaubt" msgid "Number of clusters 'k' must be in {1,2, .., n-1}; hence n >= 2" msgstr "Anzahl der Cluster 'k' muss auch {1, 2, ..., n-1} sein; deshalb n >= 2" msgid "Set either 'variant' or 'pamonce', but not both" msgstr "Entweder 'variant' oder 'pamonce' setzen, aber nicht beide" msgid "" "'medoids' must be NULL or vector of %d distinct indices in {1,2, .., n}, n=%d" msgstr "" "'medoids' muss NULL oder ein Vektor von %d verschiedenen Indizes aus {1, " "2,..., n}, n=%d sein" msgid "No clustering performed, NAs in the computed dissimilarity matrix." msgstr "" "Keine Clusterung durchgeführt, NAs in der berechneten Unähnlichkeitsmatrix." msgid "error from .C(cl_pam, *): invalid medID's" msgstr "Fehler aus .C(cl_pam, *): unzulässige medID's" msgid "NA-values are not allowed in dist-like 'x'." msgstr "NAs nicht erlaubt in dist-ähnlichem 'x'." msgid "Distances must be result of dist or a square matrix." msgstr "" "Distanzen müssen ein Ergebnis von dist oder eine quadratische Matrix sein." msgid "the square matrix is not symmetric." msgstr "Die quadratische Matrix ist nicht symmetrisch." msgid ">>>>> funny case in clusplot.default() -- please report!" msgstr "" ">>>>> komische Sache in clusplot.default() -- bitte an den Entwickler senden!" msgid "x is not a data matrix" msgstr "x ist keine Datenmatrix" msgid "one or more objects contain only missing values" msgstr "eines oder mehrere Objekte enthalten nur fehlende Werte" msgid "one or more variables contain only missing values" msgstr "eine oder mehrere Variablen enthalten nur fehlende Werte" msgid "" "Missing values were displaced by the median of the corresponding variable(s)" msgstr "" "Fehlende Werte wurden durch den Median der korrespondierenden Variable(n) " "ersetzt" msgid "x is not numeric" msgstr "x ist nicht numerisch" msgid "The clustering vector is of incorrect length" msgstr "Der Clustervektor hat eine falsche Länge" msgid "NA-values are not allowed in clustering vector" msgstr "NAs im Clustervektor nicht erlaubt" msgid "" "Error in C routine for the spanning ellipsoid,\n" " rank problem??" msgstr "Fehler im C-Kode für den aufspannenden Ellipsoiden, Rangproblem?" msgid "'col.clus' should have length 4 when color is TRUE" msgstr "'col.clus' sollte Länge 4 haben, wenn color auf TRUE gesetzt ist" msgid "no diss nor data found, nor the original argument of %s" msgstr "" "weder diss noch data gefunden, ebensowenig das ursprüngliche Argument von %s" msgid "no diss nor data found for clusplot()'" msgstr "weder diss noch data für 'clusplot()' gefunden" msgid "invalid partition object" msgstr "unzulässiges Partitionsobjekt" msgid "" "full silhouette is only available for results of 'clara(*, keep.data = TRUE)'" msgstr "" "die volle Silhoutte ist nur verfügbar für Resultate von 'clara(*, keep." "data=TRUE)'" msgid "specified both 'full' and 'subset'; will use 'subset'" msgstr "'full' und 'subset' angegeben; nutze 'subset'" msgid "'full' must be FALSE, TRUE, or a number in [0, 1]" msgstr "'full' muss FALSE, TRUE oder eine Zahl aus [0, 1] sein" msgid "'x' must only have integer codes" msgstr "'x' darf nur ganzzahlige Kodes enthalten" msgid "Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'" msgstr "" "Benötige entweder Unähnlichkeitsmatrix 'dist' oder diss.matrix 'dmatrix'" msgid "'dmatrix' is not a dissimilarity matrix compatible to 'x'" msgstr "'dmatrix' ist keine zu 'x' kompatible Unähnlichkeitsmatrix " msgid "clustering 'x' and dissimilarity 'dist' are incompatible" msgstr "Clusterung 'x' und Unähnlichkeitsmatrix 'dist' sind inkompatibel" msgid "invalid silhouette structure" msgstr "unzulässige Silhouttenstruktur" msgid "invalid 'silhouette' object" msgstr "unzulässiges 'silhouette' Objekt" msgid "No valid silhouette information (#{clusters} =? 1)" msgstr "keine gültige Silhouetteninformation (#{clusters} =? 1)" msgid "Observation %s has *only* NAs --> omit it for clustering" msgid_plural "Observations %s have *only* NAs --> omit them for clustering!" msgstr[0] "Beobachtung %s hat *nur* NAs --> ausgelassen für Clustering" msgstr[1] "Beobachtungen %s haben *nur* NAs --> ausgelassen für Clustering" msgid "%d observation (%s) has *only* NAs --> omit them for clustering!" msgid_plural "" "%d observations (%s ...) have *only* NAs --> omit them for clustering!" msgstr[0] "%d Beobachtung (%s) hat *nur* NAs --> ausgelassen für Clustering" msgstr[1] "" "%d Beobachtungen (%s) haben *nur* NAs --> ausgelassen für Clustering" msgid "setting 'logical' variable %s to type 'asymm'" msgid_plural "setting 'logical' variables %s to type 'asymm'" msgstr[0] "setze 'logical' Variable %s auf Typ 'asymm'" msgstr[1] "setze 'logical' Variablen %s auf Typ 'asymm'" #~ msgid "NAdiss" #~ msgstr "NAdiss" #~ msgid "non.diss" #~ msgstr "non.diss" #~ msgid "no distance can be computed." #~ msgstr "keine Entfernung berechnent werden kann" #~ msgid "For each of the" #~ msgstr "Für jede der" #~ msgid "" #~ "samples, at least one object was found which\n" #~ " could not" #~ msgstr "Stichproben wurde mindestens ein Objekt gefunden, das nicht" #~ msgid "be assigned to a cluster (because of missing values)." #~ msgstr "einem Cluster zugeordnet werden konnte (wegen fehlender Werte)" #~ msgid "invalid" #~ msgstr "unzulässiger" #~ msgid "type" #~ msgstr "Typ" #~ msgid "type$" #~ msgstr "type$" #~ msgid "binary variable(s)" #~ msgstr "binäre Variable(n)" #~ msgid "x" #~ msgstr "x" #~ msgid "has constant columns" #~ msgstr "hat konstante Spalten" #~ msgid "possibly not converged in" #~ msgstr "evtl nicht konvergiert in " #~ msgid "iterations" #~ msgstr "Iterationen" #~ msgid "'medoids' must be NULL or vector of" #~ msgstr "'medoids' muss NULL sein oder ein Vektor von" #~ msgid "rank problem??" #~ msgstr "evtl. Probleme mit dem Rang?" #~ msgid "'clara(*, keep.data = TRUE)'" #~ msgstr "'clara(*, keep.data = TRUE)'" #~ msgid "" #~ "No clustering performed, a variable was found with at least 50% missing " #~ "values." #~ msgstr "" #~ "Keine Clusterung durchgeführt. Variable mit mehr als 50% fehlender Werte." #~ msgid "No clustering performed," #~ msgstr "Clustering nicht durchgeführt," #~ msgid "Observations %s" #~ msgstr "Beobachtungen %s" #~ msgid "%d observations (%s ...)" #~ msgstr "%d Beobachtungen (%s ...)" #~ msgid "have *only* NAs --> na.omit() them for clustering!" #~ msgstr "haben *nur* NAs --> na.omit() diese für das Clustern" #~ msgid "s" #~ msgstr "n" #~ msgid "to type 'asymm'" #~ msgstr "auf Typ 'asymm'" cluster/po/R-ko.po0000644000176200001440000003645414005347355013543 0ustar liggesusers# Korean translations for cluster package. # Recommended/cluster/po/R-ko.po # Maintainer: Martin Maechler # # This file is distributed under the same license as the R cluster package. # Chel Hee Lee , 2013-2015. # # Reviewing process is completed (15-JAN-2015). # The original source code is reviewed (26-JAN-2015). # QC: PASS # Freezing on 06-FEB-2015 for R-3.1.3 # msgid "" msgstr "" "Project-Id-Version: cluster 1.15.2\n" "POT-Creation-Date: 2021-01-30 22:00\n" "PO-Revision-Date: 2015-02-06 21:56-0600\n" "Last-Translator:Chel Hee Lee \n" "Language-Team: Chel Hee Lee \n" "Language: ko\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" msgid "invalid clustering method" msgstr "군집방법(clustering method)ì˜ ì´ë¦„ì´ ì˜¬ë°”ë¥´ì§€ 않습니다." msgid "ambiguous clustering method" msgstr "불분명한 군집방법(clustering method)입니다." msgid "'par.method' must be of length 1, 3, or 4" msgstr "'par.method'ì˜ ê¸¸ì´ëŠ” 반드시 1, 3, ë˜ëŠ” 4ì´ì–´ì•¼ 합니다." msgid "NA-values in the dissimilarity matrix not allowed." msgstr "NAì˜ ê°’ì€ ë¹„ìœ ì‚¬ì„± 행렬(dissimilarity matrix)ì— ì‚¬ìš©ë  ìˆ˜ 없습니다." msgid "'x' is not and cannot be converted to class \"dissimilarity\"" msgstr "" "'x'는 \"dissimilarity\"ì´ë¼ëŠ” í´ëž˜ìŠ¤ê°€ 아니거나 í´ëž˜ìФ \"dissimilarity\"로 ì „" "환할 수 없습니다." msgid "x is not a numeric dataframe or matrix." msgstr "x는 수치형 ë°ì´í„° 프레임 ë˜ëŠ” í–‰ë ¬ì´ ì•„ë‹™ë‹ˆë‹¤." msgid "need at least 2 objects to cluster" msgstr "êµ°ì§‘(cluster)는 ì ì–´ë„ 2ê°œì˜ ê°ì²´ë¥¼ 필요로 합니다." msgid "No clustering performed, NA-values in the dissimilarity matrix." msgstr "" "비유사성 행렬(dissimilarity matrix)ì—서 NA ê°’ì´ ë°œê²¬ë˜ì—ˆê¸° ë•Œë¬¸ì— êµ°ì§‘í™” 과정" "ì´ ì‹¤í–‰ë˜ì§€ 않았습니다." msgid "'x' is a \"dist\" object, but should be a data matrix or frame" msgstr "" "'x'는 í´ëž˜ìФ \"dist\"를 가지는 ê°ì²´ì´ì§€ë§Œ, ë°ì´í„° 행렬 ë˜ëŠ” 프레임ì´ì–´ì•¼ 합니" "다." msgid "The number of cluster should be at least 1 and at most n-1." msgstr "" "êµ°ì§‘(cluster)ì˜ ê°œìˆ˜ëŠ” ì ì–´ë„ 1 ì´ìƒì´ë©° 최대 n-1 ì´ë‚´ì— 있어야 합니다." msgid "'sampsize' should be at least %d = max(2, 1+ number of clusters)" msgstr "'sampsize'는 최소 %d = max(2, 1 + êµ°ì§‘ì˜ ê°œìˆ˜)ê°€ ë˜ì–´ì•¼ 합니다." msgid "'sampsize' = %d should not be larger than the number of objects, %d" msgstr "'sampsize' = %1$d는 ê°ì²´ì˜ 개수 %2$d보다 í´ ìˆ˜ 없습니다." msgid "'samples' should be at least 1" msgstr "'samples'는 ì ì–´ë„ 1 ì´ìƒ ì´ì–´ì•¼ 합니다." msgid "when 'medoids.x' is FALSE, 'keep.data' must be too" msgstr "'medoids.x'ê°€ FALSEì¸ ê²½ìš°ì—는 'keep.data' 역시 FALSEì´ì–´ì•¼ 합니다." msgid "" "Distance computations with NAs: using correct instead of pre-2016 wrong " "formula.\n" "Use 'correct.d=FALSE' to get previous results or set 'correct.d=TRUE' " "explicitly\n" "to suppress this warning." msgstr "" #, fuzzy msgid "invalid 'correct.d'" msgstr "올바른 'twins' ê°ì²´ê°€ 아닙니다." msgid "" "Each of the random samples contains objects between which no distance can be " "computed." msgstr "" "ê°ê°ì˜ 무작위 í‘œë³¸ì€ ì„œë¡œê°„ì˜ ê±°ë¦¬ë¥¼ 계산할 수 없는 ê°ì²´ë“¤ì„ í¬í•¨í•˜ê³  있습니" "다." msgid "" "For each of the %d samples, at least one object was found which could not be " "assigned to a cluster (because of missing values)." msgstr "" "%dê°œì˜ í‘œë³¸ ê°ê°ì— 대해서 결측값으로 ì¸í•˜ì—¬ ì–´ëŠ êµ°ì§‘ì—ë„ ë°°ì •í•  수 없는 ê°ì²´" "를 ì ì–´ë„ 하나 ì´ìƒ 발견하였습니다." msgid "invalid 'jstop' from .C(cl_clara,.):" msgstr "" ".C(cl_clara,.)으로부터 얻어진 'jstop'는 다ìŒê³¼ ê°™ì€ ì´ìœ ë¡œ ì´ìƒí•©ë‹ˆë‹¤: " msgid "'B' has to be a positive integer" msgstr "'B'는 반드시 ì–‘ì˜ ì •ìˆ˜ì´ì–´ì•¼ 합니다." #, fuzzy msgid "invalid 'spaceH0':" msgstr "올바른 'twins' ê°ì²´ê°€ 아닙니다." msgid "index has to be a function or a list of function" msgstr "" msgid "invalid 'twins' object" msgstr "올바른 'twins' ê°ì²´ê°€ 아닙니다." msgid "x is not a dataframe or a numeric matrix." msgstr "x는 ë°ì´í„° í”„ë ˆìž„ì´ ì•„ë‹ˆê±°ë‚˜ 수치형 í–‰ë ¬ì´ ì•„ë‹™ë‹ˆë‹¤." msgid "invalid %s; must be named list" msgstr "" "사용할 수 있는 %sê°€ 아닙니다. 반드시 êµ¬ì„±ìš”ì†Œì— ì´ë¦„ì´ ë¶€ì—¬ëœ ë¦¬ìŠ¤íŠ¸(named " "list)ì´ì—¬ì•¼ 합니다." msgid "%s has invalid column names" msgstr "%s는 올바른 ì—´ì´ë¦„ì„ ê°€ì§€ê³  있지 않습니다." msgid "%s must be in 1:ncol(x)" msgstr "%s는 반드시 1:ncol(x)ë‚´ì— ìžˆì–´ì•¼ 합니다." msgid "%s must contain column names or numbers" msgstr "%s는 반드시 ì—´ ì´ë¦„ ë˜ëŠ” 번호를 í¬í•¨í•´ì•¼ 합니다." msgid "at least one binary variable has more than 2 levels." msgstr "" "ì ì–´ë„ 하나 ì´ìƒì˜ ì´í•­ë³€ìˆ˜(binary variable)ê°€ ë‘ ê°€ì§€ ì´ìƒì˜ 수준(levels)ì„ " "가지고 있습니다." msgid "at least one binary variable has not 2 different levels." msgstr "" "ì ì–´ë„ 하나 ì´ìƒì˜ ì´í•­ë³€ìˆ˜(binary variable)ì´ ì„œë¡œ 다른 ë‘ ê°€ì§€ ìˆ˜ì¤€ì„ ê°€ì§€" "ê³  있지 않습니다." msgid "at least one binary variable has values not in {0,1,NA}" msgstr "" "ì ì–´ë„ 하나 ì´ìƒì˜ ì´í•­ë³€ìˆ˜(binary variable)ì´ {0,1,NA} ì™¸ì˜ ê°’ì„ ê°€ì§€ê³  있습" "니다." msgid "binary variable(s) %s treated as interval scaled" msgstr "" "ì´í•­ë³€ìˆ˜(binary variable) %s는 구간척ë„(interval scale)로서 다루어집니다. " msgid "%s has constant columns %s; these are standardized to 0" msgstr "" "%1$s는 ìƒìˆ˜(constant)ê°’ì„ ê°€ì§€ëŠ” ì—´ %2$s를 가집니다. ì´ë“¤ì€ 0으로 표준화" "(standardized)ë©ë‹ˆë‹¤." msgid "with mixed variables, metric \"gower\" is used automatically" msgstr "" "혼합형 변수(mixed variables)를 ì´ìš©í•  때는 metricì€ ìžë™ìœ¼ë¡œ \"gower\"ê°€ 사용" "ë©ë‹ˆë‹¤." msgid "'weights' must be of length p (or 1)" msgstr "'weights'ì˜ ê¸¸ì´ëŠ” 반드시 p (ë˜ëŠ” 1)ì´ì–´ì•¼ 합니다." msgid "invalid type %s for column numbers %s" msgstr "행번호 %2$sì— ìž˜ëª»ëœ ìœ í˜•(type) %1$sì´ ì£¼ì–´ì¡ŒìŠµë‹ˆë‹¤." msgid "NA values in the dissimilarity matrix not allowed." msgstr "비유사성 행렬(dissimilarity matrix)는 NA ê°’ì„ ê°€ì§ˆ 수 없습니다." msgid "No clustering performed, NA's in dissimilarity matrix." msgstr "" "비유사성 행렬(dissimilarity matrix)ì— NAê°€ 있기 때문ì—, êµ°ì§‘í™” ê³¼ì •ì´ ì‹¤í–‰ë˜" "ì§€ 않았습니다." msgid "'x' must be numeric n x p matrix" msgstr "'x'는 반드시 í¬ê¸°ê°€ n x pì¸ ìˆ˜ì¹˜í˜• 행렬ì´ì–´ì•¼ 합니다." msgid "omitting NAs" msgstr "NA를 삭제합니다." msgid "no points without missing values" msgstr "ê²°ì¸¡ê°’ë“¤ì„ ì œì™¸í•˜ë©´ 사용가능한 í¬ì¸íŠ¸ë“¤ì´ ì—†ìŠµë‹ˆë‹¤." msgid "computed some negative or all 0 probabilities" msgstr "í™•ë¥ ê°’ì´ ëª¨ë‘ 0ì´ê±°ë‚˜ ì¼ë¶€ê°€ ìŒìˆ˜ë¡œ ì‚°ì¶œë˜ì—ˆìŠµë‹ˆë‹¤." msgid "algorithm possibly not converged in %d iterations" msgstr "ì•Œê³ ë¦¬ì¦˜ì˜ %dë²ˆì˜ ë°˜ë³µìˆ˜í–‰ì—ë„ ìˆ˜ë ´í•˜ì§€ ì•Šì„ ìˆ˜ 있습니다." msgid "'A' must be p x p cov-matrix defining an ellipsoid" msgstr "" "'A'는 반드시 타ì›(ellipsoid)를 ì •ì˜í•˜ëŠ” í¬ê¸°ê°€ p x pì¸ ê³µë¶„ì‚°í–‰ë ¬(cov-matrix)" "ì´ì–´ì•¼ 합니다." msgid "ellipsoidPoints() not yet implemented for p >= 3 dim." msgstr "ellipsoidPoints()는 p >= 3 ì¸ê²½ìš°ì—는 ì•„ì§ êµ¬í˜„ë˜ì§€ 않았습니다." msgid "'k' (number of clusters) must be in {1,2, .., n/2 -1}" msgstr "'k' (êµ°ì§‘ì˜ ê°œìˆ˜)는 반드시 {1,2, .., n/2 -1} ë‚´ì— ì¡´ìž¬í•´ì•¼ 합니다." msgid "'memb.exp' must be a finite number > 1" msgstr "'memb.exp'는 반드시 1보다 í° ìœ í•œí•œ(finite) 숫ìžì´ì–´ì•¼ 합니다." msgid "'maxit' must be non-negative integer" msgstr "'maxit'ì€ ë°˜ë“œì‹œ ìŒì´ 아닌 정수ì´ì–´ì•¼ 합니다." msgid "'iniMem.p' must be a nonnegative n * k matrix with rowSums == 1" msgstr "" "'iniMem.p'는 반드시 í¬ê¸°ê°€ n * k ì¸ ë¹„ìŒìˆ˜ 행렬(nonnegative matrix)ì´ì–´ì•¼ 하" "ë©°, ì´ í–‰ë ¬ì˜ rowSums == 1 ì´ì–´ì•¼ 합니다." msgid "FANNY algorithm has not converged in 'maxit' = %d iterations" msgstr "FANNY ì•Œê³ ë¦¬ì¦˜ì€ 'maxit' = %dë²ˆì˜ ë°˜ë³µìˆ˜í–‰ì—ë„ ìˆ˜ë ´í•˜ì§€ 않았습니다." msgid "the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ?" msgstr "" "멤버쉽(membership) 전부가 1/kì— ë§¤ìš° ê°€ê¹ìŠµë‹ˆë‹¤. ì•„ë§ˆë„ 'memb.exp'를 줄여보" "는 ê²ƒì€ ì–´ë–¨ê¹Œìš”?" msgid "'m', a membership matrix, must be nonnegative with rowSums == 1" msgstr "" "멤버쉽 행렬(membership matrix) 'm'ì€ ë°˜ë“œì‹œ ìŒìˆ˜ë¥¼ 가지지 않으며 rowSums == 1" "ì´ì–´ì•¼ 합니다." msgid "'n' must be >= 2" msgstr "'n'는 반드시 2보다 í¬ê±°ë‚˜ 같아야 합니다." msgid "x must be a matrix or data frame." msgstr "x는 반드시 행렬 ë˜ëŠ” ë°ì´í„° 프레임ì´ì–´ì•¼ 합니다." #, fuzzy msgid "" "All variables must be binary (e.g., a factor with 2 levels, both present)." msgstr "" "모든 ë³€ìˆ˜ë“¤ì€ ë°˜ë“œì‹œ 2ê°œì˜ ìˆ˜ì¤€(levels)으로 ì´ë£¨ì–´ì§„ ìš”ì¸(factor)ì´ì–´ì•¼ 합니" "다." msgid "mona() needs at least p >= 2 variables (in current implementation)" msgstr "" msgid "No clustering performed, an object was found with all values missing." msgstr "모든 ê°’ì´ ê²°ì¸¡ëœ ê°ì²´ê°€ 발견ë˜ì–´ êµ°ì§‘í™” ê³¼ì •ì´ ìˆ˜í–‰ë˜ì§€ 않았습니다." msgid "" "No clustering performed, found variable with more than half values missing." msgstr "" "절반 ì´ìƒì˜ ê°’ë“¤ì´ ê²°ì¸¡ëœ ë³€ìˆ˜ê°€ 발견ë˜ì–´ êµ°ì§‘í™” ê³¼ì •ì´ ìˆ˜í–‰ë˜ì§€ 않았습니다." msgid "" "No clustering performed, a variable was found with all non missing values " "identical." msgstr "" "결측ë˜ì§€ ì•Šì€ ëª¨ë“  ê°’ë“¤ì´ ë™ì¼í•œ 변수가 발견ë˜ì–´ êµ°ì§‘í™” ê³¼ì •ì´ ìˆ˜í–‰ë˜ì§€ 않았" "습니다." msgid "No clustering performed, all variables have at least one missing value." msgstr "" "모든 ë³€ìˆ˜ë“¤ì´ ì ì–´ë„ 하나 ì´ìƒì˜ ê²°ì¸¡ê°’ì„ ê°€ì§€ê¸° ë•Œë¬¸ì— êµ°ì§‘í™” ê³¼ì •ì´ ìˆ˜í–‰ë˜" "ì§€ 않았습니다." msgid "Cannot keep data when 'x' is a dissimilarity!" msgstr "" msgid "have %d observations, but not more than %d are allowed" msgstr "" msgid "Number of clusters 'k' must be in {1,2, .., n-1}; hence n >= 2" msgstr "" "êµ°ì§‘(clusters)ì˜ ê°œìˆ˜ 'k'는 반드시 {1,2, .., n-1}ë‚´ì— ì¡´ìž¬í•´ì•¼ 하므로 n >= 2 " "입니다." msgid "Set either 'variant' or 'pamonce', but not both" msgstr "" msgid "" "'medoids' must be NULL or vector of %d distinct indices in {1,2, .., n}, n=%d" msgstr "" "'medoids'는 반드시 NULL ë˜ëŠ” {1,2, .., n}으로부터 %1$dê°œì˜ êµ¬ë¶„ë˜ëŠ” ì¸ë±ìŠ¤ë¥¼ " "가진 벡터입니다 (n=%2$d). " msgid "No clustering performed, NAs in the computed dissimilarity matrix." msgstr "" "ê³„ì‚°ëœ ë¹„ìœ ì‚¬ì„± 행렬(dissimilarity matrix) ë‚´ì— NAê°€ 존재하여 êµ°ì§‘í™” ê³¼ì •ì´ " "수행ë˜ì§€ 않았습니다." msgid "error from .C(cl_pam, *): invalid medID's" msgstr ".C(cl_pam, *)으로부터 ì—러가 ë°œìƒí–ˆìŠµë‹ˆë‹¤: medIDê°€ 올바르지 않습니다." msgid "NA-values are not allowed in dist-like 'x'." msgstr "'x'는 NA를 가질 수 없습니다." msgid "Distances must be result of dist or a square matrix." msgstr "" "거리(distances)는 반드시 dist ë˜ëŠ” 정방행렬(square matrix)ì˜ ê²°ê³¼ì´ì–´ì•¼ 합니" "다." msgid "the square matrix is not symmetric." msgstr "대칭(symmetric)ì ì¸ ì •ë°©í–‰ë ¬ì´ ì•„ë‹™ë‹ˆë‹¤." msgid ">>>>> funny case in clusplot.default() -- please report!" msgstr "" ">>>>> clusplot.default()ì—서 예ìƒì¹˜ 못한 경우가 ë°œìƒí–ˆìŠµë‹ˆë‹¤ -- ë³´ê³ í•´ 주시" "길 ë¶€íƒë“œë¦½ë‹ˆë‹¤!" msgid "x is not a data matrix" msgstr "x는 ë°ì´í„° 행렬(data matrix)ì´ ì•„ë‹™ë‹ˆë‹¤." msgid "one or more objects contain only missing values" msgstr "하나 ë˜ëŠ” ê·¸ ì´ìƒì˜ ê°ì²´ë“¤ì´ 오로지 ê²°ì¸¡ê°’ë§Œì„ í¬í•¨í•˜ê³  있습니다." msgid "one or more variables contain only missing values" msgstr "하나 ë˜ëŠ” ê·¸ ì´ìƒì˜ ë³€ìˆ˜ë“¤ì´ ì˜¤ë¡œì§€ ê²°ì¸¡ê°’ë§Œì„ í¬í•¨í•˜ê³  있습니다." msgid "" "Missing values were displaced by the median of the corresponding variable(s)" msgstr "ê²°ì¸¡ê°’ë“¤ì€ ëŒ€ì‘변수(들)ì˜ ì¤‘ì•™ê°’ìœ¼ë¡œ 대체ë˜ì—ˆìŠµë‹ˆë‹¤." msgid "x is not numeric" msgstr "x는 수치형(numeric)ì´ ì•„ë‹™ë‹ˆë‹¤." msgid "The clustering vector is of incorrect length" msgstr "군집벡터(clustering vector)ì˜ ê¸¸ì´ê°€ 올바르지 않습니다." msgid "NA-values are not allowed in clustering vector" msgstr "군집벡터(clustering vector)ì—서는 NAê°€ 허용ë˜ì§€ 않습니다." #, fuzzy msgid "" "Error in C routine for the spanning ellipsoid,\n" " rank problem??" msgstr "" "ìŠ¤íŒ¨ë‹ íƒ€ì›(spanning ellipsoid)를 ìƒì„±í•˜ëŠ” í¬íŠ¸ëž€ 루틴(Fortran routine)ì—서 " "ì—러가 ë°œìƒí–ˆìŠµë‹ˆë‹¤. \n" " 위수(rank) 문제ì¸ê°€ìš”??" msgid "'col.clus' should have length 4 when color is TRUE" msgstr "colorê°€ TRUEì¼ ë•Œ, 'col.clus'ì˜ ê¸¸ì´ëŠ” 반드시 4ì´ì–´ì•¼ 합니다." msgid "no diss nor data found, nor the original argument of %s" msgstr "" "diss와 data ëª¨ë‘ ì°¾ì„ ìˆ˜ ì—†ì„ ë¿ë§Œ ì•„ë‹ˆë¼ ì›ëž˜ì˜ ì¸ìž %s ë˜í•œ ì°¾ì„ ìˆ˜ 없습니" "다." msgid "no diss nor data found for clusplot()'" msgstr "clusplot()ì— ì‚¬ìš©ë  diss와 data ëª¨ë‘ ì°¾ì„ ìˆ˜ 없습니다." msgid "invalid partition object" msgstr "partition ê°ì²´ê°€ 유효하지 않습니다." msgid "" "full silhouette is only available for results of 'clara(*, keep.data = TRUE)'" msgstr "" "full silhouette는 'clara(*, keep.data = TRUE)'ì˜ ê²°ê³¼ë§Œì— ì˜¤ë¡œì§€ 사용할 수 있" "습니다." msgid "specified both 'full' and 'subset'; will use 'subset'" msgstr "" msgid "'full' must be FALSE, TRUE, or a number in [0, 1]" msgstr "" msgid "'x' must only have integer codes" msgstr "'x'는 오로지 정수형 코드(codes)ë§Œì„ ê°€ì§ˆ 수 있습니다." msgid "Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'" msgstr "" "dissimilarity 'dist' ë˜ëŠ” diss.matrix 'dmatrix' 둘 ì¤‘ì— í•˜ë‚˜ê°€ 필요합니다." msgid "'dmatrix' is not a dissimilarity matrix compatible to 'x'" msgstr "" "'dmatrix'는 'x'ì— ë¶€í•©í•˜ëŠ” (ë˜ëŠ” 사용할 수 있는) 비유사성 행렬(dissimilarity " "matrix)ì´ ì•„ë‹™ë‹ˆë‹¤." msgid "clustering 'x' and dissimilarity 'dist' are incompatible" msgstr "'x'와 'dist'ê°€ 서로 부합하지 않습니다." msgid "invalid silhouette structure" msgstr "silhouette 구조가 올바르지 않습니다." msgid "invalid 'silhouette' object" msgstr "'silhouette' ê°ì²´ê°€ 올바르지 않습니다." msgid "No valid silhouette information (#{clusters} =? 1)" msgstr "유효한 silhouette ì •ë³´ê°€ 없습니다 (#{clusters} =? 1)" msgid "Observation %s has *only* NAs --> omit it for clustering" msgid_plural "Observations %s have *only* NAs --> omit them for clustering!" msgstr[0] "" "관측값 %s는 *오로지* NAë§Œì„ ê°€ì§‘ë‹ˆë‹¤ --> 군집화를 위하여 ì´ê²ƒë“¤ì„ 제거합니다!" msgid "%d observation (%s) has *only* NAs --> omit them for clustering!" msgid_plural "" "%d observations (%s ...) have *only* NAs --> omit them for clustering!" msgstr[0] "" "%dê°œì˜ ê´€ì¸¡ê°’ë“¤ì´ (%s) *오로지* NAë§Œì„ ê°€ì§‘ë‹ˆë‹¤ --> 군집화를 위하여 ì´ë“¤ì„ ì œ" "거합니다!" msgid "setting 'logical' variable %s to type 'asymm'" msgid_plural "setting 'logical' variables %s to type 'asymm'" msgstr[0] "'logical' 변수 %s를 유형(type) 'asymm'으로 설정합니다." cluster/po/R-en@quot.po0000644000176200001440000002637414764126505014551 0ustar liggesusers# All this catalog "translates" are quotation characters. # The msgids must be ASCII and therefore cannot contain real quotation # characters, only substitutes like grave accent (0x60), apostrophe (0x27) # and double quote (0x22). These substitutes look strange; see # http://www.cl.cam.ac.uk/~mgk25/ucs/quotes.html # # This catalog translates grave accent (0x60) and apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019). # It also translates pairs of apostrophe (0x27) to # left single quotation mark (U+2018) and right single quotation mark (U+2019) # and pairs of quotation mark (0x22) to # left double quotation mark (U+201C) and right double quotation mark (U+201D). # # When output to an UTF-8 terminal, the quotation characters appear perfectly. # When output to an ISO-8859-1 terminal, the single quotation marks are # transliterated to apostrophes (by iconv in glibc 2.2 or newer) or to # grave/acute accent (by libiconv), and the double quotation marks are # transliterated to 0x22. # When output to an ASCII terminal, the single quotation marks are # transliterated to apostrophes, and the double quotation marks are # transliterated to 0x22. # msgid "" msgstr "" "Project-Id-Version: R 2.15.1\n" "Report-Msgid-Bugs-To: bugs.r-project.org\n" "POT-Creation-Date: 2012-08-21 22:49\n" "PO-Revision-Date: 2012-08-21 22:49\n" "Last-Translator: Automatically generated\n" "Language-Team: none\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: en\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "invalid clustering method" msgstr "invalid clustering method" msgid "ambiguous clustering method" msgstr "ambiguous clustering method" msgid "'par.method' must be of length 1, 3, or 4" msgstr "‘par.method’ must be of length 1, 3, or 4" msgid "NAdiss" msgstr "NAdiss" msgid "non.diss" msgstr "non.diss" msgid "x is not a numeric dataframe or matrix." msgstr "x is not a numeric dataframe or matrix." msgid "need at least 2 objects to cluster" msgstr "need at least 2 objects to cluster" msgid "No clustering performed, NA-values in the dissimilarity matrix." msgstr "No clustering performed, NA-values in the dissimilarity matrix." msgid "'x' is a \"dist\" object, but should be a data matrix or frame" msgstr "‘x’ is a \"dist\" object, but should be a data matrix or frame" msgid "The number of cluster should be at least 1 and at most n-1." msgstr "The number of cluster should be at least 1 and at most n-1." msgid "'sampsize' should be at least %d = max(2, 1+ number of clusters)" msgstr "‘sampsize’ should be at least %d = max(2, 1+ number of clusters)" msgid "'sampsize' = %d should not be larger than the number of objects, %d" msgstr "‘sampsize’ = %d should not be larger than the number of objects, %d" msgid "'samples' should be at least 1" msgstr "‘samples’ should be at least 1" msgid "when 'medoids.x' is FALSE, 'keep.data' must be too" msgstr "when ‘medoids.x’ is FALSE, ‘keep.data’ must be too" msgid "Each of the random samples contains objects between which" msgstr "Each of the random samples contains objects between which" msgid "no distance can be computed." msgstr "no distance can be computed." msgid "For each of the" msgstr "For each of the" msgid "" "samples, at least one object was found which\n" " could not" msgstr "" "samples, at least one object was found which\n" " could not" msgid "be assigned to a cluster (because of missing values)." msgstr "be assigned to a cluster (because of missing values)." msgid "invalid 'jstop' from .C(cl_clara,.):" msgstr "invalid ‘jstop’ from .C(cl_clara,.):" msgid "'B' has to be a positive integer" msgstr "‘B’ has to be a positive integer" msgid "invalid 'twins' object" msgstr "invalid ‘twins’ object" msgid "x is not a dataframe or a numeric matrix." msgstr "x is not a dataframe or a numeric matrix." msgid "invalid" msgstr "invalid" msgid "type" msgstr "type" msgid "; must be named list" msgstr "; must be named list" msgid "type$" msgstr "type$" msgid "has invalid column names" msgstr "has invalid column names" msgid "must be in 1:ncol(x)" msgstr "must be in 1:ncol(x)" msgid "must contain column names or numbers" msgstr "must contain column names or numbers" msgid "at least one binary variable has more than 2 levels." msgstr "at least one binary variable has more than 2 levels." msgid "at least one binary variable has not 2 different levels." msgstr "at least one binary variable has not 2 different levels." msgid "at least one binary variable has values not in {0,1,NA}" msgstr "at least one binary variable has values not in {0,1,NA}" msgid "binary variable(s)" msgstr "binary variable(s)" msgid "treated as interval scaled" msgstr "treated as interval scaled" msgid "x" msgstr "x" msgid "has constant columns" msgstr "has constant columns" msgid "; these are standardized to 0" msgstr "; these are standardized to 0" msgid "with mixed variables, metric \"gower\" is used automatically" msgstr "with mixed variables, metric \"gower\" is used automatically" msgid "'weights' must be of length p (or 1)" msgstr "‘weights’ must be of length p (or 1)" msgid "invalid type" msgstr "invalid type" msgid "for column numbers" msgstr "for column numbers" msgid "No clustering performed, NA's in dissimilarity matrix." msgstr "No clustering performed, NA's in dissimilarity matrix." msgid "'x' must be numeric n x p matrix" msgstr "‘x’ must be numeric n x p matrix" msgid "omitting NAs" msgstr "omitting NAs" msgid "no points without missing values" msgstr "no points without missing values" msgid "computed some negative or all 0 'prob'abilities" msgstr "computed some negative or all 0 'prob'abilities" msgid "possibly not converged in" msgstr "possibly not converged in" msgid "iterations" msgstr "iterations" msgid "'A' must be p x p cov-matrix defining an ellipsoid" msgstr "‘A’ must be p x p cov-matrix defining an ellipsoid" msgid "ellipsoidPoints() not yet implemented for p >= 3 dim." msgstr "ellipsoidPoints() not yet implemented for p >= 3 dim." msgid "'k' (number of clusters) must be in {1,2, .., n/2 -1}" msgstr "‘k’ (number of clusters) must be in {1,2, .., n/2 -1}" msgid "'memb.exp' must be a finite number > 1" msgstr "‘memb.exp’ must be a finite number > 1" msgid "'maxit' must be non-negative integer" msgstr "‘maxit’ must be non-negative integer" msgid "'iniMem.p' must be a nonnegative n * k matrix with rowSums == 1" msgstr "‘iniMem.p’ must be a nonnegative n * k matrix with rowSums == 1" msgid "FANNY algorithm has not converged in 'maxit' = %d iterations" msgstr "FANNY algorithm has not converged in ‘maxit’ = %d iterations" msgid "the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ?" msgstr "the memberships are all very close to 1/k. Maybe decrease ‘memb.exp’ ?" msgid "'m', a membership matrix, must be nonnegative with rowSums == 1" msgstr "'m', a membership matrix, must be nonnegative with rowSums == 1" msgid "'n' must be >= 2" msgstr "‘n’ must be >= 2" msgid "x must be a matrix or data frame." msgstr "x must be a matrix or data frame." msgid "All variables must be binary (factor with 2 levels)." msgstr "All variables must be binary (factor with 2 levels)." msgid "No clustering performed," msgstr "No clustering performed," msgid "an object was found with all values missing." msgstr "an object was found with all values missing." msgid "a variable was found with at least 50% missing values." msgstr "a variable was found with at least 50% missing values." msgid "a variable was found with all non missing values identical." msgstr "a variable was found with all non missing values identical." msgid "all variables have at least one missing value." msgstr "all variables have at least one missing value." msgid "Number of clusters 'k' must be in {1,2, .., n-1}; hence n >= 2" msgstr "Number of clusters ‘k’ must be in {1,2, .., n-1}; hence n >= 2" msgid "'medoids' must be NULL or vector of" msgstr "‘medoids’ must be NULL or vector of" msgid "distinct indices in {1,2, .., n}, n=" msgstr "distinct indices in {1,2, .., n}, n=" msgid "No clustering performed, NAs in the computed dissimilarity matrix." msgstr "No clustering performed, NAs in the computed dissimilarity matrix." msgid "error from .C(cl_pam, *): invalid medID's" msgstr "error from .C(cl_pam, *): invalid medID's" msgid "NA-values are not allowed in dist-like 'x'." msgstr "NA-values are not allowed in dist-like ‘x’." msgid "Distances must be result of dist or a square matrix." msgstr "Distances must be result of dist or a square matrix." msgid "the square matrix is not symmetric." msgstr "the square matrix is not symmetric." msgid ">>>>> funny case in clusplot.default() -- please report!" msgstr ">>>>> funny case in clusplot.default() -- please report!" msgid "x is not a data matrix" msgstr "x is not a data matrix" msgid "one or more objects contain only missing values" msgstr "one or more objects contain only missing values" msgid "one or more variables contain only missing values" msgstr "one or more variables contain only missing values" msgid "" "Missing values were displaced by the median of the corresponding variable(s)" msgstr "" "Missing values were displaced by the median of the corresponding variable(s)" msgid "x is not numeric" msgstr "x is not numeric" msgid "The clustering vector is of incorrect length" msgstr "The clustering vector is of incorrect length" msgid "NA-values are not allowed in clustering vector" msgstr "NA-values are not allowed in clustering vector" msgid "Error in Fortran routine for the spanning ellipsoid," msgstr "Error in Fortran routine for the spanning ellipsoid," msgid "rank problem??" msgstr "rank problem??" msgid "'col.clus' should have length 4 when color is TRUE" msgstr "‘col.clus’ should have length 4 when color is TRUE" msgid "no diss nor data found, nor the original argument of" msgstr "no diss nor data found, nor the original argument of" msgid "no diss nor data found for clusplot()'" msgstr "no diss nor data found for clusplot()'" msgid "invalid partition object" msgstr "invalid partition object" msgid "full silhouette is only available for results of" msgstr "full silhouette is only available for results of" msgid "'clara(*, keep.data = TRUE)'" msgstr "'clara(*, keep.data = TRUE)'" msgid "'x' must only have integer codes" msgstr "‘x’ must only have integer codes" msgid "Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'" msgstr "Need either a dissimilarity ‘dist’ or diss.matrix ‘dmatrix’" msgid "'dmatrix' is not a dissimilarity matrix compatible to 'x'" msgstr "‘dmatrix’ is not a dissimilarity matrix compatible to ‘x’" msgid "clustering 'x' and dissimilarity 'dist' are incompatible" msgstr "clustering ‘x’ and dissimilarity ‘dist’ are incompatible" msgid "invalid silhouette structure" msgstr "invalid silhouette structure" msgid "invalid 'silhouette' object" msgstr "invalid ‘silhouette’ object" msgid "No valid silhouette information (#{clusters} =? 1)" msgstr "No valid silhouette information (#{clusters} =? 1)" msgid "setting 'logical' variable %s to type 'asymm'" msgid_plural "setting 'logical' variables %s to type 'asymm'" msgstr[0] "setting ‘logical’ variable %s to type ‘asymm’" msgstr[1] "setting ‘logical’ variables %s to type ‘asymm’" cluster/po/it.po0000644000176200001440000000333714005347355013341 0ustar liggesusers# R Italian translation # Copyright (C) The R Foundation # This file is distributed under the same license as the R package. # Daniele Medri , 2005-2020. # msgid "" msgstr "" "Project-Id-Version: cluster 2.0.8\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-30 22:00+0100\n" "PO-Revision-Date: \n" "Last-Translator: Daniele Medri \n" "Language-Team: Italian https://github.com/dmedri/R-italian-lang\n" "Language: it\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Poedit 2.2.1\n" #: clara.c:101 #, c-format msgid "C level clara(): random k=%d > n **\n" msgstr "Funzione clara() a livello C: random k=%d > n **\n" #: clara.c:312 #, c-format msgid "" "clara()'s C level dysta2(nsam=%d, p=%d, nbest=%d, n=%d) gave 'toomany_NA'" msgstr "" "clara() a livello C: dysta2(nsam=%d, p=%d, nbest=%d, n=%d) ha riportato " "'toomany_NA'" #: clara.c:348 clara.c:353 #, c-format msgid "C level dysta2(): nsel[%s= %d] = %d is outside 0..n, n=%d" msgstr "" "Funzione dysta2() a livello C: nsel[%s= %d] = %d è al di fuori di 0..n, n=%d" #: pam.c:161 msgid "Invalid 'medoids'" msgstr "'medoids' non valido" #: pam.c:1011 #, c-format msgid "pam(): Bug in C level cstat(), k=%d: ntt=0" msgstr "pam(): Bug a livello C di cstat(), k=%d: ntt=0" #: twins.c:153 #, c-format msgid "" "agnes(method=%d, par.method=*) lead to invalid merge; step %d, D(.,.)=%g" msgstr "" "agnes(method=%d, par.method=*) porta ad una unione non valida %d, D(.,.)=%g" #: twins.c:260 #, c-format msgid "invalid method (code %d)" msgstr "metodo non valido (codice %d)" cluster/po/cluster.pot0000644000176200001440000000232214217436352014564 0ustar liggesusers# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the cluster package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: cluster 2.1.3\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-08-19 20:27+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" #: clara.c:101 #, c-format msgid "C level clara(): random k=%d > n **\n" msgstr "" #: clara.c:312 #, c-format msgid "" "clara()'s C level dysta2(nsam=%d, p=%d, nbest=%d, n=%d) gave 'toomany_NA'" msgstr "" #: clara.c:348 clara.c:353 #, c-format msgid "C level dysta2(): nsel[%s= %d] = %d is outside 0..n, n=%d" msgstr "" #: pam.c:161 msgid "Invalid 'medoids'" msgstr "" #: pam.c:1011 #, c-format msgid "pam(): Bug in C level cstat(), k=%d: ntt=0" msgstr "" #: twins.c:153 #, c-format msgid "" "agnes(method=%d, par.method=*) lead to invalid merge; step %d, D(.,.)=%g" msgstr "" #: twins.c:260 #, c-format msgid "invalid method (code %d)" msgstr "" cluster/po/lt.po0000644000176200001440000000341314044453203013330 0ustar liggesusers# Lithuanian translations for cluster package. # Copyright (C) 2020--2021 The R Foundation # This file is distributed under the same license as the cluster package. # GabrielÄ— StupurienÄ— , 2020. # msgid "" msgstr "" "Project-Id-Version: cluster 2.1.1\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-30 22:00+0100\n" "PO-Revision-Date: 2021-02-12 11:04+0200\n" "Last-Translator: GabrielÄ— StupurienÄ— \n" "Language-Team: none\n" "Language: LT\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "X-Generator: Poedit 2.4.2\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && (n%100<11 || n%100>19) ? 0 : n" "%10>=2 && n%10<=9 && (n%100<11 || n%100>19) ? 1 : 2);\n" #: clara.c:101 #, c-format msgid "C level clara(): random k=%d > n **\n" msgstr "C lygio clara(): atsitiktinis k=%d > n **\n" #: clara.c:312 #, c-format msgid "" "clara()'s C level dysta2(nsam=%d, p=%d, nbest=%d, n=%d) gave 'toomany_NA'" msgstr "" "clara() C lygio dysta2(nsam=%d, p=%d, nbest=%d, n=%d) davÄ— 'toomany_NA'" #: clara.c:348 clara.c:353 #, c-format msgid "C level dysta2(): nsel[%s= %d] = %d is outside 0..n, n=%d" msgstr "C lygio dysta2(): nsel[%s= %d] = %d yra už 0..n, n=%d" #: pam.c:161 msgid "Invalid 'medoids'" msgstr "Neleistinas 'medoids'" #: pam.c:1011 #, c-format msgid "pam(): Bug in C level cstat(), k=%d: ntt=0" msgstr "pam(): Klaida C lygio cstat(), k = %d: ntt = 0" #: twins.c:153 #, c-format msgid "" "agnes(method=%d, par.method=*) lead to invalid merge; step %d, D(.,.)=%g" msgstr "" "agnes(method=%d, par.method=*) sukelia neleistinÄ… suliejimÄ…; žingsnis %d, " "D(.,.) =%g" #: twins.c:260 #, c-format msgid "invalid method (code %d)" msgstr "neleistinas metodas (kodas %d)" cluster/R/0000755000176200001440000000000014764135160012143 5ustar liggesuserscluster/R/internal.R0000644000176200001440000000271614514234154014104 0ustar liggesusers#### Cluster - Internal Utilities #### ============================ (new by Martin Maechler) ## This was size(); seems slightly useful in general sizeDiss <- function(d) { ## find 'n' for d == dissimilarity-like(), i.e. length(d)= n(n-1)/2 discr <- 1 + 8 * length(d) sqrtdiscr <- round(sqrt(discr)) if(sqrtdiscr^2 == discr) (1 + sqrtdiscr)/2 else NA } ##' Return indices to *permute* "dissimilarity" / "dist" entries for C (ex-Fortran) code setup ##' ##' Currently always used as: ##' n <- attr(x, "Size") ##' dv <- x[lower.to.upper.tri.inds(n)] ##' -->> FIXME: eventually do the above directly in C ##' @param n "Size" = number of objects, underlying the dist/dissimilarity ##' used in ./agnes.q, ./clara.q, ./diana.q und ./pam.q : ##' *somewhat* related to Matrix:::indTri() lower.to.upper.tri.inds <- function(n) { n1 <- as.integer(n - 1) if(n1 < 1) stop("'n' must be >= 2") else if(n1 == 1) 1L else rep(seq_len(n1), seq_len(n1)) + c(0L, unlist(lapply(2:n1, function(k) cumsum(c(0L, (n - 2L):(n - k)))))) } upper.to.lower.tri.inds <- function(n) { if((n2 <- as.integer(n - 2L)) < 0) stop("'n' must be >= 2") rep(1L + cumsum(0:n2), (n - 1):1) + unlist(lapply(0:n2, function(k) cumsum(k:n2))) } ## has been exported "for ever" meanabsdev <- function(y) mean(abs(y - mean(y, na.rm = TRUE)), na.rm = TRUE) ## ## if serious, it should be ## function(y, na.rm=FALSE) mean(abs(y - mean(y, na.rm=na.rm)), na.rm=na.rm) cluster/R/clara.q0000644000176200001440000001743014532110372013403 0ustar liggesusers#### CLARA := Clustering LARge Applications #### #### Note that the algorithm is O(n), but O(ns^2) where ns == sampsize clara <- function(x, k, metric = c("euclidean", "manhattan", "jaccard"), # "gower"), stand = FALSE, cluster.only = FALSE, samples = 5, sampsize = min(n, 40 + 2 * k), trace = 0, medoids.x = TRUE, keep.data = medoids.x, rngR = FALSE, pamLike = FALSE, correct.d = TRUE) { ## check type of input matrix and values of input numbers if(inherits(x, "dist"))# catch user error stop("'x' is a \"dist\" object, but should be a data matrix or frame") ## for "gower" we should allow 'type' as in daisy() --> use that code in a *modular* way x <- data.matrix(x) if(!(is.numeric(x) || is.logical(x))) stop("x is not a numeric dataframe or matrix.") n <- nrow(x) if((k <- as.integer(k)) < 1 || k > n - 1) stop("The number of cluster should be at least 1 and at most n-1." ) # ==> n >= 2 if((sampsize <- as.integer(sampsize)) < max(2,k+1)) stop(gettextf("'sampsize' should be at least %d = max(2, 1+ number of clusters)", max(2,k+1)), domain=NA) if(n < sampsize) stop(gettextf("'sampsize' = %d should not be larger than the number of objects, %d", sampsize, n), domain=NA) if((samples <- as.integer(samples)) < 1) stop("'samples' should be at least 1") jp <- ncol(x) namx <- dimnames(x)[[1]] ## standardize, if necessary {careful not to copy unnecessarily}: if(medoids.x) ## need to save original 'x' ox <- x else if(keep.data) stop("when 'medoids.x' is FALSE, 'keep.data' must be too") metric <- match.arg(metric) if(stand) x <- scale(x, scale = apply(x, 2, meanabsdev)) if(keep.data) data <- x ## put info about metric, size and NAs in arguments for the .C call dFlag <- -1L # not used (in C code) if((mdata <- any(inax <- is.na(x)))) { # TRUE if x[] has any NAs jtmd <- integer(jp) jtmd[apply(inax, 2L, any)] <- -1L ## VALue for MISsing DATa valmisdat <- 1.1* max(abs(range(x, na.rm=TRUE))) x[inax] <- valmisdat if(missing(correct.d)) warning("Distance computations with NAs: using correct instead of pre-2016 wrong formula. Use 'correct.d=FALSE' to get previous results or set 'correct.d=TRUE' explicitly to suppress this warning.") else if(!is.finite(dFlag <- as.integer(correct.d))) stop("invalid 'correct.d'") } else rm(inax) # save space res <- .C(cl_clara, n, jp, k, ## 3 clu = as.double(x), samples, # = nran sampsize, # = nsam ## 6 dis = double(1 + (sampsize * (sampsize - 1))/2), as.integer(mdata), # = mdata valmd = if(mdata) rep(valmisdat, jp) else -1., ## 9 jtmd = if(mdata) jtmd else integer(1), c("euclidean" = 1L, "manhattan" = 2L, "jaccard" = 3L, "gower" = 6L)[[metric]], # = diss_kind (DISS_KIND : ../src/cluster.h) as.logical(rngR[1]), # = rng_R ## 12 as.logical(pamLike[1]), # = pam_like as.integer(dFlag), # = d_flag integer(sampsize), # = nrepr ## 15 integer(sampsize), # = nsel sample= integer(sampsize),# = nbest integer(k), # = ## 18 imed = integer(k), # = nrx double(k), # = radus double(k), # = ttd ## 21 double(k), # = ratt avdis = double(k), # = ttbes maxdis = double(k), # = rdbes ## 24 ratdis = double(k), # = rabes size = integer(k), # = mtt obj = double(1), ## 27 avsil = double(k), ttsil = double(1), silinf = matrix(0, sampsize, 4), ## 30 jstop = integer(1), as.integer(trace), # = trace_lev double (3 * sampsize), # = tmp ## 33 integer(6 * sampsize) # = itmp )[if(cluster.only) c("clu", "jstop") else substitute()] # empty index: ## res[] components really used below: ## jstop, clu, silinf, dis, sample, med, imed, obj, size, maxis, avdis, ratdis, ## avsil, ttsil ## give a warning when errors occured: if(res$jstop) { if(mdata && any(aNA <- apply(inax,1, all))) { i <- which(aNA) nNA <- length(i) pasteC <- function(...) paste(..., collapse= ",") if(nNA < 13) stop(sprintf(ngettext(nNA, "Observation %s has *only* NAs --> omit it for clustering", "Observations %s have *only* NAs --> omit them for clustering!"), pasteC(i)), domain = NA) else stop(sprintf(ngettext(nNA, "%d observation (%s) has *only* NAs --> omit them for clustering!", "%d observations (%s ...) have *only* NAs --> omit them for clustering!"), nNA, pasteC(i[1:12])), domain = NA) } ## else if(res$jstop == 1) stop("Each of the random samples contains objects between which no distance can be computed.") if(res$jstop == 2) stop(gettextf("For each of the %d samples, at least one object was found which could not be assigned to a cluster (because of missing values).", samples)) ## else {cannot happen} stop("invalid 'jstop' from .C(cl_clara,.): ", res$jstop) } ## 'res$clu' is potentially too large; cut down ASAP clustering <- as.integer(res$clu[1:n]) if(!is.null(namx)) names(clustering) <- namx if(cluster.only) return(clustering) ## adapt C output to S: ## convert lower matrix, read by rows, to upper matrix, read by rows. disv <- res$dis[-1] disv[disv == -1] <- NA disv <- disv[upper.to.lower.tri.inds(sampsize)] class(disv) <- dissiCl attr(disv, "Size") <- sampsize attr(disv, "Metric") <- metric attr(disv, "Labels") <- namx[res$sample] res$med <- if(medoids.x) ox[res$imed, , drop = FALSE] ## add labels to C output sildim <- res$silinf[, 4] if(!is.null(namx)) { sildim <- namx[sildim] res$sample <- namx[res$sample] } r <- list(sample = res$sample, medoids = res$med, i.med = res$imed, clustering = clustering, objective = res$obj, clusinfo = cbind(size = res$size, "max_diss" = res$maxdis, "av_diss" = res$avdis, isolation = res$ratdis), diss = disv, call = match.call()) ## add dimnames to C output if(k > 1) { dimnames(res$silinf) <- list(sildim, c("cluster", "neighbor", "sil_width", "")) r$silinfo <- list(widths = res$silinf[, -4], clus.avg.widths = res$avsil, avg.width = res$ttsil) } if(keep.data) r$data <- data class(r) <- c("clara", "partition") r } print.clara <- function(x, ...) { cat("Call: ", deparse1(x$call), "\nMedoids:\n"); print(x$medoids, ...) cat("Objective function:\t ", format(x$objective, ...),"\n", "Clustering vector: \t", sep=""); str(x$clustering, vec.len = 7) cat("Cluster sizes: \t", x$clusinfo[,1], "\nBest sample:\n"); print(x$sample, quote = FALSE, ...) cat("\nAvailable components:\n"); print(names(x), ...) invisible(x) } summary.clara <- function(object, ...) { class(object) <- "summary.clara" object } print.summary.clara <- function(x, ...) { cat("Object of class 'clara' from call:\n", deparse1(x$call), "\nMedoids:\n"); print(x$medoids, ...) cat("Objective function:\t ", format(x$objective, ...), "\nNumerical information per cluster:\n") print(x$clusinfo, ...) if(has.sil <- !is.null(x$silinfo)) { cat("Average silhouette width per cluster:\n") print(x$silinfo[[2]], ...) cat("Average silhouette width of best sample:", format(x$silinfo[[3]], ...), "\n") } cat("\nBest sample:\n"); print(x$sample, quote = FALSE, ...) cat("Clustering vector:\n"); print(x$clustering, ...) if(has.sil) { cat("\nSilhouette plot information for best sample:\n") print(x$silinfo[[1]], ...) } if(!is.null(x$diss)) { ## Dissimilarities: cat("\n"); print(summary(x$diss, ...)) } cat("\nAvailable components:\n"); print(names(x), ...) invisible(x) } cluster/R/ellipsoidhull.R0000644000176200001440000001100213467043541015131 0ustar liggesusers#### ellipsoidhull : Find (and optionally draw) #### ----------- the smallest ellipsoid containining a set of points #### #### Just making the algorithms in clusplot() available more generally #### ( --> ./plotpart.q ) ### Author: Martin Maechler, Date: 21 Jan 2002, 15:41 ellipsoidhull <- function(x, tol = 0.01, maxit = 5000, ret.wt = FALSE, ret.sqdist = FALSE, ret.pr = FALSE) { if(!is.matrix(x) || !is.numeric(x)) stop("'x' must be numeric n x p matrix") if(anyNA(x)) { warning("omitting NAs") x <- na.omit(x) } n <- nrow(x) if(n == 0) stop("no points without missing values") p <- ncol(x) res <- .C(spannel, n, ndep= p, dat = cbind(1., x), sqdist = double(n), l1 = double((p+1) ^ 2), double(p), double(p), prob = double(n), double(p+1), eps = as.double(tol), maxit = as.integer(maxit), ierr = integer(1))# 0 or non-zero if(res$ierr != 0) cat("Error in Fortran routine computing the spanning ellipsoid,", "\n probably collinear data\n", sep="") if(any(res$prob < 0) || all(res$prob == 0)) stop("computed some negative or all 0 probabilities") conv <- res$maxit < maxit if(!conv) warning(gettextf("algorithm possibly not converged in %d iterations", maxit)) conv <- conv && res$ierr == 0 cov <- cov.wt(x, res$prob) ## cov.wt() in R has extra wt[] scaling; revert here res <- list(loc = cov$center, cov = cov$cov * (1 - sum(cov$wt^2)), d2 = weighted.mean(res$sqdist, res$prob), wt = if(ret.wt) cov$wt, sqdist = if(ret.sqdist) res$sqdist, prob= if(ret.pr) res$prob, tol = tol, eps = max(res$sqdist) - p, it = res$maxit, maxit= maxit, ierr = res$ierr, conv = conv) class(res) <- "ellipsoid" res } print.ellipsoid <- function(x, digits = max(1, getOption("digits") - 2), ...) { d <- length(x$loc) cat("'ellipsoid' in", d, "dimensions:\n center = (", format(x$loc, digits=digits), "); squared ave.radius d^2 = ", format(x$d2, digits=digits), "\n and shape matrix =\n") print(x$cov, digits = digits, ...) Vx <- volume(x) chV <- if(!is.finite(Vx)) paste0("exp(", format(volume(x, log=TRUE), digits=digits),")") else format(Vx, digits=digits) cat(" hence,", if(d==2) "area" else "volume", " = ", chV, "\n") if(!is.null(x$conv) && !x$conv) { cat("\n** Warning: ** the algorithm did not terminate reliably!\n ", if(x$ierr) "most probably because of collinear data" else "(in the available number of iterations)", "\n") } invisible(x) } volume <- function(object, ...) UseMethod("volume") if(FALSE) ## correct only for dimension d = 2 -- was used up to May 2019 : volume.ellipsoid <- function(object) { A <- object$cov pi * object$d2 * sqrt(det(A)) } ## modified MM from a proposal by Keefe Murphy, e-mail 2019-05-15 volume.ellipsoid <- function(object, log=FALSE, ...) { stopifnot((p <- length(object$loc)) >= 1) lDet2 <- as.numeric(determinant(object$cov)$modulus) / 2 # = log(sqrt(det(.))) lV <- p/2 * log(pi * object$d2) + lDet2 - lgamma(p/2 + 1) if(log) lV else exp(lV) } ## For p = 2 : ## Return (x[i],y[i]) points, i = 1:n, on boundary of ellipse, given ## by 2 x 2 matrix A[], origin 'loc' and d(xy, loc) ^2 = 'd2' ellipsoidPoints <- function(A, d2, loc, n.half = 201) { if(length(d <- dim(A)) != 2 || (p <- d[1]) != d[2]) stop("'A' must be p x p cov-matrix defining an ellipsoid") if(p == 2) { detA <- A[1, 1] * A[2, 2] - A[1, 2]^2 yl2 <- A[2, 2] * d2 # = (y_max - y_loc)^2 y <- seq( - sqrt(yl2), sqrt(yl2), length = n.half) sqrt.discr <- sqrt(detA * pmax(0, yl2 - y^2))/A[2, 2] sqrt.discr[c(1, n.half)] <- 0 b <- loc[1] + A[1, 2]/A[2, 2] * y y <- loc[2] + y return(rbind(cbind( b - sqrt.discr, y), cbind(rev(b + sqrt.discr), rev(y)))) } else { ## p >= 3 detA <- det(A) ##-- need something like polar coordinates stop("ellipsoidPoints() not yet implemented for p >= 3 dim.") } } predict.ellipsoid <- function(object, n.out = 201, ...) ellipsoidPoints(object$cov, d2 = object$d2, loc= object$loc, n.half = n.out) cluster/R/mona.q0000644000176200001440000000762514700006373013262 0ustar liggesusers mona <- function(x, trace.lev = 0) { ## check type of input matrix if(!(iM <- is.matrix(x)) && !is.data.frame(x)) stop("x must be a matrix or data frame.") if(!all(vapply(lapply(as.data.frame(x), function(y) levels(as.factor(y))), length, 1) == 2)) stop("All variables must be binary (e.g., a factor with 2 levels, both present).") n <- nrow(x) p <- ncol(x) if(p < 2) stop("mona() needs at least p >= 2 variables (in current implementation)") dnx <- dimnames(x) ## Change levels of input matrix to {0,1, NA=2}: iF <- function(.) as.integer(as.factor(.)) x <- (if(iM) apply(x, 2, iF) else vapply(x, iF, integer(n))) - 1L hasNA <- anyNA(x) if(hasNA) x[is.na(x)] <- 2L ## was ## x <- apply(as.matrix(x), 2, factor) ## x[x == "1"] <- "0" ## x[x == "2"] <- "1" ## x[is.na(x)] <- "2" ## storage.mode(x) <- "integer" ## call C routine (from original fortran) -- ../src/mona.c res <- .C(cl_mona, as.integer(n), as.integer(p), x = x, error = as.integer(trace.lev), nban = integer(n), ner = integer(n), integer(n), lava = integer(n), # => variable numbers in every step; 0: no variable integer(p)) ## stop with a message when two many missing values: if(res$error != 0) { ## NB: Need "full simple strings below, to keep it translatable": switch(res$error ## 1 : , stop("No clustering performed, an object was found with all values missing.") ## 2 : , stop("No clustering performed, found variable with more than half values missing.") ## 3 : never triggers because of binary check above , stop("No clustering performed, a variable was found with all non missing values identical.") ## 4 : , stop("No clustering performed, all variables have at least one missing value.") ## 5: -- cannot trigger here: already handled above , stop("mona() needs at least p >= 2 variables (in current implementation)") ) } ##O res$x <- matrix(as.numeric(substring(res$x, ##O 1:nchar(res$x), 1:nchar(res$x))), ##O n, p) ## storage.mode(res$x) <- "integer" # keeping dim() dimnames(res$x) <- dnx ## add labels to Fortran output if(length(dnx[[2]]) != 0) { lava <- as.character(res$lava) lava[lava != "0"] <- dnx[[2]][res$lava] lava[lava == "0"] <- "NULL" res$lava <- lava } ## construct "mona" object structure(class = "mona", list(data = res$x, hasNA = hasNA, order = res$ner, variable = res$lava[-1], step = res$nban[-1], order.lab = if(length(dnx[[1]]) != 0) dnx[[1]][res$ner], call = match.call())) } print.mona <- function(x, ...) { ## FIXME: 1) Printing this is non-sense in the case where the data is unchanged ## 2) If it was changed, mona(), i.e. 'x' here should contain the info! d <- dim(x$data) # TODO: maybe *not* keep 'data', but keep 'dim' cat("mona(x, ..) fit; x of dimension ", d[1],"x",d[2],"\n", sep="") if(x$hasNA) { cat("Because of NA's, revised data:\n") print(x$data, quote = FALSE, ...) } cat("Order of objects:\n") print(if (length(x$order.lab) != 0) x$order.lab else x$order, quote = FALSE, ...) cat("Variable used:\n") print(x$variable, quote = FALSE, ...) cat("Separation step:\n") print(x$step, ...) cat("\nAvailable components:\n") print(names(x), ...) invisible(x) } ## FIXME: print(summary(.)) should differ from print() summary.mona <- function(object, ...) { class(object) <- "summary.mona" object } print.summary.mona <- function(x, ...) { print.mona(x, ...) invisible(x) } cluster/R/agnes.q0000644000176200001440000001517514726055031013427 0ustar liggesusers#### $Id: agnes.q 8468 2024-12-10 15:11:21Z maechler $ agnes <- function(x, diss = inherits(x, "dist"), metric = "euclidean", stand = FALSE, method = "average", par.method, keep.diss = n < 100, keep.data = !diss, trace.lev = 0) { METHODS <- c("average", "single","complete", "ward","weighted", "flexible", "gaverage") ## hclust has more; 1 2 3 4 5 6 7 meth <- pmatch(method, METHODS) if(is.na(meth)) stop("invalid clustering method") if(meth == -1) stop("ambiguous clustering method") cl. <- match.call() method <- METHODS[meth] if(method == "flexible") { ## Lance-Williams formula (but *constant* coefficients): stopifnot((np <- length(a <- as.numeric(par.method))) >= 1) attr(method,"par") <- par.method <- if(np == 1)## default (a1= a, a2= a, b= 1-2a, c = 0) c(a, a, 1-2*a, 0) else if(np == 3) c(a, 0) else if(np == 4) a else stop("'par.method' must be of length 1, 3, or 4") ## if(any(par.method[1:2]) < 0) ## warning("method \"flexible\": alpha_1 or alpha_2 < 0 can give invalid dendrograms" } else if (method == "gaverage") { attr(method,"par") <- par.method <- if (missing(par.method)) { ## Default par.method: Using beta = -0.1 as advised in Belbin et al. (1992) beta <- -0.1 c(1-beta, 1-beta, beta, 0) } else { stopifnot((np <- length(b <- as.numeric(par.method))) >= 1) if(np == 1)## default (a1= 1-b, a2= 1-b, b= b, c= 0) c(1-b, 1-b, b, 0) else if(np == 3) c(b, 0) else if(np == 4) b else stop("'par.method' must be of length 1, 3, or 4") } ## if(any(par.method[1:2]) < 0) ## warning("method \"gaverage\": alpha_1 or alpha_2 < 0 can give invalid dendrograms" } else ## dummy (passed to C; length >= 1 : using `alpha--` there par.method <- double(1) if((diss <- as.logical(diss))) { ## check type of input vector if(anyNA(x)) stop("NA-values in the dissimilarity matrix not allowed.") if(data.class(x) != "dissimilarity") { # try to convert to if(!is.null(dim(x))) { x <- as.dist(x) # or give an error } else { ## possibly convert input *vector* if(!is.numeric(x) || is.na(n <- sizeDiss(x))) stop("'x' is not and cannot be converted to class \"dissimilarity\"") attr(x, "Size") <- n } class(x) <- dissiCl if(is.null(attr(x,"Metric"))) attr(x, "Metric") <- "unspecified" } n <- attr(x, "Size") dv <- x[lower.to.upper.tri.inds(n)] # is *slow* [c * n^2 ; but large c] in large cases ## prepare arguments for the Fortran call dv <- c(0., dv)# "double", 1st elem. "only for Fortran" (?) jp <- 1L mdata <- FALSE ndyst <- 0 x2 <- double(1) } else { ## check input matrix and standardize, if necessary x <- data.matrix(x) if(!is.numeric(x)) stop("x is not a numeric dataframe or matrix.") x2 <- if(stand) scale(x, scale = apply(x, 2, meanabsdev)) else x storage.mode(x2) <- "double" ndyst <- if(metric == "manhattan") 2 else 1 n <- nrow(x2) jp <- ncol(x2) if((mdata <- any(inax <- is.na(x2)))) { # TRUE if x[] has any NAs jtmd <- integer(jp) jtmd[apply(inax, 2L, any)] <- -1L ## VALue for MISsing DATa valmisdat <- 1.1* max(abs(range(x2, na.rm=TRUE))) x2[inax] <- valmisdat } dv <- double(1 + (n * (n - 1))/2) } if(n <= 1) stop("need at least 2 objects to cluster") stopifnot(length(trace.lev <- as.integer(trace.lev)) == 1) C.keep.diss <- keep.diss && !diss res <- .C(twins, as.integer(n), as.integer(jp), x2, dv, dis = double(if(C.keep.diss) length(dv) else 1L), jdyss = if(C.keep.diss) diss + 10L else as.integer(diss), if(mdata && jp) rep(valmisdat, jp) else double(1L), if(mdata) jtmd else integer(jp), as.integer(ndyst), 1L,# jalg = 1 <==> AGNES meth,# integer integer(n), ner = integer(n), ban = double(n), ac = double(1), # coef par.method, # = alpha (of length 1, 3, or 4) merge = matrix(0L, n - 1, 2), # integer trace = trace.lev)[c("dis", "jdyss", "ner", "ban", "ac", "merge")] if(!diss) { ##give warning if some dissimilarities are missing. if(res$jdyss == -1) stop("No clustering performed, NA-values in the dissimilarity matrix.\n" ) if(keep.diss) { ## adapt Fortran output to S: ## convert lower matrix,read by rows, to upper matrix, read by rows. disv <- res$dis[-1] disv[disv == -1] <- NA disv <- disv[upper.to.lower.tri.inds(n)] class(disv) <- dissiCl attr(disv, "Size") <- nrow(x) attr(disv, "Metric") <- metric attr(disv, "Labels") <- dimnames(x)[[1]] } ##add labels to Fortran output if(length(dimnames(x)[[1]]) != 0) order.lab <- dimnames(x)[[1]][res$ner] } else { if(keep.diss) disv <- x ##add labels to Fortran output if(length(attr(x, "Labels")) != 0) order.lab <- attr(x, "Labels")[res$ner] } clustering <- list(order = res$ner, height = res$ban[-1], ac = res$ac, merge = res$merge, diss = if(keep.diss)disv, call = cl., method = METHODS[meth]) if(exists("order.lab")) clustering$order.lab <- order.lab if(keep.data && !diss) { if(mdata) x2[x2 == valmisdat] <- NA clustering$data <- x2 } class(clustering) <- c("agnes", "twins") clustering } summary.agnes <- function(object, ...) { class(object) <- "summary.agnes" object } print.agnes <- function(x, ...) { cat("Call: ", deparse1(x$call), "\nAgglomerative coefficient: ", format(x$ac, ...), "\nOrder of objects:\n") print(if(length(x$order.lab) != 0) x$order.lab else x$order, quote = FALSE, ...) cat("Height (summary):\n"); print(summary(x$height), ...) cat("\nAvailable components:\n"); print(names(x), ...) invisible(x) } print.summary.agnes <- function(x, ...) { ## a bit more than print.agnes() .. cat("Object of class 'agnes' from call:\n", deparse1(x$call), "\nAgglomerative coefficient: ", format(x$ac, ...), "\nOrder of objects:\n") print(if(length(x$order.lab) != 0) x$order.lab else x$order, quote = FALSE, ...) cat("Merge:\n"); print(x$merge, ...) cat("Height:\n"); print(x$height, ...) if(!is.null(x$diss)) { ## Dissimilarities: cat("\n"); print(summary(x$diss, ...)) } cat("\nAvailable components:\n"); print(names(x), ...) invisible(x) } as.dendrogram.twins <- function(object, ...) ## ... : really only 'hang' as.dendrogram(as.hclust(object), ...) cluster/R/clusGap.R0000644000176200001440000001524314277707561013702 0ustar liggesusers#### Originally from orphaned package SLmisc #### (Version: 1.4.1, 2007-04-12, Maintainer: Matthias Kohl ) #### License: GPL (version 2 or later) #### #### which said #### "function corresponds to function gap in package SAGx" ## MM: SAGx is now in Bioconductor --- 1.10.1{devel} or 1.11.1{release} ## had gap() *corrected* to re-cluster using FUNcluster --> see ./gap-SAGx.R.~orig~ ## ## MM: Package 'lga' -- has gap() and lga and robust lga [-> UBC] ## - it uses boot() nicely [2012-01: ORPHANED because Justin Harrington is amiss] ## MM: renamed arguments, and changed almost everything clusGap <- function (x, FUNcluster, K.max, B = 100, d.power = 1, spaceH0 = c("scaledPCA", "original"), verbose = interactive(), ...) { stopifnot(is.function(FUNcluster), length(dim(x)) == 2, K.max >= 2, (n <- nrow(x)) >= 1, ncol(x) >= 1) if(B != (B. <- as.integer(B)) || (B <- B.) <= 0) stop("'B' has to be a positive integer") cl. <- match.call() if(is.data.frame(x)) x <- as.matrix(x) ii <- seq_len(n) W.k <- function(X, kk) { clus <- if(kk > 1) FUNcluster(X, kk, ...)$cluster else rep.int(1L, nrow(X)) ## ---------- = = -------- kmeans() has 'cluster'; pam() 'clustering' 0.5* sum(vapply(split(ii, clus), function(I) { xs <- X[I,, drop=FALSE] sum(dist(xs)^d.power/nrow(xs)) }, 0.)) } logW <- E.logW <- SE.sim <- numeric(K.max) if(verbose) cat("Clustering k = 1,2,..., K.max (= ",K.max,"): .. ", sep='') for(k in 1:K.max) logW[k] <- log(W.k(x, k)) if(verbose) cat("done\n") spaceH0 <- match.arg(spaceH0) ## Scale 'x' into hypercube -- later fill with H0-generated data xs <- scale(x, center=TRUE, scale=FALSE) m.x <- rep(attr(xs,"scaled:center"), each = n) # for back-trafo later switch(spaceH0, "scaledPCA" = { ## (These & (xs,m.x) above basically do stats:::prcomp.default() V.sx <- svd(xs, nu=0)$v xs <- xs %*% V.sx # = transformed(x) }, "original" = {}, # (do nothing, use 'xs') ## otherwise stop("invalid 'spaceH0':", spaceH0)) rng.x1 <- apply(xs, 2L, range) logWks <- matrix(0, B, K.max) if(verbose) cat("Bootstrapping, b = 1,2,..., B (= ", B, ") [one \".\" per sample]:\n", sep="") for (b in 1:B) { ## Generate "H0"-data as "parametric bootstrap sample" : z1 <- apply(rng.x1, 2, function(M, nn) runif(nn, min=M[1], max=M[2]), nn=n) z <- switch(spaceH0, "scaledPCA" = tcrossprod(z1, V.sx), # back transformed "original" = z1 ) + m.x for(k in 1:K.max) { logWks[b,k] <- log(W.k(z, k)) } if(verbose) cat(".", if(b %% 50 == 0) paste(b,"\n")) } if(verbose && (B %% 50 != 0)) cat("",B,"\n") E.logW <- colMeans(logWks) SE.sim <- sqrt((1 + 1/B) * apply(logWks, 2, var)) structure(class = "clusGap", list(Tab = cbind(logW, E.logW, gap = E.logW - logW, SE.sim), ## K.max == nrow(T) call = cl., spaceH0=spaceH0, n = n, B = B, FUNcluster=FUNcluster)) } ## lga/R/gap.R --- has for Tibshirani et al (2001): ## ElogWks[k,] <- c(mean(BootOutput), sqrt(var(BootOutput)*(1+1/B))) ## GAP[k] <- ElogWks[k,1] - logWks[k] ## if (k > 1) ## if(GAP[k-1] >= GAP[k]-ElogWks[k,2] & !doall) ## finished <- TRUE ## so they effectively only look for the *first* (local) maximum which .. ## MM: <==> diff(GAP) = GAP[k] - GAP[k-1] <= +SE.sim[k] ## criteria.DandF() -- Dudoit and Fridlyand (2002) ## ---------------- looks at the *global* maximum and then to the left.. ## y <- x$data ## crit <- diff(y[which.max(y[,"Gap"]), c("Sks", "Gap")]) ## nclust <- min(which(y[,"Gap"] > crit)) ## return(ifelse(nclust == nrow(y), NA, nclust)) maxSE <- function(f, SE.f, method = c("firstSEmax", "Tibs2001SEmax", "globalSEmax", "firstmax", "globalmax"), SE.factor = 1) { method <- match.arg(method) stopifnot((K <- length(f)) >= 1, K == length(SE.f), SE.f >= 0, SE.factor >= 0) fSE <- SE.factor * SE.f switch(method, "firstmax" = { ## the first local maximum (== firstSEmax with SE.factor == 0) decr <- diff(f) <= 0 # length K-1 if(any(decr)) which.max(decr) else K # the first TRUE, or K }, "globalmax" = { which.max(f) }, "Tibs2001SEmax" = { ## The one Tibshirani et al (2001) proposed: ## "the smallest k such that f(k) >= f(k+1) - s_{k+1}" g.s <- f - fSE if(any(mp <- f[-K] >= g.s[-1])) which.max(mp) else K }, "firstSEmax" = { ## M.Maechler(2012): rather .. ## look at the first *local* maximum and then to the left ..: decr <- diff(f) <= 0 # length K-1 nc <- if(any(decr)) which.max(decr) else K # the first TRUE, or K if(any(mp <- f[seq_len(nc - 1)] >= f[nc] - fSE[nc])) which(mp)[1] else nc }, "globalSEmax" = { ## Dudoit and Fridlyand (2002) *thought* Tibshirani proposed.. ## in 'lga', see criteria.DandF(): ## looks at the *global* maximum and then to the left.. nc <- which.max(f) if(any(mp <- f[seq_len(nc - 1)] >= f[nc] - fSE[nc])) which(mp)[1] else nc }) } print.clusGap <- function(x, method="firstSEmax", SE.factor = 1, ...) { method <- match.arg(method, choices = eval(formals(maxSE)$method)) stopifnot((K <- nrow(T <- x$Tab)) >= 1, SE.factor >= 0) cat("Clustering Gap statistic [\"clusGap\"] from call:\n", deparse1(x$call), sprintf("\nB=%d simulated reference sets, k = 1..%d; spaceH0=\"%s\"\n", x$B, K, x$spaceH0), sep="") nc <- maxSE(f = T[,"gap"], SE.f = T[,"SE.sim"], method=method, SE.factor=SE.factor) cat(sprintf(" --> Number of clusters (method '%s'%s): %d\n", method, if(grepl("SE", method)) sprintf(", SE.factor=%g",SE.factor) else "", nc)) print(T, ...) invisible(x) } plot.clusGap <- function(x, type="b", xlab = "k", ylab = expression(Gap[k]), main = NULL, do.arrows = TRUE, arrowArgs = list(col="red3", length=1/16, angle=90, code=3), ...) { stopifnot(is.matrix(Tab <- x$Tab), is.numeric(Tab)) K <- nrow(Tab) k <- seq_len(K) # == 1,2,... k if(is.null(main)) main <- paste(strwrap(deparse1(x$call), width = 60, exdent = 7), collapse="\n") gap <- Tab[, "gap"] plot(k, gap, type=type, xlab=xlab, ylab=ylab, main=main, ...) if(do.arrows) do.call(arrows, c(list(k, gap+ Tab[, "SE.sim"], k, gap- Tab[, "SE.sim"]), arrowArgs)) invisible() } cluster/R/plothier.q0000644000176200001440000001552614277707561014175 0ustar liggesusers### $Id: plothier.q 8117 2022-08-19 13:26:09Z maechler $ pltree <- function(x, ...) UseMethod("pltree") ## note: pltree() can have an 'xlab' in "..." (plot.hclust has an explicit one) pltree.twins <- function(x, main = paste("Dendrogram of ", deparse1(x$call)), labels = NULL, ylab = "Height", ...) { plot(as.hclust(x), labels = labels, ##- if(is.null(labels) && length(x$order.lab) != 0) ##- labels <- x$order.lab[sort.list(x$order)] ##- ##- ## calling plot.hclust() via generic : ##- plot(structure(list(merge = x$merge, order = x$order, ##- height = sort(x$height), labels = labels, ##- call = x$call, method = x$method), ##- class = "hclust"), main = main, ylab = ylab, ...) } bannerplot <- function(x, w = rev(x$height), fromLeft = TRUE, main=NULL, sub=NULL, xlab = "Height", adj = 0, col = c(2, 0), border = 0, axes = TRUE, frame.plot = axes, rev.xax = !fromLeft, xax.pretty = TRUE, labels = NULL, nmax.lab = 35, max.strlen = 5, yax.do = axes && length(x$order) <= nmax.lab, yaxRight = fromLeft, y.mar = 2.4 + max.strlen / 2.5, ...) { m <- max(w) if(axes) { if(xax.pretty) { at.vals <- if(!is.logical(xax.pretty)) pretty(c(0,w), n = xax.pretty) else pretty(c(0,w)) n <- length(at.vals <- at.vals[at.vals <= m]) if(at.vals[n] * 1.01 < m) { lab.vals <- c(at.vals, signif(m, 3)) at.vals <- c(at.vals, m) } else lab.vals <- at.vals } else { # old default for plot.agnes() and plot.diana() ss <- seq(0, floor(m), length = 11)# => intervals = 1/10 {total} at.vals <- c(ss, m) lab.vals <- round(at.vals, 2) } } if(fromLeft) { w <- rbind(w, m - w) if(missing(col)) col <- rev(col) } else { ## from Right w <- rbind(m - w, w) if(axes && rev.xax) { at.vals <- m - rev(at.vals)## == c(0, ss + m - floor(m)) lab.vals <- rev(lab.vals) } } if(yax.do) { ax <- if(yaxRight) list(side = 4, pos = m) else list(side = 2, pos = 0) if((pm <- par("mar"))[ax$side] < y.mar) { ## need space besides y axis for labeling pm[ax$side] <- y.mar op <- par(mar = pm) on.exit(par(op)) } } barplot(w, xlab = xlab, horiz = TRUE, space = 0, axes = FALSE, col = col, border = border, mgp = c(2.5, 1, 0), ...) if(frame.plot && (border == 0 || border == par("bg"))) rect(0, 0, m, ncol(w)) title(main = main, sub = sub, adj = adj) if(axes) { axis(1, at = at.vals, labels = lab.vals, ...) if(yax.do) { if(is.null(labels)) labels <- rev(if (length(x$order.lab) != 0) substring(x$order.lab, 1,max.strlen) else x$order) axis(ax$side, at = 0:(length(x$order) - 1), las = 1, labels = labels, pos = ax$pos, mgp = c(3, 1.25, 0), ...) } } invisible() } ## plot.diana() [further down] & plot.agnes() are almost identical; ## -- made bannerplot() a stand-alone function ## --> maybe *merge* these two into one plot.twins() plot.agnes <- function(x, ask = FALSE, which.plots = NULL, main = NULL, sub = paste("Agglomerative Coefficient = ", round(x$ac, digits = 2)), adj = 0, nmax.lab = 35, max.strlen = 5, xax.pretty = TRUE, ...) { if(is.null(main)) { cl <- paste(strwrap(deparse1(x$call, width.cutoff=150), width = 60, exdent = 7), collapse="\n") ## Different default for banner & pltree: main1 <- paste("Banner of ", cl) main2 <- paste("Dendrogram of ", cl) } else { # same title for both main1 <- main2 <- main } if(is.null(which.plots) && !ask) which.plots <- 1:2 if(ask && is.null(which.plots)) { ## Use 'menu' .. tmenu <- paste("plot ", ## choices : c("All", "Banner", "Clustering Tree")) do.all <- FALSE repeat { if(!do.all) pick <- menu(tmenu, title = "\nMake a plot selection (or 0 to exit):\n") + 1 switch(pick, return(invisible()), # 0 -> exit loop do.all <- TRUE,# 1 : All bannerplot(x, fromLeft = TRUE, main = main1, sub = sub, adj = adj, xax.pretty = 10, nmax.lab= nmax.lab, max.strlen= max.strlen, ...), pltree (x, main = main2, sub = sub, ...) # 3 ) if(do.all) { pick <- pick + 1; do.all <- pick <= length(tmenu) + 1} } } else { ask <- prod(par("mfcol")) < length(which.plots) && dev.interactive() if(ask) { op <- par(ask = TRUE) on.exit(par(op)) } for(i in which.plots) switch(i, bannerplot(x, fromLeft = TRUE, main = main1, sub = sub, adj = adj, xax.pretty = 10, nmax.lab = nmax.lab, max.strlen = max.strlen, ...), pltree (x, main = main2, sub = sub, ...) ) } invisible() } plot.diana <- function(x, ask = FALSE, which.plots = NULL, main = NULL, sub = paste("Divisive Coefficient = ", round(x$dc, digits = 2)), adj = 0, nmax.lab = 35, max.strlen = 5, xax.pretty = TRUE, ...) { if(is.null(main)) { cl <- paste(strwrap(deparse1(x$call, width.cutoff=150), width = 60, exdent = 7), collapse="\n") ## Different default for banner & pltree: main1 <- paste("Banner of ", cl) main2 <- paste("Dendrogram of ", cl) } else { # same title for both main1 <- main2 <- main } if(is.null(which.plots) && !ask) which.plots <- 1:2 if(ask && is.null(which.plots)) { ## Use 'menu' .. tmenu <- paste("plot ", ## choices : c("All", "Banner", "Clustering Tree")) do.all <- FALSE repeat { if(!do.all) pick <- menu(tmenu, title = "\nMake a plot selection (or 0 to exit):\n") + 1 switch(pick, return(invisible()), # 0 -> exit loop do.all <- TRUE,# 1 : All bannerplot(x, fromLeft = FALSE, main = main1, sub = sub, adj = adj, xax.pretty = 10, nmax.lab= nmax.lab, max.strlen= max.strlen, ...), pltree (x, main = main2, sub = sub, ...) ) if(do.all) { pick <- pick + 1; do.all <- pick <= length(tmenu) + 1} } } else { ask <- prod(par("mfcol")) < length(which.plots) && dev.interactive() if(ask) { op <- par(ask = TRUE) on.exit(par(op)) } for(i in which.plots) switch(i, bannerplot(x, fromLeft = FALSE, main = main1, sub = sub, adj = adj, xax.pretty = 10, nmax.lab = nmax.lab, max.strlen = max.strlen, ...),# 1 pltree (x, main = main2, sub = sub, ...) # i = 2 ) } invisible() } plot.mona <- function(x, main = paste("Banner of ", deparse1(x$call)), sub = NULL, xlab = "Separation step", col = c(2,0), axes = TRUE, adj = 0, nmax.lab = 35, max.strlen = 5, ...) { w <- rev(x$step) m <- max(w) if(any(i0 <- w == 0)) w[i0] <- m <- m+1 bannerplot(x[c("order","order.lab")], w = w, fromLeft = TRUE, yaxRight = FALSE, col = col, main = main, sub = sub, xlab = xlab, adj= adj, axes= axes, nmax.lab= nmax.lab, max.strlen= max.strlen, xax.pretty = m+1, ...) names <- paste(" ", rev(x$variable)) is.na(names) <- i0 text(w, 1:length(names) - 0.5, names, adj = 0, col = col[1], ...) } cluster/R/fanny.q0000644000176200001440000002110512540507660013435 0ustar liggesusers#### $Id: fanny.q 6953 2015-06-18 09:30:24Z maechler $ fanny <- function(x, k, diss = inherits(x, "dist"), memb.exp = 2, metric = c("euclidean", "manhattan", "SqEuclidean"), stand = FALSE, iniMem.p = NULL, cluster.only = FALSE, keep.diss = !diss && !cluster.only && n < 100, keep.data = !diss && !cluster.only, maxit = 500, tol = 1e-15, trace.lev = 0) { if((diss <- as.logical(diss))) { ## check type of input vector if(anyNA(x)) stop("NA values in the dissimilarity matrix not allowed.") if(data.class(x) != "dissimilarity") { # try to convert to if(!is.null(dim(x))) { x <- as.dist(x) # or give an error } else { ## possibly convert input *vector* if(!is.numeric(x) || is.na(n <- sizeDiss(x))) stop("'x' is not and cannot be converted to class \"dissimilarity\"") attr(x, "Size") <- n } class(x) <- dissiCl if(is.null(attr(x,"Metric"))) attr(x, "Metric") <- "unspecified" } ## prepare arguments for the Fortran call n <- attr(x, "Size") dv <- as.double(c(x, 0))# add extra one jp <- 1 mdata <- FALSE ndyst <- 0L x2 <- double(n) jdyss <- 1 } else { ## check input matrix and standardize, if necessary x <- data.matrix(x) if(!is.numeric(x)) stop("x is not a numeric dataframe or matrix.") x2 <- if(stand) scale(x, scale = apply(x, 2, meanabsdev)) else x metric <- match.arg(metric) ## put info about metric, size and NAs in arguments for the Fortran call ndyst <- which(metric == eval(formals()$metric))# 1, 2, or 3 n <- nrow(x2) jp <- ncol(x2) if((mdata <- any(inax <- is.na(x2)))) { # TRUE if x[] has any NAs jtmd <- as.integer(ifelse(apply(inax, 2, any), -1, 1)) ## VALue for MISsing DATa valmisdat <- 1.1* max(abs(range(x2, na.rm=TRUE))) x2[inax] <- valmisdat } dv <- double(1 + (n * (n - 1))/2) jdyss <- 0 } if((k <- as.integer(k)) < 1 || k > n%/%2 - 1) stop("'k' (number of clusters) must be in {1,2, .., n/2 -1}") if(length(memb.exp) != 1 || (memb.exp <- as.double(memb.exp)) < 1 || memb.exp == Inf) stop("'memb.exp' must be a finite number > 1") if((maxit <- as.integer(maxit)[1]) < 0) stop("'maxit' must be non-negative integer") computeP <- is.null(iniMem.p) # default: determine initial membership in C if(computeP)# default: determine initial membership in C iniMem.p <- matrix(0., n, k)# all 0 -> will be used as 'code' else { dm <- dim(iniMem.p) if(length(dm) !=2 || !all(dm == c(n,k)) || !is.numeric(iniMem.p) || any(iniMem.p < 0) || !isTRUE(all.equal(unname(rowSums(iniMem.p)), rep(1, n)))) stop("'iniMem.p' must be a nonnegative n * k matrix with rowSums == 1") if(!is.double(iniMem.p)) storage.mode(iniMem.p) <- "double" } stopifnot(length(cluster.only) == 1) stopifnot(length(trace.lev) == 1) ## call Fortran routine storage.mode(x2) <- "double" res <- .C(cl_fanny, as.integer(n), as.integer(jp), k, x2, dis = dv, ok = as.integer(jdyss), if(mdata) rep(valmisdat, jp) else double(1), if(mdata) jtmd else integer(jp), ndyst, integer(n), # nsend integer(n), # nelem integer(n), # negbr double(n), # syl p = iniMem.p, dp = matrix(0., n, k),# < must all be 0 on entry! avsil = double(k),# 'pt' integer(k), # nfuzz double(k), # esp double(k), # ef double(n), # dvec ttsil = as.double(0), obj = as.double(c(cluster.only, trace.lev, computeP, 0)),# in & out! clu = integer(n), silinf = if(cluster.only) 0. else matrix(0., n, 4), memb.exp = memb.exp,# = 'r' tol = as.double(tol), maxit = maxit) if(!(converged <- res$maxit > 0)) { warning(gettextf( "FANNY algorithm has not converged in 'maxit' = %d iterations", maxit)) } if(!cluster.only) sildim <- res$silinf[, 4] if(diss) { if(keep.diss) disv <- x labs <- attr(x, "Labels") } else { ## give warning if some dissimilarities are missing. if(res$ok == -1) stop("No clustering performed, NA-values in the dissimilarity matrix.") labs <- dimnames(x)[[1]] if(keep.diss) { disv <- res$dis[ - (1 + (n * (n - 1))/2)] # drop the extra one disv[disv == -1] <- NA class(disv) <- dissiCl attr(disv, "Size") <- nrow(x) attr(disv, "Metric") <- metric attr(disv, "Labels") <- labs } } ## add labels, dimnames, etc to Fortran output: if(length(labs) != 0) { if(!cluster.only) sildim <- labs[sildim] dimnames(res$p) <- list(labs, NULL) names(res$clu) <- labs } coeff <- if(memb.exp == 2) res$obj[3:4] else { ## usual partition coefficient with " ^ 2 " : cf <- sum(res$p ^ 2) / n c(cf, (k * cf - 1)/(k - 1)) } names(coeff) <- c("dunn_coeff", "normalized") if(abs(coeff["normalized"]) < 1e-7) warning("the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ?") k.crisp <- res$obj[1] res$obj <- c("objective" = res$obj[2]) r <- list(membership = res$p, coeff = coeff, memb.exp = memb.exp, clustering = res$clu, k.crisp = k.crisp, # 'obj*': also containing iterations for back compatibility: objective = c(res$obj, "tolerance" = res$tol), convergence = c(iterations = res$maxit, converged = converged, maxit = maxit), diss = if(keep.diss) disv, call = match.call()) if(k != 1 && !cluster.only) { dimnames(res$silinf) <- list(sildim, c("cluster", "neighbor", "sil_width", "")) r$silinfo <- list(widths = res$silinf[, -4], clus.avg.widths = res$avsil[1:k], avg.width = res$ttsil) } if(keep.data && !diss) { if(mdata) x2[x2 == valmisdat] <- NA r$data <- x2 } class(r) <- c("fanny", "partition") r } ## non-exported: .print.fanny <- function(x, digits = getOption("digits"), ...) { cat("Fuzzy Clustering object of class 'fanny' :") print(formatC(cbind(" " = c("m.ship.expon." = x$memb.exp, x$objective[c("objective", "tolerance")], x$convergence, "n" = nrow(x$membership))), digits = digits), quote = FALSE, ...) k <- ncol(x$membership) cat("Membership coefficients (in %, rounded):\n"); print(round(100 * x$membership), ...) cat("Fuzzyness coefficients:\n"); print(x$coeff, digits = digits, ...) cat("Closest hard clustering:\n"); print(x$clustering, ...) if(x$k.crisp < k) cat(sprintf("k_crisp (= %d) < k !!\n", x$k.crisp)) } print.fanny <- function(x, digits = getOption("digits"), ...) { .print.fanny(x, digits = digits, ...) cat("\nAvailable components:\n") print(names(x), ...) invisible(x) } summary.fanny <- function(object, ...) { class(object) <- "summary.fanny" object } print.summary.fanny <- function(x, digits = getOption("digits"), ...) { .print.fanny(x, digits = digits, ...) if(length(x$silinfo) != 0) { cat("\nSilhouette plot information:\n") print(x$silinfo[[1]], ...) cat("Average silhouette width per cluster:\n") print(x$silinfo[[2]], ...) cat("Average silhouette width of total data set:\n") print(x$silinfo[[3]], ...) } if(!is.null(x$diss)) { ## Dissimilarities: cat("\n"); print(summary(x$diss, ...)) } cat("\nAvailable components:\n"); print(names(x), ...) invisible(x) } ## FIXME: Export and document these! ----------------------- ## Convert crisp clustering vector to fuzzy membership matrix as.membership <- function(clustering, keep.names = TRUE) { stopifnot(is.numeric(clustering), clustering == round(clustering)) n <- length(clustering) k <- length(u <- sort(unique(clustering))) r <- matrix(0L, n, k) if(k == 0 || n == 0) return(r) if(keep.names) dimnames(r) <- list(names(clustering), NULL) if(any(u != 1:k)) clustering <- match(clustering, u) r[cbind(1:n, clustering)] <- 1L r } ## "Generalized Inverse" transformation: ## Convert fuzzy membership matrix to closest crisp clustering vector toCrisp <- function(m) { dm <- dim(m) if(length(dm) != 2 || !is.numeric(m) || any(m < 0) || !isTRUE(all.equal(unname(rowSums(m)), rep(1, dm[1])))) stop("'m', a membership matrix, must be nonnegative with rowSums == 1") apply(m, 1, which.max) } cluster/R/zzz.R0000644000176200001440000000021211407171057013112 0ustar liggesusers.onUnload <- function(libpath) { library.dynam.unload("cluster", libpath) } ## no S4 methodology here; speedup : .noGenerics <- TRUE cluster/R/silhouette.R0000644000176200001440000002357714764134031014465 0ustar liggesuserssilhouette <- function(x, ...) UseMethod("silhouette") ## Accessor and more: silhouette.partition <- function(x, ...) { r <- x$silinfo$widths if(is.null(r)) stop("invalid partition object") attr(r, "Ordered") <- TRUE # (cluster , s.i ) attr(r, "call") <- x$call class(r) <- "silhouette" r } silhouette.clara <- function(x, full = FALSE, subset = NULL, ...) { cll <- sys.call() n <- length(x$clustering) sampsize <- length(x$sample) ## == attr(x$diss, "Size") if(is.null(subset) && full < sampsize / n) # use the (sub) sample in clara() return(NextMethod()) ##-> silh*.partition() ## else : full = TRUE or full is number in (0, 1] if(is.null(x$data)) stop("full silhouette is only available for results of 'clara(*, keep.data = TRUE)'") use.subset <- length(subset) >= min(10, n) && all(1 <= subset & subset <= n) if(use.subset && !missing(full)) warning("specified both 'full' and 'subset'; will use 'subset'") else if(!isTRUE(full) && !(is.numeric(full) && length(full) == 1 && 0 < full && full <= 1)) stop("'full' must be FALSE, TRUE, or a number in [0, 1]") ## Compute "full" or 'subset' silhouette -- from clustering + full distances: if(!use.subset && !isTRUE(full)) ## choose random subset <- sample.int(n, size = full*n) r <- if(isTRUE(full)) silhouette(x$clustering, daisy(x$data, metric = attr(x, "Metric"))) else silhouette(x$clustering[subset], daisy(x$data[subset, ,drop=FALSE], metric = attr(x, "Metric"))) cll[[2]] <- x$call attr(r, "call") <- cll ## substitute(silhouette(CL, full = FULL, subset = SUBS), ## list(CL = x$call, FULL = full, SUBS = subset)) r } ## R-only implementation -- no longer used nor exported, was silhouette.default.R() till 2023 silhouetteR <- function(x, dist, dmatrix, ...) { cll <- match.call() if(is.list(x) && !is.null(cl <- x$clustering)) x <- cl n <- length(x) if(!all(x == round(x))) stop("'x' must only have integer codes") k <- length(clid <- sort(unique(x))) if(k <= 1 || k >= n) return(NA) ## check dist/dmatrix if(missing(dist)) { if(missing(dmatrix)) stop("Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'") if(is.null(dm <- dim(dmatrix)) || length(dm) != 2 || !all(n == dm)) stop("'dmatrix' is not a dissimilarity matrix compatible to 'x'") } else { # 'dist' dist <- as.dist(dist) # hopefully if(n != attr(dist, "Size")) stop("clustering 'x' and dissimilarity 'dist' are incompatible") dmatrix <- as.matrix(dist)# so we can apply(.) below } wds <- matrix(NA, n,3, dimnames = list(names(x), c("cluster","neighbor","sil_width"))) for(j in 1:k) { # j-th cluster: Nj <- sum(iC <- x == clid[j]) wds[iC, "cluster"] <- clid[j] ## minimal distances to points in all other clusters: diC <- rbind(apply(dmatrix[!iC, iC, drop = FALSE], 2, function(r) tapply(r, x[!iC], mean)))# (k-1) x Nj ## max.col() breaks ties at random; rather do not want random ## behavior of silhouette, (but rather "pam" compatible one): minC <- apply(diC, 2, which.min) ## FIXME minC <- max.col(-t(diC)) ## FIXME : extend max.col(*, ties.method = "min") {or similar} ! wds[iC,"neighbor"] <- clid[-j][minC] s.i <- if(Nj > 1) { a.i <- colSums(dmatrix[iC, iC])/(Nj - 1) # length(a.i)= Nj b.i <- diC[cbind(minC, seq(along = minC))] ifelse(a.i != b.i, (b.i - a.i) / pmax(b.i, a.i), 0) } else 0 wds[iC,"sil_width"] <- s.i } attr(wds, "Ordered") <- FALSE attr(wds, "call") <- cll class(wds) <- "silhouette" wds } ## silhouetteR (was silhouette.default.R} silhouette.default <- function(x, dist, dmatrix, ...) { cll <- match.call() if(is.list(x) && !is.null(cl <- x$clustering)) x <- cl n <- length(x) if(!all(x == round(x))) stop("'x' must only have integer codes") k <- length(ux <- unique(x <- as.integer(x))) if(k <= 1 || k >= n) # silhouette undefined for trivial clusterings return(NA) doRecode <- (any(ux < 1) || any(ux > k)) ## need to recode if(doRecode) x <- as.integer(fx <- factor(x)) # now *has* values in 1:k ## check dist/dmatrix has.dmatrix <- missing(dist) if(has.dmatrix) { if(missing(dmatrix)) stop("Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'") if(is.null(dm <- dim(dmatrix)) || length(dm) != 2 || !all(n == dm)) stop("'dmatrix' is not a dissimilarity matrix compatible to 'x'") } else { # 'dist' dist <- as.dist(dist) # hopefully if(n != attr(dist, "Size")) stop("clustering 'x' and dissimilarity 'dist' are incompatible") } out <- .C(sildist, d = as.numeric(if(has.dmatrix) dmatrix else dist), as.integer(n), x, as.integer(k), diC = numeric(n*k), counts = integer(k), si = numeric(n), neighbor = integer(n), ismat = has.dmatrix)[c("si", "neighbor")] if(doRecode) { code.x <- as.integer(levels(fx)) x <- code.x[x] } wds <- cbind(cluster = x, neighbor = if(doRecode) code.x[out$neighbor] else out$neighbor, "sil_width" = out$si) if(doRecode) attr(wds, "codes") <- code.x attr(wds, "Ordered") <- FALSE attr(wds, "call") <- cll class(wds) <- "silhouette" wds } ## copy from base; unfortunately needed for S3method(fn, cl, meth) in ../NAMESPACE : as.data.frame.matrix <- as.data.frame.matrix sortSilhouette <- function(object, ...) { if(is.null(n <- nrow(object)) || n < 1) stop("invalid silhouette structure") if(attr(object,"Ordered")) { if(is.null(attr(object, "iOrd"))) attr(object, "iOrd") <- 1:n return(object) } ## Else : if(is.null(rownames(object))) rownames(object) <- as.character(1:n) ## k <- length(clid <- sort(unique(cl <- object[,"cluster"])))# cluster ID s cl <- object[,"cluster"] r <- object[iOrd <- order(cl, - object[,"sil_width"]) , , drop = FALSE] ## r has lost attributes of object; restore them, but do *not* ## change dimnames: nms <- names(at <- attributes(object)) for(n in nms[!(nms %in% c("dim","dimnames","iOrd","Ordered"))]) attr(r, n) <- at[[n]] attr(r,"iOrd") <- iOrd # the ordering attr(r,"Ordered") <- TRUE r } summary.silhouette <- function(object, FUN = mean, ...) { if(ncol(object) != 3) stop("invalid 'silhouette' object") cl <- object[, "cluster"] si <- object[, "sil_width"] r <- list(si.summary = summary(si, ...), clus.avg.widths = tapply(si, cl, FUN), clus.sizes = table(cl), avg.width = FUN(si), call = attr(object,"call"), codes = attr(object,"codes"), Ordered = attr(object,"Ordered")) class(r) <- "summary.silhouette" r } print.summary.silhouette <- function(x, ...) { k <- length(csiz <- x$clus.sizes) cls <- paste0("Cluster sizes", if(!is.null(x$codes)) paste0(", ids = (",paste(x$codes, collapse=", "),"),")) cat("Silhouette of", sum(csiz), "units in", k, "clusters", if(!is.null(x$call)) paste("from", deparse1(x$call)), ":\n", cls, "and average silhouette widths:\n") cwid <- x$clus.avg.widths names(cwid) <- csiz print(cwid, ...) cat("Individual silhouette widths:\n") print(x$si.summary, ...) invisible(x) } ## This was the internal function silhouPlot() in plot.partition() : plot.silhouette <- function(x, nmax.lab = 40, max.strlen = 5, main = NULL, sub = NULL, xlab = expression("Silhouette width " * s[i]), col = "gray", do.col.sort = length(col) > 1, border = 0, cex.names = par("cex.axis"), do.n.k = TRUE, do.clus.stat = TRUE, ...) { if(!is.matrix(x) || ncol(x) != 3) stop("No valid silhouette information (#{clusters} =? 1)") n <- nrow(x) x <- sortSilhouette(x) s <- rev(x[, "sil_width"]) space <- c(0, rev(diff(cli <- x[, "cluster"]))) space[space != 0] <- 0.5 # gap between clusters axisnames <- (n < nmax.lab) if(axisnames) names <- substring(rev(rownames(x)), 1, max.strlen) if(is.null(main)) { main <- "Silhouette plot" if(!is.null(cll <- attr(x,"call"))) { # drop initial "silhouette": if(!is.na(charmatch("silhouette", deparse1(cll[[1]])))) cll[[1]] <- as.name("FF") main <- paste(main, "of", sub("^FF","", deparse1(cll))) } } smry <- summary(x) k <- length(nj <- smry$clus.sizes) # k clusters if(is.null(sub)) sub <- paste("Average silhouette width : ", round(smry$avg.width, digits = 2)) if(do.col.sort && (lc <- length(col)) > 1) { if(lc == k)# cluster wise coloring col <- col[cli] else ## unit wise coloring if(lc != n) col <- rep(col, length = n) col <- rev(col) # was rev(col[attr(x, "iOrd")]) } y <- barplot(s, space = space, names.arg = names, xlab = xlab, xlim = c(min(0, min(s)), 1), horiz = TRUE, las = 1, mgp = c(2.5, 1, 0), col = col, border = border, cex.names = cex.names, axisnames = axisnames, ...) title(main = main, sub = sub, adj = 0) if(do.n.k) { mtext(paste("n =", n), adj = 0) mtext(substitute(k ~~ "clusters" ~~ C[j], list(k=k)), adj= 1) } if(do.clus.stat) { mtext(expression(paste(j," : ", n[j]," | ", ave[i %in% Cj] ~~ s[i])), adj = 1.04, line = -1.2) y <- rev(y) hasCodes <- !is.null(cx <- attr(x,"codes")) for(j in 1:k) { j. <- if(hasCodes) cx[j] else j yj <- mean(y[cli == j.]) text(1, yj, paste(j.,": ", nj[j]," | ", format(smry$clus.avg.widths[j], digits = 1, nsmall = 2)), xpd = NA, adj = 0.8) } } } cluster/R/coef.R0000644000176200001440000000253011674345261013204 0ustar liggesusers#### R-interface to Agglomerative / Divisive coefficient #### coef.twins <- function(object, ...) { if(inherits(object, "agnes")) object$ac else if(inherits(object, "diana")) object$dc else stop("invalid 'twins' object") } coef.hclust <- function(object, ...) { ## Author: Martin Maechler, Date: 27 Nov 2004 ## Now "really" using $merge _and_ $height -- assuming they match! ht <- object$height mrg <- object$merge nh <- length(ht) stopifnot(nh > 0, is.matrix(mrg), dim(mrg) == c(nh,2), is.numeric(ht), is.numeric(mrg), !is.unsorted(ht))# then they match with merge ## stopifnot(all.equal(1:n, sort(-mrg[mrg < 0]))) 1 - sum(rowSums(mrg < 0) * ht) / max(ht) / (nh+1) } ## Note this is (the only!) direct interface to bncoef(), ## ---- which is used internally both in agnes() and diana() : coefHier <- function(object) { ## Purpose: Compute agglomerative *or* divisive coefficient from hclust/agnes/diana ## ---------------------------------------------------------------------- ## Author: Martin Maechler, Date: 27 Nov 2004 nh <- length(ht <- object$height) stopifnot(nh > 0, is.numeric(ht)) .C(R_bncoef, n = as.integer(nh + 1L), ban= as.double(c(0., ht)),# <-- is this really tbe ban[]nner, as in ../src/twins.c ? cf = double(1))$cf } cluster/R/diana.q0000644000176200001440000001151414726055031013377 0ustar liggesusers### $Id: diana.q 8468 2024-12-10 15:11:21Z maechler $ diana <- function(x, diss = inherits(x, "dist"), metric = "euclidean", stand = FALSE, stop.at.k = FALSE, keep.diss = n < 100, keep.data = !diss, trace.lev = 0) { if((diss <- as.logical(diss))) { ## check type of input vector if(anyNA(x)) stop("NA values in the dissimilarity matrix not allowed.") if(data.class(x) != "dissimilarity") { # try to convert to if(!is.null(dim(x))) { x <- as.dist(x) # or give an error } else { ## possibly convert input *vector* if(!is.numeric(x) || is.na(n <- sizeDiss(x))) stop("'x' is not and cannot be converted to class \"dissimilarity\"") attr(x, "Size") <- n } class(x) <- dissiCl if(is.null(attr(x,"Metric"))) attr(x, "Metric") <- "unspecified" } n <- as.integer(attr(x, "Size")) dv <- x[lower.to.upper.tri.inds(n)] # <==> n >= 2 or error ## prepare arguments for the Fortran call dv <- c(0., dv)# double {FIXME: an allocation waste for large n !!!} jp <- 1L mdata <- FALSE ndyst <- 0 x2 <- double(1) } else { ## check input matrix and standardize, if necessary x <- data.matrix(x) if(!is.numeric(x)) stop("x is not a numeric dataframe or matrix.") x2 <- if(stand) scale(x, scale = apply(x, 2, meanabsdev)) else x ndyst <- if(metric == "manhattan") 2 else 1 n <- nrow(x2) jp <- ncol(x2) if(!jp) stop("x has zero columns") # easier to read than later error if((mdata <- any(inax <- is.na(x2)))) { # TRUE if x[] has any NAs jtmd <- integer(jp) jtmd[apply(inax, 2L, any)] <- -1L ## VALue for MISsing DATa valmisdat <- 1.1* max(abs(range(x2, na.rm=TRUE))) x2[inax] <- valmisdat } dv <- double(1 + (n * (n - 1))/2) } stopifnot(length(trace.lev <- as.integer(trace.lev)) == 1) stopifnot(is.logical(stop.at.k) || (is.numeric(stop.at.k) && 1 <= stop.at.k && stop.at.k <= n)) C.keep.diss <- keep.diss && !diss res <- .C(twins, n, jp, as.double(x2), dv, # w/ length >= 1 dis = double(if(C.keep.diss) length(dv) else 1L), jdyss = if(C.keep.diss) diss + 10L else as.integer(diss), if(mdata && jp) rep(valmisdat, jp) else double(1L), if(mdata) jtmd else integer(jp), as.integer(ndyst), 2L,# jalg = 2 <==> DIANA as.integer(stop.at.k),# 'method'; default = 0L : do *not* stop early integer(n), ner = integer(n), ban = double(n), dc = double(1L), double(1L), # { unused for diana() } merge = matrix(0L, n - 1L, 2L), # integer or error if(n == 0) ! trace = trace.lev)[c("dis", "jdyss", "ner", "ban", "dc", "merge")] if(!diss) { ## give warning if some dissimilarities are missing. if(res$jdyss == -1) stop("No clustering performed, NA's in dissimilarity matrix.\n") if(keep.diss) { ## adapt Fortran output to S: ## convert lower matrix, read by rows, to upper matrix, read by rows. disv <- res$dis[-1] disv[disv == -1] <- NA disv <- disv[upper.to.lower.tri.inds(n)] # <==> n >= 2 or error class(disv) <- dissiCl attr(disv, "Size") <- nrow(x) attr(disv, "Metric") <- metric attr(disv, "Labels") <- dimnames(x)[[1]] } ## add labels to Fortran output if(length(dimnames(x)[[1]]) != 0) order.lab <- dimnames(x)[[1]][res$ner] } else { if(keep.diss) disv <- x ## add labels to Fortran output if(length(attr(x, "Labels")) != 0) order.lab <- attr(x, "Labels")[res$ner] } clustering <- list(order = res$ner, height = res$ban[-1], dc = res$dc, merge = res$merge, diss = if(keep.diss)disv, call = match.call()) if(exists("order.lab")) clustering$order.lab <- order.lab if(keep.data && !diss) { if(mdata) x2[x2 == valmisdat] <- NA clustering$data <- x2 } class(clustering) <- c("diana", "twins") clustering } print.diana <- function(x, ...) { cat("Merge:\n") print(x$merge, ...) cat("Order of objects:\n") print(if (length(x$order.lab) != 0) x$order.lab else x$order, quote = FALSE, ...) cat("Height:\n") print(x$height, ...) cat("Divisive coefficient:\n") print(x$dc, ...) cat("\nAvailable components:\n") print(names(x), ...) invisible(x) } summary.diana <- function(object, ...) { class(object) <- "summary.diana" object } print.summary.diana <- function(x, ...) { cat("Merge:\n"); print(x$merge, ...) cat("Order of objects:\n") print(if(length(x$order.lab)) x$order.lab else x$order, quote = FALSE, ...) cat("Height:\n"); print(x$height, ...) cat("Divisive coefficient:\n"); print(x$dc, ...) if(!is.null(x$diss)) { ## Dissimilarities: cat("\n"); print(summary(x$diss, ...)) } cat("\nAvailable components:\n"); print(names(x), ...) invisible(x) } cluster/R/plotpart.q0000644000176200001440000003777314671755145014223 0ustar liggesusers### $Id: plotpart.q 8451 2024-09-16 07:12:37Z maechler $ plot.partition <- function(x, ask = FALSE, which.plots = NULL, nmax.lab = 40, max.strlen = 5, data = x$data, dist = NULL, stand = FALSE, lines = 2, shade = FALSE, color = FALSE, labels = 0, plotchar = TRUE, span = TRUE, xlim = NULL, ylim = NULL, main = NULL, ...) { if(is.null(x$data))# data not kept x$data <- data if(is.null(x$data) && !is.null(dist)) x$diss <- dist if(is.null(which.plots) && !ask) which.plots <- { if(is.null(x$data) && (is.null(x$diss) || inherits(x, "clara"))) 2 ## no clusplot else 1:2 } if(ask && is.null(which.plots)) { ## Use 'menu' .. tmenu <- paste("plot ", ## choices : c("All", "Clusplot", "Silhouette Plot")) do.all <- FALSE repeat { if(!do.all) pick <- menu(tmenu, title = "\nMake a plot selection (or 0 to exit):\n") + 1 switch(pick, return(invisible())# 0 -> exit loop , do.all <- TRUE# 1 : All , clusplot(x, stand = stand, lines = lines, shade = shade, color = color, labels = labels, plotchar = plotchar, span = span, xlim = xlim, ylim = ylim, main = main, ...) , plot(silhouette(x), nmax.lab, max.strlen, main = main) ) if(do.all) { pick <- pick + 1; do.all <- pick <= length(tmenu) + 1} } invisible() } else { ask <- prod(par("mfcol")) < length(which.plots) && dev.interactive() if(ask) { op <- par(ask = TRUE); on.exit(par(op)) } for(i in which.plots) switch(i, clusplot(x, stand = stand, lines = lines, shade = shade, color = color, labels = labels, plotchar = plotchar, span = span, xlim = xlim, ylim = ylim, main = main, ...) , plot(silhouette(x), nmax.lab, max.strlen, main = main) ) ## and return() whatever *plot(..) returns } } clusplot <- function(x, ...) UseMethod("clusplot") ##' @title Make/Check the (n x 2) matrix needed for clusplot.default(): ##' @param x numeric matrix or dissimilarity matrix (-> clusplot.default()) ##' @param diss logical indicating if 'x' is dissimilarity matrix. In that case, ##' 'cmdscale()' is used, otherwise (typically) 'princomp()'. ##' @return a list with components ##' x1 : (n x 2) numeric matrix; ##' var.dec: a number (in [0,1]), the "variance explained" ##' labs : the point labels (possibly 1:n) ##' @author Martin Maechler mkCheckX <- function(x, diss) { if(diss) { if(anyNA(x)) stop("NA-values are not allowed in dist-like 'x'.") if(inherits(x, "dist")) { n <- attr(x, "Size") labs <- attr(x, "Labels") } else { # x (num.vector or square matrix) must be transformed into diss. siz <- sizeDiss(x) if(is.na(siz)) { if((n <- nrow(x)) != ncol(x)) stop("Distances must be result of dist or a square matrix.") if(all.equal(x, t(x)) != TRUE) stop("the square matrix is not symmetric.") labs <- dimnames(x)[[1]] } else { if(!is.vector(x)) { labs <- attr(x, "Labels") # possibly NULL x <- as.matrix(x) if((n <- nrow(x)) == ncol(x) && all.equal(x, t(x)) == TRUE) { labs <- dimnames(x)[[1]] } else { ## Hmm, when does this ever happen : ## numeric, not-dist, non-vector, not symmetric matrix ? warning(">>>>> funny case in clusplot.default() -- please report!\n") ## if(n != sizeDiss(x)) ... attr(x, "Size") <- siz <- sizeDiss(x) if(is.null(labs)) labs <- 1:siz } } else { attr(x, "Size") <- n <- siz } } } x1 <- cmdscale(x, k = 2, add = TRUE) if(x1$ac < 0) ## Rarely ! (FIXME: need and test example!) x1 <- cmdscale(x, k = 2, eig = TRUE)# TODO: not 'eig', but list. = TRUE for R >= 3.2.2 var.dec <- x1$GOF[2] # always in [0,1] x1 <- x1$points } else { ## Not (diss) if(!is.matrix(x)) stop("x is not a data matrix") if(anyNA(x)) { y <- is.na(x) if(any(apply(y, 1, all))) stop("one or more objects contain only missing values") if(any(apply(y, 2, all))) stop("one or more variables contain only missing values") x <- apply(x, 2, function(x) { x[is.na(x)] <- median(x, na.rm = TRUE); x } ) message("Missing values were displaced by the median of the corresponding variable(s)") } n <- nrow(x) labs <- dimnames(x)[[1]] x1 <- if(ncol(x) <= 1) { var.dec <- 1 matrix(c(t(x), rep(0, length(x))), ncol = 2) } else { prim.pr <- princomp(x, scores = TRUE, cor = ncol(x) > 2) sd2 <- prim.pr$sdev^2 var.dec <- cumsum(sd2/sum(sd2))[2] prim.pr$scores[, 1:2] } } list(x = x1, var.dec = var.dec, labs = if(is.null(labs)) 1:n else labs) } ## mkCheckX() ## TODO: allow components (2,3) or (1,3) instead of always (1,2) => drop 'var.dec', 'sub' clusplot.default <- function(x, clus, diss = FALSE, s.x.2d = mkCheckX(x, diss), stand = FALSE, lines = 2, shade = FALSE, color = FALSE, labels = 0, plotchar = TRUE, col.p = "dark green", # was 5 (= shaded col) col.txt = col.p, col.clus = if(color) c(2, 4, 6, 3) else 5, cex = 1, cex.txt = cex, span = TRUE, add = FALSE, xlim = NULL, ylim = NULL, main = paste("CLUSPLOT(", deparse1(substitute(x)),")"), sub = paste("These two components explain", round(100 * var.dec, digits = 2), "% of the point variability."), xlab = "Component 1", ylab = "Component 2", verbose = getOption("verbose"), ...) { force(main) if(is.data.frame(x)) x <- data.matrix(x) if(!is.numeric(x)) stop("x is not numeric") ## FIXME: - if labels == 0 or == 4, do not need "labs" ## - if !missing(sub), do not need "var.dec" stopifnot(is.list(s.x.2d), c("x","labs","var.dec") %in% names(s.x.2d), (n <- nrow(x1 <- s.x.2d[["x"]])) > 0) labels1 <- s.x.2d[["labs"]] var.dec <- s.x.2d[["var.dec"]] ## --- The 2D space is setup and points are in x1[,] (n x 2) --- clus <- as.vector(clus) if(length(clus) != n) stop("The clustering vector is of incorrect length") clus <- as.factor(clus) if(anyNA(clus)) stop("NA-values are not allowed in clustering vector") if(stand) x1 <- scale(x1) levclus <- levels(clus) nC <- length(levclus) # the number of clusters d.x <- diff(range(x1[, 1])) d.y <- diff(range(x1[, 2])) z <- A <- vector("list", nC) loc <- matrix(0, nrow = nC, ncol = 2) d2 <- verhoud <- numeric(nC) ## num1 .. num6 : all used only once -- there are more constants anyway num3 <- 90 num6 <- 70 for(i in 1:nC) { ##------------- i-th cluster -------------- x <- x1[clus == levclus[i],, drop = FALSE ] aantal <- nrow(x) # number of observations in cluster [i] cov <- var(if(aantal == 1) { if(verbose) cat("cluster",i," has only one observation ..\n") rbind(x, c(0, 0)) } else x) x.1 <- range(x[, 1]) y.1 <- range(x[, 2]) notrank2 <- qr(cov, tol = 0.001)$rank != 2 if(!span && notrank2) { d2[i] <- 1 if((abs(diff(x.1)) > d.x/70) || (abs(diff(y.1)) > d.y/50)) { loc[i, ] <- c(x.1[1] + diff(x.1)/2, y.1[1] + diff(y.1)/2) a <- sqrt((loc[i, 1] - x.1[1])^2 + (loc[i, 2] - y.1[1])^2) a <- a + 0.05 * a num2 <- 40 if(abs(diff(x.1)) > d.x/70 ) { ind1 <- which.max(x[,1]) ind2 <- which.min(x[,1]) q <- atan((x[ind1, 2] - x[ind2, 2])/ (x[ind1, 1] - x[ind2, 1])) b <- if(d.y == 0) 1 else if(abs(diff(y.1)) > d.y/50) diff(y.1)/10 ## num1 <- 10 else d.y/num2 } else { b <- if(d.x == 0) 1 else d.x/num2 q <- pi/2 } D <- diag(c(a^2, b^2)) R <- rbind(c(cos(q), -sin(q)), c(sin(q), cos(q))) A[[i]] <- (R %*% D) %*% t(R) } else { a <- d.x/num3 b <- d.y/num6 if(a == 0) a <- 1 if(b == 0) b <- 1 A[[i]] <- diag(c(a^2, b^2)) loc[i, ] <- x[1, ] } oppervlak <- pi * a * b } else if(span && notrank2) { d2[i] <- 1 if(sum(x[, 1] != x[1, 1]) != 0 || sum(x[, 2] != x[1, 2]) != 0) { loc[i, ] <- c(x.1[1] + diff(x.1)/2, y.1[1] + diff(y.1)/2) a <- sqrt((loc[i, 1] - x.1[1])^2 + (loc[i, 2] - y.1[1])^2) if(any(x[, 1] != x[1, 1])) { ind1 <- which.max(x[,1]) ind2 <- which.min(x[,1]) q <- atan((x[ind1, 2] - x[ind2, 2])/ (x[ind1, 1] - x[ind2, 1])) } else { q <- pi/2 } b <- 1e-7 D <- diag(c(a^2, b^2)) R <- rbind(c(cos(q), -sin(q)), c(sin(q), cos(q))) A[[i]] <- (R %*% D) %*% t(R) } else { a <- d.x/num3 b <- d.y/num6 if(a == 0) a <- 1 if(b == 0) b <- 1 A[[i]] <- diag(c(a^2, b^2)) loc[i, ] <- x[1, ] } oppervlak <- pi * a * b } else { ## rank2 if(!span) { loc[i, ] <- colMeans(x) d2[i] <- max(mahalanobis(x, loc[i, ], cov)) ## * (1+ 0.01)^2 --- dropped factor for back-compatibility } else { ## span and rank2 if(verbose) cat("span & rank2 : calling \"spannel\" ..\n") k <- 2L res <- .C(spannel, aantal, ndep= k, dat = cbind(1., x), sqdist = double(aantal), l1 = double((k+1) ^ 2), double(k), double(k), prob = double(aantal), double(k+1), eps = (0.01),## convergence tol. maxit = 5000L, ierr = integer(1)) if(res$ierr != 0) ## MM : exactmve not available here ! warning("Error in C routine for the spanning ellipsoid,\n rank problem??") cov <- cov.wt(x, res$prob) loc[i, ] <- cov$center ## NB: cov.wt() in R has extra wt[] scaling; revert here: cov <- cov$cov * (1 - sum(cov$wt^2)) d2[i] <- weighted.mean(res$sqdist, res$prob) if(verbose) cat("ellipse( A= (", format(cov[1,]),"*", format(cov[2,2]), "),\n\td2=", format(d2[i]), ", loc[]=", format(loc[i, ]), ")\n") } A[[i]] <- cov ## oppervlak (flam.) = area (Engl.) oppervlak <- pi * d2[i] * sqrt(cov[1, 1] * cov[2, 2] - cov[1, 2]^2) } z[[i]] <- ellipsoidPoints(A[[i]], d2[i], loc[i, ], n.half= 201) verhoud[i] <- aantal/oppervlak } ## end for( i-th cluster ) x.range <- do.call(range, lapply(z, `[`, i=TRUE, j = 1)) y.range <- do.call(range, lapply(z, `[`, i=TRUE, j = 2)) verhouding <- sum(verhoud[verhoud < 1e7]) if(verhouding == 0) verhouding <- 1 ## num4 <- 37 ; num5 <- 3 --- but '41' is another constant density <- 3 + (verhoud * 37)/verhouding density[density > 41] <- 41 if (span) { if (d.x == 0) ## diff(range(x[,1]) == 0 : x-coords all the same x.range <- x1[1, 1] + c(-1,1) if (d.y == 0) ## diff(range(x[,2]) == 0 : y-coords all the same y.range <- x1[1, 2] + c(-1,1) } if(is.null(xlim)) xlim <- x.range if(is.null(ylim)) ylim <- y.range if(length(col.p) < n) col.p <- rep(col.p, length= n) ## --- Now plotting starts --- ## "Main plot" -- if(!add) { plot(x1, xlim = xlim, ylim = ylim, xlab = xlab, ylab = ylab, main = main, type = if(plotchar) "n" else "p", # if(plotchar) add points later col = col.p, cex = cex, ...) if(!is.null(sub) && !is.na(sub) && nchar(sub) > 0) title(sub = sub, adj = 0) } if(color) { if(length(col.clus) < min(4,nC)) stop("'col.clus' should have length 4 when color is TRUE") i.verh <- order(verhoud) jInd <- if(nC > 4) pam(verhoud[i.verh], 4)$clustering else 1:nC for(i in 1:nC) { k <- i.verh[i] polygon(z[[k]], density = if(shade) density[k] else 0, col = col.clus[jInd[i]], ...) } col.clus <- col.clus[jInd][order(i.verh)] } else { for(i in 1:nC) polygon(z[[i]], density = if(shade) density[i] else 0, col = col.clus, ...) } ## points after polygon in order to write ON TOP: if(plotchar) { karakter <- 1:19 for(i in 1:nC) { iC <- clus == levclus[i] points(x1[iC, , drop = FALSE], cex = cex, pch = karakter[1+(i-1) %% 19], col = col.p[iC], ...) } } if(nC > 1 && (lines == 1 || lines == 2)) { ## Draw lines between all pairs of the nC cluster (centers) ## utilities for computing ellipse intersections: clas.snijpunt <- function(x, loc, m, n, p) { if ( !is.na(xm <- x[1,m]) && loc[n, m] <= xm && xm <= loc[p, m]) x[1, ] else if(!is.na(xm <- x[2,m]) && loc[n, m] <= xm && xm <= loc[p, m]) x[2, ] else NA } coord.snijp1 <- function(x, gemid) x[2, 2] - 2 * x[1, 2] * gemid + x[1, 1] * gemid^2 coord.snijp2 <- function(x, d2, y) ((x[1, 1] * x[2, 2] - x[1, 2]^2) * d2)/y coord.snijp3 <- function(xx, y, gemid) { sy <- sqrt(y) sy <- c(sy, -sy) cbind(xx[1] + sy, xx[2] + gemid*sy) } afstand <- matrix(0, ncol = nC, nrow = nC) for(i in 1:(nC - 1)) { for(j in (i + 1):nC) { gemid <- (loc[j, 2] - loc[i, 2])/(loc[j, 1] - loc[i, 1]) s0 <- coord.snijp1(A[[i]], gemid) b0 <- coord.snijp2(A[[i]], d2[i], s0) snijp.1 <- coord.snijp3(loc[i,], y=b0, gemid) s1 <- coord.snijp1(A[[j]], gemid) b1 <- coord.snijp2(A[[j]], d2[j], s1) snijp.2 <- coord.snijp3(loc[j,], y=b1, gemid) if(loc[i, 1] != loc[j, 1]) { if(loc[i, 1] < loc[j, 1]) { punt.1 <- clas.snijpunt(snijp.1, loc, 1, i, j) punt.2 <- clas.snijpunt(snijp.2, loc, 1, i, j) } else { punt.1 <- clas.snijpunt(snijp.1, loc, 1, j, i) punt.2 <- clas.snijpunt(snijp.2, loc, 1, j, i) } } else { if(loc[i, 2] < loc[j, 2]) { punt.1 <- clas.snijpunt(snijp.1, loc, 2, i, j) punt.2 <- clas.snijpunt(snijp.2, loc, 2, i, j) } else { punt.1 <- clas.snijpunt(snijp.1, loc, 2, j, i) punt.2 <- clas.snijpunt(snijp.2, loc, 2, j, i) } } if(is.na(punt.1[1]) || is.na(punt.2[1]) || (sqrt((punt.1[1] - loc[i, 1])^2 + (punt.1[2] - loc[i, 2])^2) + sqrt((punt.2[1] - loc[j, 1])^2 + (punt.2[2] - loc[j, 2])^2)) > sqrt((loc[j, 1] - loc[i, 1])^2 + (loc[j, 2] - loc[i, 2])^2)) { afstand[i, j] <- NA } else if(lines == 1) { afstand[i, j] <- sqrt((loc[i, 1] - loc[j, 1])^2 + (loc[i, 2] - loc[j, 2])^2) segments(loc[i, 1], loc[i, 2], loc[j, 1], loc[j, 2], col = 6, ...) } else { ## lines == 2 afstand[i, j] <- sqrt((punt.1[1] - punt.2[1])^2 + (punt.1[2] - punt.2[2])^2) segments(punt.1[1], punt.1[2], punt.2[1], punt.2[2], col = 6, ...) } } } afstand <- t(afstand) + afstand } else afstand <- NULL if(labels) { if(labels == 1) { for(i in 1:nC) { ## add cluster border points m <- nrow(z[[i]]) ni <- length(ii <- seq(1, m, by = max(1, m %/% 40))) x1 <- rbind(x1, z[[i]][ii, ]) labels1 <- c(labels1, rep(levclus[i], ni)) ## identify() only allows one color: ##col.txt <- c(col.txt, rep(col.clus[if(color) i else 1], ni)) } identify(x1, labels = labels1, col = col.txt[1]) } else { ### FIXME --- 'cex.txt' but also allow to specify 'cex' (for the points) ??? Stext <- function(xy, labs, ...) { ## FIXME: these displacements are not quite ok! xy[, 1] <- xy[, 1] + diff(x.range)/130 xy[, 2] <- xy[, 2] + diff(y.range)/50 text(xy, labels = labs, ...) } if(labels == 3 || labels == 2) Stext(x1, labels1, col = col.txt, cex = cex.txt, ...) if(labels %in% c(2,4,5)) { maxima <- t(sapply(z, `[`, i=201, j=1:2)) Stext(maxima, levclus, font = 4, col = col.clus, cex = cex, ...) } if(labels == 5) identify(x1, labels = labels1, col = col.txt[1]) } } density[density == 41] <- NA invisible(list(Distances = afstand, Shading = density)) } clusplot.partition <- function(x, main = NULL, dist = NULL, ...) { if(is.null(main) && !is.null(x$call)) main <- paste0("clusplot(",format(x$call),")") if(length(x$data) != 0 && (!anyNA(x$data) || data.class(x) == "clara")) clusplot.default(x$data, x$clustering, diss = FALSE, main = main, ...) else if(!is.null(dist)) clusplot.default(dist, x$clustering, diss = TRUE, main = main, ...) else if(!is.null(x$diss)) clusplot.default(x$diss, x$clustering, diss = TRUE, main = main, ...) else { ## try to find "x$diss" by looking at the pam() call: if(!is.null(x$call)) { xD <- try(eval(x$call[[2]], envir = parent.frame())) if(inherits(xD, "try-error") || !inherits(xD, "dist")) stop(gettextf("no diss nor data found, nor the original argument of %s", deparse1(x$call))) ## else ## warning("both 'x$diss' and 'dist' are empty; ", ## "trying to find the first argument of ", deparse1(x$call)) clusplot.default(xD, x$clustering, diss = TRUE, main = main, ...) } else stop("no diss nor data found for 'clusplot()'") } } cluster/R/clusGapGen.R0000644000176200001440000001324413257175664014333 0ustar liggesusers### From Master Thesis of Emmanuel Profumo (w/ M.Maechler) Autumn 2016--March 2017 ### "Generalized clusGap()" : We cannot be 100% compatible to clusGap() #' @param x the data, can be a data frame or a matrix #' @param algo, a clustering algorithm function taking the prepared data and #' a number of clusters as arguments #' @param index, a function taking a clustering vector and the prepared data #' which returns the value of a validity index. Index can also be a list of such #' functions to obtain results for different indices. #' For coherence with the originally proposed Gap Statistic in Tibshirani et al's #' a LOWER value of the validity index implies a better clustering quality, so #' indices such as average silhouette width should be added a minus sign. #' This can be changed by setting the argument low=FALSE. #' @param modelH0, a function which takes as argument at least the data x, #' parameters estimated from the data, and further arguments in ... #' @param K.max, number of different clusters for which the index should be #' evaluated. #' @param B, the number of bootstraps sample. #' @param transformData, a function which takes the data x as argument and #' processed it for clustering #' @param modelH0Param, a function which takes as argument the data x and returns #' a list of modelH0 parameters with matching names. #' @param low, logical, if FALSE a HIGHER value of the index or the indices in the #' user provided list implies a better clustering quality #' #' @return if index is just one function a list with components: #' Indks, the bootstrap validity plots #' Ind, the validity plot corresponding to the data #' E.Ind, the sample mean of the bootstrap validity plots #' gap, the calibrated validity plot, difference between E.Ind and Ind #' gapHen, the gap divided by the standard deviation of the bootstraps validity plots #' SE.sim, the sample standard error of the bootstrap validity plots with a correction #' term for bootstrap estimation #' SE, the sample standard error #' if index is a list of index then each of the components above are lists with values #' for each index clusGapGen <- function(x, algo, index, modelH0, K.max, B = 100, transformData = identity, modelH0Param = function(y) list(), low=TRUE, verbose = interactive(), ...) { ind.isList <- is.list(index) if (is.function(index)) index <- list(index) else if (!ind.isList || !all(vapply(index, is.function, NA))) stop("index has to be a function or a list of function") Ind <- E.Ind <- SE.sim <- SE <- index for (i in seq_along(index)) Ind[[i]] <- E.Ind[[i]] <- SE.sim[[i]] <- numeric(K.max) if(verbose) cat("Clustering k = 1,2,..., K.max (= ",K.max,"): .. ", sep='') xt <- transformData(x) for(k in 1:K.max){ cls <- algo(xt,k) for (i in seq_along(index)) Ind[[i]][k] <- index[[i]](cls,xt) } if(verbose) cat("done\n") Indks <- index for (i in seq_along(index)) Indks[[i]] <- matrix(0, B, K.max) param <- modelH0Param(x) if(verbose) cat("Bootstrapping, b = 1,2,..., B (= ", B, ") [one \".\" per sample]:\n", sep="") for (b in 1:B) { z <- do.call(modelH0,c(list(x=x),param,list(...))) zt <- transformData(z) for(k in 1:K.max) { cls <- algo(zt,k) for (i in seq_along(index)) Indks[[i]][b,k] <- index[[i]](cls,zt) } if(verbose) cat(".", if(b %% 50 == 0) paste(b,"\n")) } if(verbose && (B %% 50 != 0)) cat("",B,"\n") gap <- gapHen <- index for (i in seq_along(index)){ E.Ind[[i]] <- colMeans(Indks[[i]]) var.i <- apply(Indks[[i]], 2, var) SE[[i]] <- sqrt(var.i) SE.sim[[i]] <- sqrt((1 + 1/B) * var.i) gap[[i]] <- gap.i <- E.Ind[[i]] - Ind[[i]] gapHen[[i]] <- gap.i/SE[[i]] if (!low) { gap[[i]] <- -gap[[i]] gapHen[[i]] <- -gapHen[[i]] } } ## TODO: really? make distinction of *list* of indices vs 1 index? ## --- well maybe, keep it: *The* usual case = _one_ index (or not?) if (ind.isList) { list(Indks=Indks,Ind=Ind, E.Ind=E.Ind, gap = gap, gapHen = gapHen ,SE.sim=SE.sim,SE=SE) } else {list(Indks=Indks[[1]],Ind=Ind[[1]], E.Ind=E.Ind[[1]], gap = gap[[1]], gapHen = gapHen[[1]] ,SE.sim=SE.sim[[1]],SE=SE[[1]]) } } #' @param clusGapRes, a list returned by a call of function clusGapGen #' @param main, the main title to the plots #' @param divBySd, logical, if TRUE plot for the standardize version of the gap clusGapGen.plot <- function(clusGapRes,divBySd=FALSE,main=""){ if (!is.list(clusGapRes$Ind)) clusGapRes <- lapply(clusGapRes, function(el) list(el)) for (i in seq_along(clusGapRes$Ind)){ B <- nrow(clusGapRes$Indks[[i]]) K.max <- ncol(clusGapRes$Indks[[i]]) std <- t(replicate(B,rep(1,K.max))) ylm <- range(rbind(clusGapRes$Indks[[i]],clusGapRes$Ind[[i]]),na.rm=TRUE) ylb <- names(clusGapRes$Ind[i]) if (is.null(ylb)) ylb <- paste("Index",as.character(i)) gp <- "gap" namegap <- paste(gp,ylb) if (divBySd) { std <- t(replicate(B,clusGapRes$SE.sim[[i]])) gp <- "gapHen" namegap <- paste(gp,ylb) } matplot(replicate(B,1:K.max),t(clusGapRes$Indks[[i]]), pch = "-",xlab = "k",ylab = ylb, type="l",ylim=ylm,main=main ) lines(1:K.max,clusGapRes$E.Ind[[i]],type="l",col="white",lwd=2) lines(1:K.max,clusGapRes$Ind[[i]],lwd=2) boxplot((clusGapRes$Indks[[i]]-t(replicate(B,clusGapRes$Ind[[i]])))/std, pch = "*",xlab = "k", ylab = namegap,type="l",col=c("light blue"), notch=TRUE, border="grey",main=main ) lines(1:K.max,clusGapRes[[gp]][[i]],type="l",xlab="k",ylab="", col="orangered",lwd=1.5) } } cluster/R/medoids.R0000644000176200001440000000347014277710251013715 0ustar liggesusers# Copyright (C) 2022 Martin Maechler # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # A copy of the GNU General Public License is available at # https://www.R-project.org/Licenses/ ### Compute pam-consistent medoids from a data partition, ### such as from a cutree() medoids <- function(x, clustering, diss = inherits(x, "dist"), USE.NAMES=FALSE, ...) { ## as for pam(), 'x' may *either* be a numeric matrix (n x p) *or* a dissimilarity diss <- as.logical(diss) if(is.na(diss)) stop("'diss' must be one of {TRUE, FALSE}") ## split data 'x' according to clustering if(diss) { ## FIXME! stop("'diss = TRUE' is not implemented yet. Please write to maintainer(\"cluster\")") n <- attr(x, "Size") } else { x <- data.matrix(x)# dropping "automatic rownames" compatibly with daisy() if(!is.numeric(x)) stop("'x' is not a numeric dataframe or matrix.") n <- NROW(x) ## xCl <- split.data.frame(x, clustering) # a list of data sets } ## k <- length(xCl) ids <- split(seq_len(n), clustering) # how the 1:n are split in k ## medoids = integer indices of obs., using pam(*, k=1) within each cluster idCl <- lapply(xCl, function(d) pam(d, k=1L, ...)$id.med) ## select the medoid original 1:n indices: vapply(seq_along(ids), function(j) ids[[j]] [idCl[[j]]], 1L) } cluster/R/pam.q0000644000176200001440000002247614465512654013122 0ustar liggesusers#### PAM : Partitioning Around Medoids #### --- $Id: pam.q 8260 2023-08-11 20:10:20Z maechler $ pam <- function(x, k, diss = inherits(x, "dist"), metric = c("euclidean", "manhattan"), ## FIXME: add "jaccard" medoids = if(is.numeric(nstart)) "random", nstart = if(variant == "faster") 1L else NA, stand = FALSE, cluster.only = FALSE, do.swap = TRUE, keep.diss = !diss && !cluster.only && n < 100, keep.data = !diss && !cluster.only, variant = c("original", "o_1", "o_2", "f_3", "f_4", "f_5", "faster"), pamonce = FALSE, trace.lev = 0) { stopifnot(length(cluster.only) == 1, length(trace.lev) == 1) nMax <- 65536 # 2^16 (as 1+ n(n-1)/2 must be < max_int = 2^31-1) if((diss <- as.logical(diss))) { ## check type of input vector if(anyNA(x)) stop("NA values in the dissimilarity matrix not allowed.") if(keep.data) stop("Cannot keep data when 'x' is a dissimilarity!") if(!inherits(x, "dissimilarity")) { # try to convert to if(!is.null(dim(x))) { x <- as.dist(x) # or give an error } else { ## possibly convert input *vector* if(!is.numeric(x) || is.na(n <- sizeDiss(x))) stop("'x' is not and cannot be converted to class \"dissimilarity\"") attr(x, "Size") <- n } class(x) <- dissiCl if(is.null(attr(x,"Metric"))) attr(x, "Metric") <- "unspecified" } ## adapt S dissimilarities to Fortran: ## convert upper matrix, read by rows, to lower matrix, read by rows. n <- attr(x, "Size") if(n > nMax) stop(gettextf("have %d observations, but not more than %d are allowed", n, nMax)) dv <- x[lower.to.upper.tri.inds(n)] ## prepare arguments for the Fortran call dv <- c(0, dv) ## <- internally needed {FIXME! memory hog!} storage.mode(dv) <- "double" jp <- 1 mdata <- FALSE ndyst <- 0 } else { ## check input matrix and standardize, if necessary x <- data.matrix(x)# dropping "automatic rownames" compatibly with daisy() if(!(is.numeric(x) || is.logical(x))) stop("x is not a numeric dataframe or matrix.") x2 <- x ; dimnames(x2) <- NULL n <- nrow(x2) if(n > nMax) stop(gettextf("have %d observations, but not more than %d are allowed", n, nMax)) if(stand) x2 <- scale(x2, scale = apply(x2, 2, meanabsdev)) ## put info about metric, size and NAs in arguments for the Fortran call metric <- match.arg(metric) ndyst <- c("euclidean" = 1L, "manhattan" = 2L)[[metric]] jp <- ncol(x2) if((mdata <- any(inax <- is.na(x2)))) { # TRUE if x[] has any NAs jtmd <- integer(jp) jtmd[apply(inax, 2L, any)] <- -1L ## VALue for MISsing DATa valmisdat <- 1.1* max(abs(range(x2, na.rm=TRUE))) x2[inax] <- valmisdat } storage.mode(x2) <- "double" } if((k <- as.integer(k)) < 1 || k >= n) stop("Number of clusters 'k' must be in {1,2, .., n-1}; hence n >= 2") missVari <- missing(variant) variant <- match.arg(variant) # incl. validity check if(!missVari) { if(!missing(pamonce)) stop("Set either 'variant' or 'pamonce', but not both") pamonce <- -1L + ## 0 1 2 3 4 5 6 match(variant, c("original", "o_1", "o_2", "f_3", "f_4", "f_5", "faster")) if(missing(medoids) && variant == "faster") medoids <- "random" } ## else if(!missing(pamonce)) Deprecated("use 'variant' instead") if(randIni <- identical("random", medoids)) medoids <- sample.int(n, k) else if(!is.null(medoids)) { # non-default: check provided medoids ## 'fixme': consider sort(medoids) {and rely on it in ../src/pam.c } if(!is.integer(medoids)) medoids <- as.integer(medoids) if(length(medoids) != k || any(medoids < 1L) || any(medoids > n) || any(duplicated(medoids))) stop(gettextf( "'medoids' must be NULL or vector of %d distinct indices in {1,2, .., n}, n=%d", k, n)) ## use observation numbers 'medoids' as starting medoids for 'swap' only } nisol <- integer(if(cluster.only) 1 else k) if(do.swap) nisol[1] <- 1L pamDo <- function(medoids) { .Call(cl_Pam, k, n, !diss, # == do_diss: compute d[i,j] them from x2[] and allocate in C if(diss) dv else x2, !cluster.only, ## == all_stats == "old" obj[1+ 0] == 0 medoids, do.swap, trace.lev, keep.diss, pamonce, ## only needed if(!diss) [ <=> if(do_diss) ] : if(mdata) rep(valmisdat, jp) else double(1), # valmd if(mdata) jtmd else integer(jp), # jtmd ndyst) # dist_kind } res <- pamDo(medoids) ## Error if have NA's in diss: if(!diss && is.integer(res)) stop("No clustering performed, NAs in the computed dissimilarity matrix.") if(randIni && nstart >= 2) { it <- 0L for(it in 2:nstart) { r <- pamDo(medoids = sample.int(n, k)) if(r$obj[2] < res$obj[2]) { if(trace.lev) cat(sprintf("Found better objective, %g < %g (it=%d)\n", r$obj[2], res$obj[2], it)) res <- r } } } ## else just once xLab <- if(diss) attr(x, "Labels") else dimnames(x)[[1]] r.clu <- res$clu if(length(xLab) > 0) names(r.clu) <- xLab if(cluster.only) return(r.clu) ## Else, usually medID <- res$med if(any(medID <= 0)) stop("error from .C(cl_pam, *): invalid medID's") sildim <- res$silinf[, 4] if(diss) { ## add labels to Fortran output r.med <- if(length(xLab) > 0) { sildim <- xLab[sildim] xLab[medID] } else medID } else { if(keep.diss) { ## adapt Fortran output to S: ## convert lower matrix, read by rows, to upper matrix, read by rows. disv <- res$dys[-1] disv[disv == -1] <- NA disv <- disv[upper.to.lower.tri.inds(n)] class(disv) <- dissiCl attr(disv, "Size") <- nrow(x) attr(disv, "Metric") <- metric attr(disv, "Labels") <- dimnames(x)[[1]] } ## add labels to Fortran output r.med <- x[medID, , drop=FALSE] if(length(xLab) > 0) sildim <- xLab[sildim] } ## add names & dimnames to Fortran output r.obj <- structure(res$obj, .Names = c("build", "swap")) r.isol <- factor(res$isol, levels = 0:2, labels = c("no", "L", "L*")) names(r.isol) <- 1:k r.clusinf <- res$clusinf dimnames(r.clusinf) <- list(NULL, c("size", "max_diss", "av_diss", "diameter", "separation")) ## construct S object r <- list(medoids = r.med, id.med = medID, clustering = r.clu, objective = r.obj, isolation = r.isol, clusinfo = r.clusinf, silinfo = if(k != 1) { silinf <- res$silinf[, -4, drop=FALSE] dimnames(silinf) <- list(sildim, c("cluster", "neighbor", "sil_width")) list(widths = silinf, clus.avg.widths = res$avsil[1:k], avg.width = res$ttsil) }, diss = if(keep.diss) { if(diss) x else disv }, call = match.call()) if(keep.data) { ## have !diss if(mdata) x2[x2 == valmisdat] <- NA r$data <- structure(x2, dimnames = dimnames(x)) } class(r) <- c("pam", "partition") r } ### From Schubert, Dec 2020 --- but MM decides to rather implement pam(*, variant = "faster") if(FALSE) ## FasterPAM : Faster Partitioning Around Medoids fasterpam <- function(x, k, diss = inherits(x, "dist"), metric = c("euclidean", "manhattan"), ## FIXME: add "jaccard" medoids = NULL, stand = FALSE, cluster.only = FALSE, # do.swap = TRUE, ## (not here) keep.diss = !diss && !cluster.only && n < 100, keep.data = !diss && !cluster.only, ## pamonce = FALSE, ## (not here) trace.lev = 0) { if((diss <- as.logical(diss))) { n <- attr(x, "Size") } else { n <- nrow(x) } if (is.null(medoids)) { medoids = sample.int(n, k) } pam(x = x, k = k, diss = diss, metric = metric, medoids = medoids, stand = stand, cluster.only = cluster.only, do.swap = TRUE, keep.diss = keep.diss, keep.data = keep.data, pamonce = 6, trace.lev = trace.lev) } ## non-exported: .print.pam <- function(x, ...) { cat("Medoids:\n"); print(cbind(ID = x$id.med, x$medoids), ...) cat("Clustering vector:\n"); print(x$clustering, ...) cat("Objective function:\n"); print(x$objective, ...) } print.pam <- function(x, ...) { .print.pam(x, ...) cat("\nAvailable components:\n") print(names(x), ...) invisible(x) } summary.pam <- function(object, ...) { class(object) <- "summary.pam" object } print.summary.pam <- function(x, ...) { .print.pam(x, ...) cat("\nNumerical information per cluster:\n"); print(x$clusinfo, ...) cat("\nIsolated clusters:\n L-clusters: ") print(names(x$isolation[x$isolation == "L"]), quote = FALSE, ...) cat(" L*-clusters: ") print(names(x$isolation[x$isolation == "L*"]), quote = FALSE, ...) if(length(x$silinfo) != 0) { cat("\nSilhouette plot information:\n") print(x$silinfo[[1]], ...) cat("Average silhouette width per cluster:\n") print(x$silinfo[[2]], ...) cat("Average silhouette width of total data set:\n") print(x$silinfo[[3]], ...) } if(!is.null(x$diss)) { ## Dissimilarities: cat("\n"); print(summary(x$diss, ...)) } cat("\nAvailable components:\n"); print(names(x), ...) invisible(x) } cluster/R/0aaa.R0000644000176200001440000000174414514447446013104 0ustar liggesusers## Ensure consistent "diss.." class --- make "namespace-private-global ! dissiCl <- c("dissimilarity", "dist") if((Rv <- getRversion()) < "4.0.0") { ## deparse(.) returning *one* string deparse1 <- function(expr, collapse = " ", width.cutoff = 500L, ...) paste(deparse(expr, width.cutoff, ...), collapse=collapse) if(Rv < "3.2.1") { lengths <- function (x, use.names = TRUE) vapply(x, length, 1L, USE.NAMES = use.names) if(Rv < "3.1.0") { anyNA <- function(x) any(is.na(x)) ## if(Rv < "3.0.0") { ## rep_len <- function(x, length.out) rep(x, length.out=length.out) ## ## if(Rv < "2.15") ## ## paste0 <- function(...) paste(..., sep = '') ## } } } # < 3.2.1 }; rm(Rv) ##' Not exported, useful to run checks faster, e.g., on CRAN: doExtras <- function() { interactive() || nzchar(Sys.getenv("R_CLUSTER_CHECK_EXTRA")) || identical("true", unname(Sys.getenv("R_PKG_CHECKING_doExtras"))) } cluster/R/daisy.q0000644000176200001440000001745314726055031013444 0ustar liggesusers daisy <- function(x, metric = c("euclidean", "manhattan", "gower"), stand = FALSE, type = list(), weights = rep.int(1, p), warnBin = warnType, warnAsym = warnType, warnConst = warnType, warnType = TRUE) { ## check type of input matrix if(length(dx <- dim(x)) != 2 || !(is.data.frame(x) || is.numeric(x))) stop("x is not a dataframe or a numeric matrix.") n <- dx[1]# nrow p <- dx[2]# ncol varnms <- dimnames(x)[[2]] pColl <- function(n) paste(n, collapse = ", ") if(length(type)) { if(!is.list(type) || is.null(ntyp <- names(type)) || any(ntyp == "")) stop(gettextf("invalid %s; must be named list", sQuote("type"))) ## check each component to be valid column names or numbers: for(nt in ntyp) { cvec <- type[[nt]] ct <- paste0("type$", nt) if(is.character(cvec)) { if(!is.null(varnms) && !all(cvec %in% varnms)) stop(gettextf("%s has invalid column names", ct)) } else if(is.numeric(cvec)) { if(!all(1 <= cvec & cvec <= p)) stop(gettextf("%s must be in 1:ncol(x)", ct)) } else stop(gettextf("%s must contain column names or numbers", ct)) } tA <- type$asymm tS <- type$symm if(!is.null(tA) || !is.null(tS)) { ## check binary columns: ## tA and tS might be character and integer! d.bin <- cbind(as.data.frame(x[, tA, drop= FALSE]), x[, tS, drop= FALSE]) lenB <- lengths(lapply(d.bin, function(y) levels(as.factor(y)))) if(any(lenB > 2)) stop("at least one binary variable has more than 2 levels.") if(any(lenB < 2)) warning("at least one binary variable has not 2 different levels.") ## Convert factors to integer, such that ("0","1") --> (0,1): if(any(is.f <- vapply(d.bin, is.factor, NA))) d.bin[is.f] <- lapply(d.bin[is.f], function(f) as.integer(as.character(f))) if(!all(vapply(d.bin, FUN.VALUE=NA, function(y) is.logical(y) || all(sort(unique(as.numeric(y[!is.na(y)])))%in% 0:1)))) stop("at least one binary variable has values not in {0,1,NA}") } } ## transform variables and construct 'type' vector if(is.data.frame(x)) { type2 <- vapply(x, data.class, "") x <- data.matrix(x) } else { ## matrix type2 <- rep("numeric", p) names(type2) <- colnames(x) } if(length(type)) { tT <- type$ ordratio tL <- type$ logratio # lg-transformed, staying numeric, -> treated as "I" x[, names(type2[tT])] <- unclass(as.ordered(x[, names(type2[tT])])) x[, names(type2[tL])] <- log10( x[, names(type2[tL])]) type2[tA] <- "A" type2[tS] <- "S" type2[tT] <- "T" # was "O" (till 2000-12-14) accidentally ! } type2[tI <- type2 %in% c("numeric", "integer") ] <- "I" if(warnBin && n > 9 && any(tI) && any(iBin <- apply(x[, tI, drop = FALSE], 2, function(v) length(table(v)) == 2))) warning(gettextf("binary variable(s) %s treated as interval scaled", pColl(which(tI)[iBin]))) type2[type2 == "ordered"] <- "O" type2[type2 == "factor"] <- "N" if(any(ilog <- type2 == "logical")) { if(warnAsym) warning(sprintf(ngettext(sum(ilog), "setting 'logical' variable %s to type 'asymm'", "setting 'logical' variables %s to type 'asymm'"), pColl(which(ilog))), domain = NA) type2[ilog] <- "A" } ## Note: We have 2 status codings: ndyst = (0,1,2) and jdat = (1,2); ## the latter is superfluous in principle ## standardize, if necessary, i.e., *iff* all vars are "I"nterval scaled: all.I <- all(type2 == "I") miss_metric <- missing(metric) metric <- match.arg(metric) if(all.I && metric != "gower") { if(stand) { x <- scale(x, center = TRUE, scale = FALSE) #-> 0-means sx <- colMeans(abs(x), na.rm = TRUE)# can still have NA's if(0 %in% sx) { if(warnConst) warning(gettextf( "%s has constant columns %s; these are standardized to 0", sQuote("x"), pColl(which(sx == 0)))) sx[sx == 0] <- 1 } x <- scale(x, center = FALSE, scale = sx) } jdat <- 2L ndyst <- if(metric == "manhattan") 2L else 1L # == diss_kind } else { ## mixed case or explicit "gower" if(!miss_metric && metric != "gower" && !all.I) warning("with mixed variables, metric \"gower\" is used automatically") ## FIXME: think of a robust alternative scaling to ## Gower's (x - min(x)) / (max(x) - min(x)) colR <- apply(x, 2, range, na.rm = TRUE) colmin <- colR[1,] sx <- colR[2,] - colmin if(any(sx == 0)) sx[sx == 0] <- 1 x <- scale(x, center = colmin, scale = sx) jdat <- 1L ndyst <- 0L ## diss_kind = "mixed | gower" ## weights only used in this "gower" case if(length(weights) == 1) weights <- rep.int(weights, p) else if(length(weights) != p) stop("'weights' must be of length p (or 1)") } ## type2 <- paste(type2, collapse = "") typeCodes <- c('A','S','N','O','I','T') ## 1 2 3 4 5 6 --> passed to Fortran below iType <- match(type2, typeCodes)# integer if(any(ina <- is.na(iType))) stop(gettextf("invalid type %s for column numbers %s", type2[ina], pColl(which(ina)))) if((mdata <- any(inax <- is.na(x)))) { # TRUE if x[] has any NAs (hence p >= 1) jtmd <- integer(p) jtmd[apply(inax, 2L, any)] <- -1L ## VALue for MISsing DATa valmisdat <- 1.1* max(abs(range(x, na.rm=TRUE))) x[inax] <- valmisdat } ## call Fortran routine storage.mode(x) <- "double" disv <- .C(cl_daisy, # -> ../src/daisy.c n, p, x, if(mdata) rep(valmisdat, p) else double(1L), as.double(weights), if(mdata) jtmd else integer(1L), jdat, iType, # vtype ndyst, as.integer(mdata), dis = double(if(n <= 2L) 1L else (n * (n - 1))/2), # at least 1: C has `disv--` NAOK = TRUE # only to allow "+- Inf" )$dis ## adapt Fortran output to S: ## convert lower matrix, read by rows, to upper matrix, read by rows. if(n) { disv[disv == -1] <- NA full <- matrix(0, n, n) full[!lower.tri(full, diag = TRUE)] <- disv disv <- t(full)[lower.tri(full)] ## give warning if some dissimilarities are missimg if(anyNA(disv)) attr(disv, "NA.message") <- "NA-values in the dissimilarity matrix !" } else # n == 0 {pmax(1,.) above} disv <- double(0L) ## construct S object -- "dist" methods are *there* ! class(disv) <- dissiCl # see ./0aaa.R attr(disv, "Labels") <- dimnames(x)[[1]] attr(disv, "Size") <- n attr(disv, "Metric") <- if(!ndyst) "mixed" else metric if(!ndyst) attr(disv, "Types") <- typeCodes[iType] disv } print.dissimilarity <- function(x, diag = NULL, upper = NULL, digits = getOption("digits"), justify = "none", right = TRUE, ...) { cat("Dissimilarities :\n") NextMethod("print")##-> stats:::print.dist(..) cat("\n") if(!is.null(attr(x, "na.message"))) cat("Warning : ", attr(x, "NA.message"), "\n") cat("Metric : ", attr(x, "Metric"), if(!is.null(aT <- attr(x,"Types"))) paste("; Types =", paste(aT, collapse=", ")), "\n") cat("Number of objects : ", attr(x, "Size"), "\n", sep="") invisible(x) } summary.dissimilarity <- function(object, digits = max(3, getOption("digits") - 2), ...) ## 'digits': want a bit higher precision { sx <- summary(as.vector(object), digits = digits, ...) at <- attributes(object) r <- c(list(summ = sx, n = length(object)), at[names(at) != "class"]) class(r) <- "summary.dissimilarity" r } print.summary.dissimilarity <- function(x, ...) { cat(x$n, "dissimilarities, summarized :\n") print(x$summ, ...) cat("Metric : ", x $ Metric, if(!is.null(aT <- x $ Types)) paste("; Types =", paste(aT, collapse=", ")), "\n") cat("Number of objects : ", x $ Size, "\n", sep="") if(!is.null(x $ na.message)) cat("Warning : ", x $ NA.message, "\n") invisible(x) } cluster/PORTING0000644000176200001440000000503107302543047013003 0ustar liggesusers* R/mona.q: Replace if(!is.matrix(x)) stop(message = "x is not a matrix.") by if(!is.matrix(x) && !is.data.frame(x)) stop("x must be a matrix or data frame.") Comment x2 <- paste(x2, collapse = "") and replace storage.mode(x2) <- "character" by storage.mode(x2) <- "integer" * R/plothier.q: Replace `pick <- 2' by `pick <- 3'. (Undo when plclust is available.) -- undone for version 1.3-2 Replace invisible(return(x)) by return(invisible(x)) * R/plotpart.q: Replace invisible(return(x)) by return(invisible(x)) Replace `pick <- 2' by `pick <- 4'. (Undo when clusplots really work.) In code for clusplot.default(), remove cmd() and replace x1 <- cmd(x, k = 2, eig = T, add = T) if(x1$ac < 0) x1 <- cmd(x, k = 2, eig = T) by x1 <- cmdscale(x, k = 2, eig = T) (Unfix when we have the `add' argument to cmdscale().) Replace `rep.int' by `rep'. Replace `text.default' by `text'. * R/zzz.R: Add .First.lib <- function(lib, pkg) { require(mva) library.dynam("cluster", pkg, lib) assign("plclust", .Alias(plot.hclust), pos = "package:cluster") } * src/mona.f: Replace CHARACTER KX(NN,JPP),NZF by INTEGER KX(NN,JPP),NZF Change all '0' to 0. Change all '1' to 1. * R/daisy.q: * src/daisy.f: (BDR) Rewrite to pass integers rather than C character strings to Fortran. ************************************************************************ The directory `man' contains R documentation sources converted via `Sd2Rd -x' from the S documentation sources. (In earlier versions, it was helpful to run `.CONV/FIXME.pl' before converting.) * man/fanny.Rd: Replace the displayed equation by \deqn{\sum_{v=1}^k \frac{\sum_{i=1}^n\sum_{j=1}^n u_{iv}^2 u_{jv}^2 d(i,j)}{ 2 \sum_{j=1}^n u_{jv}^2}}{ SUM_v (SUM_(i,j) u(i,v)^2 u(j,v)^2 d(i,j)) / (2 SUM_j u(j,v)^2)} All examples hand-edited! ************************************************************************ ============== Martin Maechler (many things are in Changelog!) =========== src/clara.f : ~~~~~~~~~~~ *) to lowercase only : tr A-Z a-z < clara.f.~1~ > clara.f.~2~ 1) to lowercase and change initial comments to 'c' (because of Emacs' indentation): tr A-Z a-z < clara.f.~1~ | sed '/^cc/s//c/'> clara.f.~2~ 2) Inside Emacs of clara.f.~2~ C-x C-w (write-file "clara.f.~3~") Repeat about 6 times M-C-q (fortran-indent-subprogram) M-C-e (end-of-fortran-subprogram) M-> (end-of-buffer) C-x C-o (delete-blank-lines) C-x h (mark-whole-buffer) M-x tabify (tabify (point-min) (point-max)) cluster/data/0000755000176200001440000000000014764126505012656 5ustar liggesuserscluster/data/xclara.rda0000644000176200001440000010772411573402372014625 0ustar liggesusers‹,\X”KD@¤”éînölïÛ€](v vØ-6v÷®Š]OEÄP°AP1Ð7³£ßçûÞ{ðýûïÌÜ{Ï9÷ÜQ :F˜u4300hfЬùgsò¯FÍÈ? Éß–ä¯ÉØÞƒ{ìe`ÐÜVÿ[–æÇaPä¿nVb1Â?߈ÿ[ÞšS—¥¹Z²ß>ÉWò±£{ÔÏË|lsÄN¥\óÑ»†/x–q6—2cMKÃ9õà`sX½¿^x\ûÚ½Î#»Â—/ÃMáÂëÛ”ãÜJgžÿpè­%‹w°8¸Ö;yòNþýàû²zùĽÛ9Õ a“FËúÀ­û'ñÎJ½ƒoØ¥Qú£›|á~¸6³š0VÔÞq>w¿bƒ ¬û·wÝ‚Ý2£üaàðÇ{Èï˜ÎwÀýªâi¾p1qu¸ú«Ì=‹r—ﺋ¸ôK;XõäUœß’ ß5CËÇ Ï9¶18|ñÈéHÊŸóÐÄÕˆí_hhµ)Þn’¶µ& å•üi¬´Mµ‡/éãŒdYÿö7S7!b{¯~ž^Wt-.›MWÐ^[G¤­=:aÕ—‹Wº¹À¹ùù¯vG öË&Ëfî<8Ï:¶é|·Úú§]¼Þ–f ªÀå×ÒÙGt–­~W¶iµáïªï÷½ÍƒqDûžÉà=ÿøÉËV×ç7ÅóÆüJNÙû ã\<”ˆÞZÆÎ 牧kCˆÔ´]Hd-|ÜÚÝÿ±–óÚOÒ³ÒL˜AV¡Ÿ q57ƾý¶SgÓ¾®éÙ™Eh©ˆ®´z\Ëùþ!~ÜzÕB´ëý³ÁwúNXغ{´nüÿê¿çkËýït$gÊÑU3`¹MÙ‹Û{,8ý–{ÊOêÚº.ë%½¬s.JÔˆX‹—.§w@ü×/}OJ“ázs]TÇ›îºV]O®ü¸Þæ«í‡<º„´œ;Œ–Ãïq‰{~gSΙ¯bN§ƒžÚÚâÏ~Ü~;ᣑÖœ¶G`ÂænóÇÝ›e—w曾’õ²ˆ:·c7Ü7—-z3ø€¶,¥ 0¤›9Ú?×x´Ÿö™¯xð6çYÛ¾ôéŠoð6=¿%ãÙ„›ë¸¥Mƒö«ÅÐ!kªnÂ.7¯Ý«倻m²Vç²p¿ùõ7ˆ^ó*¤ÛËnðÙg%Ë$ydíÖñc{ Ôø®´J±!gÇ:p¿eÜ`þ-ï#\¼íÙïñ :³ܬW}^#tÔ" ˆ/Xp¸·tÂöÞØü¸×)M­fÃI¡9âÛN«òÞûí|%Uy=þÀ¦Í ×áÏÂñÎÀ[»ê»£Mª$ÌiÜ_NUÌT¯Ió¯éÚî «Í.3‡çþ,²”¹2GüáÏNÃf×}Wö›"Ü)wÒÔî=îþsÅˈ#ðì'k) BÄ̓eeÍÒàõßâIƒúꯚ:á¬êå‘NT ìnAͤ ‰:[[qͧEœŠg}¶\„¿÷Æ ÑÓÖYÿþœóT§A`§J»Æ£h~§8ÐæÁ¿åsWŒEò±¢Ý6BøDÏÖ·§>AÀ»%ÅÆîè8.ùáĶòZ/øi ô i)¶¡nÉ«—ñÚÁÿ®ìë¢ÎSUjÞ0û7:Œö>Þ©3EíÖÏo#àÇ¥#‘„Èú÷]‚e@@³1[ ~ÃëeýNyÁÖ^²ÆðÒ¶\¶ëû"„7¯Ÿ\†h+ç™Cù»à îRšÖpAFú÷ÒþQn>r§¦¥BîüQ×lóÛÙk¾q~÷ayÆ»OÂö5'Ÿ ¢Ý\úœ[_f·o´¹¡}ôÚs¸xÑq„”9,Í==n;ĈOî‚_듳|v-Dľúy1'à8>.btîD—ImVÎjDûÑ!-ÿÌœû´fKòÇôALçöÅ¢ÃñŒùϖŸœ—×gV·§/º^Ó§di¿IúíYÀ÷‚홢ԭ¢:¿™ñxôa¸sÊ:÷¸\0•ØD~k5E«é°ÿrt郎!ðoòøù.‹|òІ×Ù™Ó’z6×E-ÓÖ Ç”Óî× i6¸Í_<»;ë–ξÇñ À_ÁßëöŸýyÚ+.WS6ßýƒpIÿÇsw€ûƒ”’˜ñV:ûÉ3FßxýáâI„_S' ³ÿRà»}æyŸ|X®}Ñfl¾³ËRFïuÝSô­½bt‡Hy?qÕÞ% Xy[ü8 ŽW®F´Z¥³ŒÍ<}í»"Æ'Ó )<7¯³šÓ4ˆßZ*uEЈŒ«3j‡!ñÈNƒ”wäýßΙùÀ5¾¹=wõ9ßä^­-Ö^÷JúPä§ýu÷yyÑ4ëCàCÿ'ˆiV×,&ÑÖŽ—Êm.#²÷} v·á¾.­vUç}Úšü¢9}]káßë3 ¬&ø&Q2î4Ü.]4=ô±C2]ú_Z «P}}EûÓÕÍò¼³fIœm<ñåÅ‚Ìýˆš~kŸw;„åÑ…L†ÿ€{Âyw͵ߗ­¼ßt Ü™Ö?¸ôF‰ç|¶uý†¤¿tÃáí—ùÈׯ7Ú¶»×yFaü¾>˜e}à!YŸ’ú¸½àÓa/)ŒýØoŒ)cc|‚NŽÒ~1ÕlbçR]pV/¿x£$¡oUÂöµ0. aÕû5<Žo½Õ…‡V´Š÷Ý ‹5æä ñÀUÚìÉßó¼ÖÞ¹ÀßµÕt™a"xgªßõ˜~ógË·N ¬n#“”•†ƒÚúá ß•†¬Bûe_®÷±7Ô™œ›ÿ™;è1‚¹á9÷V ×>h0m½òg,¼”ôxGdžCÀª°³:‡/.š›O‡rîö@El'´sükqòG_8ÜÍÜ}F¿³•‘íun††ƒ«gWÃó<…Íà¿ËáL_߉ðÌIi>ü¼ÂÉvÝ*Eø¹OÙTWÓË_çÏLA«C{^yÿì« ‹gçÃ};á­Fñ>žê¬ ÎöýÏoÓ ¸^²¬0³?€ fóÎØ¶i*òþ¨´5}c–å]Bô\² íÞsêO¤¼þôä<çÇVÓ ¯‹uNǶ68}®s^üÍpÜÄRøm3!â!¢MTCö?Ç‹çÓ‘: 1}:å¾éòVUVGÃvÂMäª[¸}$gJßCèЙ'{<ÌrŽp/IÓÙ†È*oZ‡ä6‡½zt~»)ï[¤ŽqAxë…â0$hïÿg»3 ,!+¢BYÇUó&ÄŽ`ó u5oL‘ôX½ƒ?u¼ç²üàrôÓ±f=ƒuNó²“Í"¼íBS’Ââ{Œ›* ÔÅøÔ˶m»œ³OºêŒ‚6INNû )Æ}†ƒ$ÏÂyE4Éw­l[ý8 ÏbNï .ßáûôû–ê’<˜Üx=d£=ìþûÙñ»3ÝòÏW¦ü…±ÃN6CŒÞ8ÜBèêæ¥ûׯB÷½UÃv„êZ; ¨ªqÀ„ülDÛw|嘄æ»Ùç;µ*ˆòMDœ|ÀÞ…k¬¢Ë1Pg¬RUkzþ·˜œ!;{!Üæ”àµE8D¬_4®G?ÄÖŽïh•­sY];áÏd7´ð‡&^IøÕï¡£ßèLÏ]KHË€P ‹Ó˜î‹þ®ðÊÕ~ždZvòA’6Ï(\út%¢_*U¾¹¨³h¬ðäyõ‡¿™>êb&ÿˆìæµá™ýí¬sžü#v!¼³úî—vwÔý“µþá›èÕv>FÌ%ŸWrUl¢@ˆÙ£_;F`ùßs a« $ÞÌ^Ç(Ûë|­OgΨ·œ”³C§unf/]â°Vçgøª£"]gw½ç ñ›»#:Äl[zè48Õn.œ\õ ^}-jþi3üìžMÞÚ(Cü3 ^ŽØ kÓ¡Í¥„WðÜfÓóµ ‚¦”P‚¶1»Ý»¬îQž^]]€°“~;  ÏçY'ÆÌ@@ƒÝ–»upôH‹|Ôø!iÚ·÷ç]:¤” èÊ×ó »ú#潞WÁ¿©Å•´n7×»Ë}›ƒuŸ ÷˜š÷ÓÙ7ìq¢¦Tû[`#yðÂG×â§ä¨:ÖH×¢"y\ õcD†žË_–ˆõúÚL[›€û$1þA² HDØÝ5ûj‚°ùÂìjõßµÁ¤2ØÚߘä|x1Âç,°X·. >£¯ÐG䫬¿¬ÔY8ÄßÌ÷=„Èò)_§mMBtÑùÆØÃ›á?ßœ&L]+ׂß  &¼xhÈRĆUÿ혠3Ù²_á­åˆqz®ìÖz|Lžîþô¢‘ž 3µO^ÙÀ¶¹U|sû¹:ÿgí:zwi®kyãÕºÛ§‘8=¨ªÏª}ûqâ°3¾°·L%@'<¿ÑãÔ‡ø‰fŸß§BçÔhé18‰ó«_§’!‡a•×öq«Š0Ä-58}¶×ð !Ë:î gÄnØ9Ù!?jRx?Á¢¨¾iiJ º([ÝŒàÅ´ÌÄhÆ|äëœÇ)tËßur2öµýŒ¯, ÷c˵×f\GdÏ^ÛZ {ÃñxJG–|69¤3}¾|}ÒòÙð¶kª?*Ü ›´6GF½;„˜ßke; 8:ï…þf$ÂÐv¡Ÿ¿ÀÞ=kƒÔ¤9ÃŽMr‰à’¼ã¶†9ÚßS=WÇýÖV‹÷$ŸJ‰Ø¦_§If8%› "Ä4®<øöÆq¸ÿ¾Ó;ª@ ·)¯z¼ÂA›q³;><òñ¹Ó<¹ÄA˜ã/aˆ¯ÓãV~~1çóÁNmCÙ¬‚Ú—ðÉyÖæÚàðj9:ºš·ZgÿØW¨õù‚àìÝ‹Án[û%KRº"Ì£ËÙ:·GÏ—Žýä‡ð<}Þm—:Bd§ îòóÄ>]`&Q®ùq)€óÕ6”XØì\3¬ë>]‹¸ ûK;ÎÿqZvD¯ž¶ŒÛ^ ûí¶Ñú”Î*ÇmACGmM¿ ¢CS¯#4pÞ¯ß9\´Yû|@á4{mÝ‚Þ81p˜0aïÍ3à +Ù¹&YçvC÷¼£n.xm+—¼üœ Õþ&³g6Á}ÿ½y†ŽÖu= ê>Û\u‹CêmÍ&÷OýTÃ=¿ÒËf~°¿¾A #bçà¼ãº-öw0’ò¹n]tN:7}úàñ×hÁ„Óç QÞ‹çÀ[Úó½ò.Zž ªýqW ïI¦/UÙ¡ Õ©MÔΧ ]çU¼5qAÚ,øÊ.xø»!þÊM* ÁïÇ®â=wáâ´wðÂ< 3 Êþ;ÏÃÞ æÔ;ÕoJÿÀC@vØïÆVà™û"âqû |z£w× $è’»”<ÌΟã±NÞÑü}ðÛeõÂÃÎá&ÖFßM¿®>;ûúvD5 N‘G’ï[x÷òñÅ ¹Úå¯Qøäò¦?¿ïBB ꦢµ4ÏÌ•ðœÓ¼Ý»/jøëéc„¦é:¹ÁK°š$žœ†.<á×=+TKhdÎ.w³MG.ߜùqdq÷ª%ˆfu=|--Sr¸L/¡ ^‘¤j8´E„¯ú·OÖnD—³çFÖ>§ ¤ý¾š,Ã×U:׋;߻徇ÏZî[ ê…„ÿ}>Ÿ3ðLŠõ|\çSCa´®‹ ž‡6!ú<§Ë§ŽzÙ>F[o=OÓþ.²|1di>¼b?S¢¿“«§JûN@ï\@…Ós] ùŠ1ˆ”›Ë­_×µ›-kuûFW8mú ©y„@#ÝëšžÃ#ƒœŠQ[ºœhØí8—qu&ü¢>Ú…Ãr±ª—sñ5x52¾zUNÖOæŒç¾ž §ÌŽ}„žßt­x4-'Àó唥äqìéÞ_pé÷ú]‰‘7â}’relÔ9ö~šñ(½nµsO˜ˆ!´‚é š“Þ—•p©ð˜Ôl‚öýó¹ì?7¹ÜÞK×â£Å…®/ àÕ ç­ðvþÍC“Àqê6ÜÛ´w‹šM­Ô!tŽžèl¶>šÕÿ<¼—å­üëà1á /¢]‹îÛ&Oˆ6é=&’ŽøC¾´#ê¸êýŒöÇap|SÛœu¶öêõ£Öy&BÙ9Žï4p ¡÷jQØ’æÅû´·UÝt[Ǹè,Ó“KºÆŸÕòŸÃ¶T¢UË›¥üÅ $¶QR½™Žê·oÏà#цpMœwüÅ̳ðã‘@°„ý×”C«¾¾€µYØãí Ö[‡h+r\1õä6Äü'ß²ã\&‚~Ï)ƒiì˜ÿê¾N@Äé·›/ 0F’eÏ©£:¼Ñ>ìn",ê~Y[^bšõf§Z:¬SF(íGŽˆÙb÷ç3T­ân!"ñB/[(´ÇÊ/Åì_ŽP5…‹Ñ³»” Ø«N?>kØVÈvmX¿ìˆôi}U°°íˆyk?´ë|ußËG8sÇF}þv%a6$ÊÌ&‚³º!²¾ºà×Kn|; ¾ñ÷åê3ŽÊðø+’Ýöm®í<ÆÏ+|G½R¢Í·s•}Î^B|)ù˜¢íÂêgbÞæ‘3C;ÃéÉ—ÛËÊÞÂú6«7Ñ—G¤?ÞÔÌBz²;X“ƒ¹Eç60ûc´á‘ea„Ø„"¨qòD“—k­×yµ¿ëŸøpço†:÷Ãýâ\&iaU>¢cõ3ÂóvwµmjÅiº?áò÷ñßà}P¯Ûhk¶­üVŒ 3z]”ó½ìT•8é>F9dÌYóŸÎÚ:ÜãØÉpoð|èÙ.Q—º.¾#OBb±óš¾?"–Få»î{ñ`Y¿l„Ý£ËÓv;U/ŽXéD=¯Öj}vk¸•«s³óIîs_[³ge†k’1\S›§Œ}¹TgÔaØÑÞnð+;”¼o~#¼ª^[t?d/KÿQ$ÒjÉpŠçäó>S×IùK:!×n+"º l3Å›A©öåÏùA§RáR­žÎ(Ãþš»Û+­õÉ*y´>ã½ëp®ç¦íqþŽÉðõžd_po:šÍ#«(p~5ö>û!~<¯h^•{.ÐYû‡mõÑa…_’®< DûÐðêú éëçÅ­ÏÒÆ«Ý…Êšƒ´/^ò'f-9 ÿ*ñ…VaµðŸî½ÑpÉöXkx_œUÙ¿v:§¶Ô0ÿg8Â%=O™·‘õSÎ6 âúçºeÍ#ЬKß‘¿6º’<ó"ÖâI!|?ÿÙŸ»}$"¼™þã˜,Uì\ ¿¿ÆÛI‚£QÎÖÑ¢½ˆ*Ù5ùÓXíëNÝ–êŒn6âPZ¨DXÓýŒnä•îHt£<¶ š{#ðºrÿ— ‡tm~dlo4 Aô×Ò™{‚¯Ã%¦aB¿)ƒÓe%p0(ÎYî`Œ„P>U¬uëü-‘t¼=õ:¸ÎuÆAùZ¡NžÓN \Ç}éª3Ù0JíûøAàu„· °”öyû¼MƒoäÔ7ŸÝ˜ø¦§®5WѦt|—Öu­±ãx•óE”¬ÛÁŸÔk7ë§ÂÿGº`bØ=ÛO'(—ßZÔv¯©@xí è,Z7Jû ø‚¶…õ`øß·®½ÎùØv[gGí·y=¯9˜ ³}~÷ñÎ xM3ñìîlø=_VVóËPûåd˜MÛ‚:‡÷ífJ¦5ÁSsùpû³ðpB듳|9,›÷îuÛÖ ·…¶¾pø[Û‘œ·¢aJÇú˽Àú¡ò‹Cºþ܃v&áG¦(ADkÖˆœÚƒ6´šÍÐóá”5ÃÆÓ!’Sí2pôr¸Y—ߞѪ16§>ì:¾ nõz£¶êãÍ`Á“@}ñJ·våuyÒ~\?²?óC+ë;ý…]T®†ììÞGZoåÇ^ËQ=¥dIÛZ¹0Ýãýñ?õR‡y67ùXÜzFíyø¬JÎW?ƒðIG/Œ6'u£Î½$mäE¹r@è›M§¼˜‹È [Ã>Ó-êÊôßvGgÙÉ-ƒn͈< s]!jÆûOg7îüäeá™pX;4`ªIÜæ„xú£¥mX«ª‹ÖÚ/Å}lR ‰C¶ìnÝ.H¬æqRšƒ3¢Ù3ƒ;ÇÀ»ÙØ0ÊÈ©ô ’®”¶™€óˆ–÷ H»t¯¢Ó•«H¶¢p#Òøß Î.NÒJ¦Ü€hAØÎ6±!|Z@…¤ÕONnwÎÜs¹)Ë“/‚—I²”å[ð×ÎÚ2ùö;Ä_GV$„~„æ ª„83hÂìV‘þr‘Cu‡¥H½ó·Ü²èÒ®¿=¦m¿\ÕþÙ}ÕPEÙQ!|—æwfx@ÍôQ Óo·ðaS,„C `:‹Ô1ç­ «u·XîwýŽD±Ãè‹!uç‹FùÃ6f—wŃu0•/”³s‰³ªèC;#1éØq«»?5ö†hÅœ®¯{{]øâðËöHr7ïm¶Xþ{É”ëK 0ù^yç†Ò2M‡[›A6ù„¬¨Ålˆw"z¼G¯SÆ??@ºâ~ßÛÜ/Np ¿µœVí醪¬Á ®î­¥2ßH2ïÑJÌ}«×!Ù3šÖ—H¯±6³^K«¯NW÷u—ñ›~ÏlHoAä³ùÀpE„‡éC‡¬ÏÍq¡KÊ}pËf7˜ù…ȶŇ´ÿždÙSÚn³€ Òá·RbþÙP D ¶¿¶|ñönÀH×/U æ€Ó’|lÜEˆ7 :AVÂÿNxn^;ÂÕ”¶%›0ζÆNžÙË5‹Þ­GÚwMñ‡fõHiÆð´ m†Åå ஬»÷Q Ñ ÛeÚ–Ë!Oe-$»óŠÒž .äÝ•žY\Ír´–üobÿƒSëÈ:¼è8Þü£§k4‰VÀÇÙÏ­G~âZŽž îÂ;^©Ù^àMþJ€DƤ\m¹ñ}}âë(£wiPUÞ챪I©,–ñ*vn%¶3G¤­ƒ$^žx3z¸+Æ©ïF}@ª;)óÈWª:’Ê !m+`Qä-ƈ!ް»UêròzMDÓÞ”ÁéÀ½ø¢'ɨ†ÑI Ò„ŒÿЬçLÙ´ ¢K´œYAôÀÁ`ûÅÝH›ÁâžWXôã€+LwŠêõUð¶änquø•ä8˜ý÷ë ¢)·@ÂÑíèC'—½CrÙ}Uù¼²¾tç%ã˜Î,­`:FÜwO;Y˜CÑçXjÅfD·µ½ç¼¦bŒ9?.îA>‹_Áéï6N‡A¸ô9*‘l}¼oUÂà÷”1ûú˜€{­bè¹É§À™1¹Ÿe-øÜðò?”í²†´:¹Å•´î}Ó%?¬-xÚ/ ˆ‚~MŸY}ˆ¤f{{ˆý3Üu?ˆ*f˜!Ù^Î図ç†"åÈPJ˜ ý­ïßCš$ºÜg¯RÅ]ÿ;5´üf;—š¿xq m€5BôáÛ@î¶²øûx»¶ m Ñ-}='Ÿõm’¦?¬Iáu´M¯à—xyû/$Wôý"¤‘U¿ë1ÜË.KŽýi á„ëý‡ ìý±Ý‰ëý¥@^ž@ÜH ô&çÐmCÒm•Ñ}Õðßñ³–¿žþ§Â^,ŽbƒmÛy{ ÜÆŸx[XÝãy»µx*°E¢†¶Ã )H6!)H51{ éÅ¥‡¶ÍuBZÒÅ÷ቯ î@~ê™^䈫ÿŸú¦=Þ¸ÕŠ‚ˆ}“ò2Ñà׎‚Aàeéû ˆ¨[ÿàÒ¯»žÔ>N?¯ï ¥S“ z£n3zö5ð+H¹¸³™¬Ë˜#×øA²‚é½ñå1 MEnH©¦BrN‰ÞÃ~[C<Ù´‹CÆ\ð÷‘ê2Dç÷[ÛB7g © à•Q8Gê‚¥çüâó6x œüã±'$ÛZ}ô›W˜ ±î÷“HœŽbü•¿ìÍê² dˆÛoÝ2àAøÚ‚Dâ5çzÉÙ£î7Ï@S å&’(ªW–yº=xAìèjun'ÄcÃÇßÿ@J«W©{[@y—ÔQJÃç!ùý–¥W6pÁ»KNÙЕà~gq(~¸5gÊÑÕˆ¿Èx•àÛÏ—‹ÉÏ¢Vã’ý¸´2š¼¼.®çh!^SGNÒªÞ­ú~8„Ûx?õvƒ`ئ· !©c82j!•‡Ú#¾õŽÂ»W`Ô†ûàmœEa¤îÓ÷1À¼‹6LÁ?Ïô^;]ïzðòÑóxpáØÔ¨¡ÅÝ3!ˆ iý7Ôô¼Q-û|~él.œQßïEQ+‘üî3mô ¾ç«sάÙ,)*•@zæw¢¢W?È>¶- lfé#ݦŸ þz>‘ RO~r~žGê}£ Rk’Ó^Öó6ˆR&‘ÁGâ‡û?ÖÆíOj¹óͧcàn F¤Úo«ïC2㇄œ|ðG¯?‹àT%ôHÜÎðª`]*ІîC$o!æãb= ñn×òWÖ•SÀö²ýn¥kIõ:”¼oR§Ùýåó öby/º†éæ|;R½õýE¤,ŸD,„Ã#/ø×A°l;%Œ'±z‘ø³)ï•Y÷Oü]ãNí…È”å3A±QIÏAœßƒ¾(„]nI«£áGâÿØö}†µhM± YtÑc Úëg AÿâfÉ#ÀYAMà`¾=~ ‹G¡Û^MŽá+ˆB®XŒ*¹ Nëq7²ó*íÝ=—d"ˆUŒoH»<4\7’ÙõG…›®#aËû’Z.Ôˆ‰у Qµ­ÙAQGí'FÀU½o ¢!w S€°†ÕaرsÀÍ&»êt‰Æîú¯Ý ÞàÃóÞ̯ ÓAÒ‚.l ‘ñ‚/ä üBúQZ.“jo{Öãõ3H?~ÛÉñ'ø:ë㋎1þŒ¢IôÀ#ɆÞÁØ9û¯Ìà1µS "yŠ=GÒ}$èvë÷-R¡°’[¡Aÿ®W‘ê¬ÞÁ[Ò†8Ãþ »ù” /Ä7.œI*"¸+™ÿ/å„÷ª‡Cðוòj±fÜÏ•H»Ãx,Oß®4CbðÅ‚$ö<°éð oÄï¢éÏáÍF5¾ácƒ'ƒßOÑsÉw>µ‡/ ûXÅô(EýÉ'-§„d8ó­É"©i<øôýSˆ¯“rÔ· ¢Á¬/-Ni>ü椧¯ê¼oì_’wõ}$HŠô|™äI½ÞÁ§äÒ™{H}š¿çÝìÑßc~,îr‘tÑàkgøS±´%÷Šû`²Nõ_ £„ذÖyæP—­)m#ëXp&x$íyO’³~fì½K“–Leæáˆ/ñðw=ô“Ô#ëž´Þ+3õ€N=!âèõ’'¢ ÎÎ=‡ ZJÚ!Áù’ÄÊÕA4–‰ÖHm}‚ ¸„x^Èjð@TÆR·‡E] sÍüìúô’¼˜)AáíEóè/@ðàïnÿ'ˆì˜S´Oa þ‚VÂì‘ÒšÂz¤Ð(ëµ 7™?Jp‚ñdþû½ý»DpXz§Ü7]!:Ñ+ dÑ"³méaà%µr‘·âƒTâ#­Éà;¯_Ãpzº?Ë˲3m#%oÁ3!p4¡\E§h’!²´î b-©}¢$wûÒ?ˆyÖtµôÑ"öÙó· iÅz½ ¢#„U÷J†0mü7ÂüÉ{±ó)޲ÿiAWÝÌ]Bâ{ë3Š-˜NÃÉxi‚rã¢à­Rµ§Ãé)„¿®g8C4¶|S¯ªï­eyÎUŽ+â K`¶n¥¹—R™/DP>qïvqÒ>L¬XyðxÆwÈ&ç¥ï Aô”KˆS ø…,oF ¯ºØUžAbÃ;bëäðG‡C4ÑoÓóñ‡ÿ¡@â9³icÅ$oRÛÁ[—ŸQ£8Y—ö´#IÜ‘hƒ%7!èÉò¼4øæ¡‰«öA$U…\:]ƒ¸™¶4Cš#…#Fl{Üë”ñ/ðº{¦1žÐå4!üdi굿C žz‚#ð[ëý„/2~È_õ÷\›çH aýÑtï½oÂ<Åt3‰Ù¢wÆ#mØo*L n …GfàNe¾sáqæ_]Hwšs \×¶-³t ¼FíŽfàO#ßðþÑ=*ö솈ÇpaZa¿Ajˆ>3_îÆ­>Ë–#ñÆš­•šF`–ôd÷hbçêõhO1‡{ô.w8~[{)Þ›æ<:ñéiÛ#ž+»A¼ŸÚÿZÏù·þ\ ‹ ŸPƒ;ÁÑ“g¬^t"müAêGa„'É¿LçJ~Qb1k É‹›©| îŒÄi…g!vq·ØY‚dã‡Òý)q‹¿äu†40Èùgú çìtÚ0OÆ|oâ*¦oÄ&uÞßÒý›æ–g“ßëù¹nĽÙùÙØÔ@øéñöãú]{‡ÔÊRR –¯&üsq¸oÈò–:›TóÐa»ÐtÚ üò7”x‚×ÿqìÕÕoI>Ó÷‹ h¹«x#ÄïÜVïJDj)óY äTNɃTAX30xÉþ³HÄ#5œÀÿ)ßbÄø&?Ÿñ¥˜ãôäëéñ$|`³¯ïëØ­÷¬œe™´è1쮤OxRqÃb·ì¯+×Õ!5òM»¿ï[@àõgÍ„º·uŸZä» Â¥´½”Eê'/g:€ð•ù;"u;ÛǤçTÞ Bz”Ý ëËHÇò>¶~±y0Êünô5;Þ¬®!ÚwqJ¾¢—>’<ô–¼öô£ˆÙÍüI}NÎgú›è‘5 Cø ;—3Hžeø]etÜ4JoºCúÁgׂý!ŽMé )þñ>æSH*$Û=hRŸ3œ‘ünäÌÐNsbsqÛõ¾HˆfßêÂ~×ü,u AòåOáœA¤`L/!¼qã"’ßR¸Mâd(Ó8Ûñ¦¿@Òã| ‹sþ.*Yœõ2âH÷/ˆöbñªnXûuèðRÀ Þh¦#†5Ýû+`/É+Œ¿‹WÏ ÊI~mL'⑲)–÷* ÆÎ@0ÈG[8¿ØÃ›#ׂßÂÓëJLb‚izèŒô±z¸=™®&ÖäNuͳ’OXÞ“,¹I ‘¡DIí;Ó?¢†2_½t ë‹Ä¤þ;¿ç4>öçÎBnÉæ|äkX¿YÈp2üžÜ‘ÅZø$*ˆƒÛ…ç?!ìî&ºœE{½ï[½oü.çÎlµ^þ¢¸ú!…߯÷UAÜx×Â|>”ìù óþÒFÄÞL÷àöÔ’ ˆô*_ Á7öúâûŸ?xsOœü iÅ´“Q$=aºà6ãU±Úw=¦_»ñÒˆkv€w•¾¦é±ÎŸ¥·; vpçÒ‡ÇBäIÐG—åŒ`¼Š»”ù·ã‚™+xÄê /€ÚRI©YâNòoÿÚ°)ž¤®µdñ•RmD_¼~Ç“¾Ü^át6ߦ‡òÎü«{[Õw£Þ¯wƒ]ã‘ÙàG0Ÿ7‡á&I,ë#Èò™Ë-õ8õa× F±9 A)…7à^èJáo˜/OxÓóÛÙYÄ¥³¾jJv }R©ºÑÞÄyßš<À«e>RIO²Œ~›‘>”†IÒ¯±¹¡ki‰ô®TV¶$qÃælÄÏ+GšvAìJGˆuûL¤×©Üï…¨ÙŒ_Jk˜/AGíÆ"(â˜4\Dmý$oW²¹ ÞœKm<¶5ºCPUÎp×QûÍd$ ®­ügˈ‚l¼ !ŠKsó\Ʊõ—=`|/¥hy¿#uZHzmÍziFóÕÚÈBb˜T´…í37h8 ˜bðÓ˜_KЕùÚa…õcºB¼‰é2\Ñžàëv}!´bu"½ÿ©ïbßäu"C´ùLSY”ßfŒ·H¦3]1vb€PVýÒÉTÆîˆÄ¥lNF\Æxœh1›·U-¦‰âoæT„ÄÈ)æÕûvÞcy+i.Û)²3 H9ÝjXFÚAÊX¡2„#Òüú=¯ 0¯‰Ú“! Ðûd \5üû‰½Ô®ž ëàå÷yPû1˜x¬ÌžOê*Mgª•à|f¸/¥nlpœx„ZJ#ñ6›oƒíLÚà‡tk5oUÅtðŽKS˜bQ$ã±(œÉÞ÷Ã}š]EøªµôÀ!åëûˆFQô½l_%ólŒO#agòÃ)Ù„wufzYÒ|cÿ¨ÝûÁs¨pz¶’Éìûc¥c1@óæ-¾$]E¢ŒœJ%žXÜä~wÈjX•.!¨Bp ò‡¬ÿÅ“™UÙ¿5Ó£EŸæ“s!ÛpoØädpëÏNÀ欤ÿYeËî~!üÁ˜$Äó7[ööåþ9'°9¾¯Þ¯ ÉàxËå1¾€é±Ì$m¾s²m Á+èr÷PÇ›v¢²îß.\LNÛ¨rHÜ}r@Ôƒ¼Ç½êÉj  *aûšSÌ!áQÿÒ@j£Ì‚d³Þ?ˆz/ù.7ß$æWˆ å²Û7¤þÜs‘nRÌ÷ÊOlÁü0‚lî†w—åiIÓE¤•ö¸Ö#Ñ™ù øØüŒ(…¤çy¿»š­¿3)û¿!œÊò‡ô ó-Æ ª©¡„å¾ùašàö·øtæLòýèkA¼v,Mþbz£ ‡ù_Ŭ_"Êd~cþR¦{&Òt4œK^6Gê©Y” B¥Ÿï‚PÎx%ÿêjàCX¼§eü^tçèÊMé¸O!ÁøšÐ‚†KWg pÊ»iñ’iI=›m€èö?qõZ:ÈBø¨ÞÇá3ý¼ ¸.̇UˆÉÿøXÈBäC$f8_BíJH2]Ì»z|ÜÑ sÕödz8âíY7 YZj‹´Ì?ÃmÁú¼ÌÏ)qa>¡´œ/'×¹ö„쿾Œ«‹bæ§—LfxC4ÊL„g³þ×À9bîB$)·»¼Y]†Ô™ ½W}D¼3Ãéb3Ö’*§^N8]qGÖGÎþ×§ïT¥Ø¨Àç‹~nB³NôEÀ#æ?j’ä×5Ê–Á­ÐÑDáÁ/ªsKƒ÷àwnŒ#ñò£å ó ôfç‹O‘=ÙÕð*ˆw3]‰Ë'pñÈSÄܳ#š5Ïõôƒ *T9émDmÿ‰lÉ>^ˆu¿ŸŒä%m6Nˆ&ñuùUŽ#!‹í[à¿yPÞÁq§öèV"ÞáHÁWíÚìMGIÞL=jrl„öϪó§ý€øÙ5R0߀ŸÙ›0pØúˆ´L‡‘¨Ù¼„ì Ó‹%6©`†´elÎDªûÒþ;„t—{ù!µ;ã‡"«¾L?•Êè¸K(xçV‘?«!îÎú)g­%M Ïs=ôsH-"¬˜ŽÊkG–¿´ Ï__u±#ëÏâžw‰Ík'1?©pô;:àž¡Ùó®Ì!ºõOÿÜÌüè\1üv^ïXß0¾œá›Ä7E¢QùLÝ2ùöÛãàZ”"›do½O ‚ƒ?{ü÷iVŒ7óÚQû¶’ë;PÀq?6W$øÅöÕaå9$D¤ÓBЏ1tÌ'Éë™þ}Ö60ó³’ÿÍñ%Æo¼–¿ Ò7Ìo+R0}‡kº€6@ ¼Íp0šéP’[•oJ/®ž2}<íÉöW‡7"ñþ6:É6ï%Oí”ÚP[t;6‡#ÝNÓ?ÁSk¯Oâæ"5¾rû£-MU0½Hô‘¶?B‘V¡ol€gL¾­ù $ezÊOlÁkj/0_¤ŸÛƒ óWõà¹r~>tj:¸/.ßùù¾Ôô!Dáÿt¿ÙLŸÉ]B*#&$ý…>€`+;G<Á´¾ª!;ƒù„“iY™ˆø5wnXYGÆô¢´¾lî;ÿñWÆG’óM¼ž†:ƒ3„õï¤eg[}ô›~æ#i>}ý0õ2Tá»WÿqÙôv$ÏD¦ŸŒ¾:ü¤ãèþPžb~.•‡btнÐx0}OÓšü–Û¤µ9ð0pÊK¨½¥[s¦CFoö=•™¯J¼š,¨ö3ßU†9ö!—¡ôd:·:Üý~ÒÓÐüi €š+/6Ôô‚È‹Ž·ÇCiús÷ÚÈ–1‘½ýÊ'¡.¼#O¼U/¦[e„}k;2B†´I窗OÜÅGÚF ÕÂSÆä ´£m×®Èܱ‡ñ‘™Äò|¦e›†îær(mÐÓõ÷v+ZOX¬"›i‹x¡èúš¦CýêOé·Fm0òúk&-–ì<Ý”9ŸùØ3P"å6g œÃü¯Êe톀¢¾c‚æøkdcñ”)c}X囚_§ÏB¹¼Š PfeІ0:üÒω"mÓ©X½“™hŽWŸõ×@jh…|û×i„C3”åÌÉöŽß¯CeÅðFtèu^šy,Ÿ(E»÷}»ÍËëTЀúú¾>&ñåPË™\ÙHm.¡|ÎúªP¦W«"-\cÛªÌϤ.¤¶'¤ŽcxM~”ñiõ[ 4PÍãí½ÏGzóÏ)z0¾¥Íúmê9zÿ,TÃ Ìøõé3Ùüfã Š'LŸVZ%ÐFäÜõÙÙ7 Œ¦´¹3”Eí Ú^B¦=ã}ÊqQoºí‡òl¯ɋ iÌô3UkòmÆ¥@meþõÁ,’'Öë}íPÿ¢rƒª@ÖŸI7¤6ochz±¹Ú¬¤‡ú@þÀbÖ–Éÿ¡ÃîÛÛ/A¹»ÖdþñSÐä^¢†#dþ¤pd"ä_Έó°óù3ñdYï¿&¿ßD'+Ù}š(Û¦V&ã ô¥Â$:”±<”þ¤+ôHÛÇê ª#,Ø eÓ_4)Ì¥Q-£‘ŽŒ´-åù<¦ÿ*sþVŸÑ"(d 7KŸ6¡,„úÓë5[îÔ’xª;C ~%2ÿ’ú•‹åå±¼¢ òXü‹³òéL¿ Òv #?/!E Õëš?‚¦ŽÚ œÈóoU› ©q1Œ·¤ÿÇòL†ûÜòì1¥Pèí yȘ{t̪ @ò>¬¿¨ÚÇ~OoWyú^(O2¦1au-cį+S-‘aââÿddW¨3Ùþ(Ò˜RYÎú{™EoöÝxy ª zß)2¾Ð¯ŸõÑWÞ‘x‰}¶tý^¨RØ|¶lù®„;ó} åбSd´dy]Aåã8Èn±þ„*n îÈ ˜vϤi.)ùBË?PÝgþCM냩m›ïÑòátô>²–éç?¡.bßC=ˆÍ(?±>¶êms»A6’¦éDÈ ö_™#þEë§ÈÝŸ’D7 ª¥kh#êtý`:dŒ'©sŸ†:m8 MÓ'T6’ö’áüL?6‡¥>ÃòOzãÛÊætŒ(ª1´Q€ŒÙ—¨a Š’]@ƒz»'BÁ>G®d~QÕ:Æ U÷§’iÍ\J£úC©fýCM)ãDz7L¿ÕLa}@Íuš~m _VH uo*÷÷‡êæU±‰ü6ÔA¨`Gò'mW’ü¹•õ5Ù„>ç‡*žÍqª¯Q»ò1¬_¤:°Þ¤uÕxȯ²ù õ*¦¿hLôþq(¦ÖLê×ÖSüÓ T½z?‘ ¼u+ÆS3WÒÆ$Òg‘×´~e'–ÎÌ·£,Ž­Ÿ— Åc~o|Ãã[}H^Ó1™Æƒõ+¤¯<^~™c™ßM>ïNkÕî5}$å«”Ä_Ó‰ä |ªBú¦Ûh:Ü­Ûù«éyú¹|’¿úþˆìæ •–õ·Òê™þ©ªŸ+DæIþŸ®‹ï@î;(ñxR=9?äØ_,€Ò™ÅÊê#\…¼/ãqê…ÌÇ®rbBÆ ?ùºAUV¼ÉãÒÁü.Ê y Ü—k á²{ 2~²óªuÝ.§f d/X=é˜Ëü‰Y¿/Rþb¸N^³‰n,TW§F ¹XNλ·BÕ¾µÍùñ½I½¥×+ç?£ãxVP|cúòÃáÊ_Ñw¥UJR_¿Pí^úeQ ÙÏž*¾väd…­¢‚%”3Y¿OÒìBF=4c˜oZ½‹é …])‚ºC"%BP=üF¾ÈÈÌÿ¦Ôè硎¥òŨ*˜þ”iJÒšp>T;Riƒê=Œª†±ûlÔ>séPX1}NÞº9¸¡ =F'±¡|DÇ"¡3ß–¦¬ŒNС³Ó§”ǦP≬LÖä>{àãLâ‹á,UÆD:Ð ¥ ]þ dð™_B6ùud¯¶m´é´ª¡lß•YœKîéïÕ!ëÅæVÔÌ/©œÄp‡zÞmî›PGÒ×ëŠôZ†Ç$£h˜EB^NÛ fäçúyFd,,þÐìËO¨bf†všýªEÌß/ÝJ¯÷é Uã¿s¿Ø¶(|ü ¨Ç2ºóÕ«bHµ3håSæ÷U¬g8_yžùÞåKXÿT6‹éŠŠ¹ì<*-XK%e8DÕŠõõ2"Ø}Z [æÇÑX|Ž*ß” åGB/ Î@yœõ{3R)ý&ù£»ïA-añ­Íú¿Ò×Ãï*c¨R©•…Ç烻^­€b˜ŠzÂO_0½+­‘ÝâØÏüZY6';Ëâ_1›Í³©ç2œ¯æ0 .fýuÄ?râ¡òfü;ãy4Ef_Æ%»XžÊ°šÞëGm;¨§0Ÿ•ê9•o„PW1}UšÍæ*;¨-{ *æS»RxÞi×é¶( O!QÁ'ù絯"kxТüó•'¶'ÀO‰ ¦ËÉß.|-ø(Ô]¨ýs<áäôº å½QïõÛDâ–íWV…Cu‡% H}JkÿŠßàij[l…ÌÙÔþ `rø–3'Í©f~«Ì *kº=‡ùÛ˜oF:!f|ëE+ Ù&!…ƒÔýǬÿ ÎbøOqŽ}žÒžÊ h~§Æ¨¶³¾»¦ÃÍ«.Ì…"–ÍÑ)7ÕQÃ9R9Q£ 25¯ÜþÊQéÅ`Èü¤ŸG„ÊùP4.‡Ô;øùϰ}Îþ/Ÿ=Iëv£wÔ[(€Ê…Ýc¤Y«¿jÑ5@P ú¼Ò·ŒÏªV1ü¦q­¤ ÈÏÐëÂ!Ãü¾CÖg”«ÿ}ÎGuÀ0ÉwÑKH¢Ûͪ¿g ¯q0MÕ RSzÍEd~ÐÏÁ"SûïçÌ׬2fºÒˆééêÓì~õ¬‡Çò¡|ÈîoQ¤6ý~H[@Ç{u‘ÜÛÛ¿;á5l~B¹8¡ÿÕ\ÈVe s Š86$YÅ|ê¤í´± Y-ë «»3]<³Ã¿sÑ‘á:…í¿óÐ:T°Ø6Ô L§ÒtZД÷ šLæ Vf}mU Ó2ÿùªÓO1|¡¨e|´CÓÑ3W/¦Ä”ä †+ÔQ Â+R'1^YÀöUñÖ‰6´‘Êø¹òp- ’WYþÈ*d}ja]¥æû­‡ÈŠ+Œ_×Cá­¿ß2mÙžBáw4ÞLOȘ÷ž>j…Q®Põa~Tcæ'Qg­. JÚEÃHÓ.™¤6á\’g™ßJ½ïNˆi …„àj†#Õ}éøÊæP¥} HÏbú˜âÃÁê^LOÑŒ`÷ý(·Ò62É+%„~DW#c-ÇÎÆø4R}YܪԬϤt¼MéùuååW\¨Þ-Üf„LÉæ:ÕÅåq3;¥‘<Íæ†¥nT6±ƒÂœÝw•YÍî‡ÓAùvÖ‘ÍÒßã†ÌÚõª5ó¹*]˜^­ÌÖßëŶÿ-Øý+©Ç™þ¯ú5œ&'ÈoôÌÊÿpÊSE]Çö‚4ˆù$ÔOºõžÕ nT`ƒfñóœÌ‹!PìÓϯAYE¢Öã44Kéu„‘Pš±ú.ËbzI&‡éÁÊB^;#Y§MÔ’ ÕNϱ%³‘Õ—ÕKM3vÔlÎ=ëM«¨›þS/M½Žôþ¿v Ü ¥’ñXµÑÂIìþC™%û~j%ÓÕ4ÿÕ…ÛíøA[Ç#ËÝg—åÄîÛP'¹Ñ É“ú{5Ù‘¦£<È;é 2&5›ãòš£ý)a…º5«šOuzJž{˜ùU4÷™¯<ãç«!¤âAÉ¡²j<á=´<æ:M¯]A™iETƒ˜nŸqˆõû•³ÚR#áYtYÄç3ƒrϳäá[šMÂxÜ’¦Ç™Î@Æ)ý=;àù;ý¤ãoöМd8OUFމâTÇ™ß"ó#ó™Ë2£3#‡r" ÇЕH½Åæ2¢ònåvß›j]Kûò£]*ߨ7)—àÅ ÿt­6LÏTæ²¹Y&‹sÅ%æÇP‡³¹Õ´]ß~úE9m÷€üˆ…ÙÉ„G|e8!M8ƒ QPmÝ@Ž‘ªc>~uÃ[ý½6že÷íe”0_µ2”Ú ì‘5!N<, 32–‘¬dCâæ‹I‘1•õu”˜J6²ÉýoˆR/z½ Á{6ÔŽ-Cf«ŽFÃÕÊ@ÿîë[BÂæãÔ›Œ'Ù”¾ÁîaPßcx!õý‚ —Ö“úÆüqʇúyi¤e:•Jü˜š!}›CÓ4g>tY •Ó8PÚ.Èç÷²GÌ[ûžBVu-$nèX"Á½>Ý(±€Ê¦ŸfÈ8ª¿O’sÔnIøæ¸!h“|lî0y¢ Éÿ'þñøÝ[}–-û ù«¥ë÷Ü_ M>}|á©úyV¤=³¡ƒpPŽc÷/¥²¼WÑé*3–ýyÔ×–äqæ V:0Ÿ†â»ßRDÛO#šÊô.ÅMiµ«HÞý;ãÒ¤?‘P;2¿‡æ2ëKJ¿wxCTk.{_xFêÜ(RµÃo##ůœÇîÏÒXßœ=7dÔÎ{hƒ ª°_“ý]y7:6Ó *[¦Ï©ªÉÇDl„j•ç¬Ižg¼OµŸÛCøâäëYŸKÕ–õäçÝßE/%xùñòŸ5“ hÎx‘¼’áØŽ»ÈöFí况§YÝÍpïO ÛO¤^`÷«©J˜6½?ãIj†Ï$ïØyPýó7ª­lÞW •€õKÓß3¡þÃ|¼ª6 ȳèØS?ÈWÔ8ÈÊ.t,Õ›à­×$îB9–ñUàù²"Sd\ÿ§oôYân]Gò:¥›g—õb>¥Ì÷¬ßšþ¯ÂúvªkL—ÎÇÓ… ù†ÍûhrY?S½õåÌ•Ñm‘yÕ òÖ}!3…Žóô†¦¢2寣j¡þþdÜd|,MÍú/êlÎK}…°¡n`:FF¯åéE'¦³)ÇÆÿ-·\e^D¯‰Î >£Ûæ‘3¡ú¿«³‹+˾6!D° Á] )ÜS§üVqw7’Ž»»{ˆw÷Ô&îîîJ<„8ß=g3ß¿yžž™t'éPÜ{ΖµÞÚ‹ ÞA¨ÇìßÝAH¤ù‘°C¬öô›!÷4ÓzGšÃ+ÿ’¯ÃàFç]ÞŒyÌàÆKÄ~úlRk'›‹åÁå_ \¥½—Q{J|aç€Q¡f‚ÐF|xüõ\=±%ºqð›”·ƒñ;¶õbÝç1éD)€êšxÛw=Z)éºôjšê“ŽTX8Ÿ‰AÛ£j>7Štú…Å4×ÿï¼L¥=aÊflC¯]l€"ö[4¯5ôd¶¤žÐ°Ó(&ÄCuñúSNãIºï•…¤‹lp¹=’€¾³Ù¹Aþ]ΟÕHfÏuáñ=…fToÔ¢s·Q;Úû)—1{xOŸ}t1F¸ºÚKh®4[s¶ú 0® ½ªÞb=[0ƒàùØÖ³7¾ ÷³ðýÀ!Ç–ýcHU_Ùæ‚ùÙ ÎÄ1¤pþè+jõí4^ì›LôýÑ›‘ŽBÿöùõ3‰O!Œ#ýxý^´§3\s<ÿ˜-è³éþ¨o{Õ÷Ëóé oJŸ“¾Aa« íŽðˆôq*ÙÜn¶= Aµuñû–bß1¼ÿú½ÕP¸†ôž…5©ïÖ%3µø¹Ü ?¡n&éš Ý¨P^¢zPobã`)4”’oTPÖxƒ¸¿úLúõõ¹¼> lj+aØŸ@qƒî-c;&ßÿ ÿ‘~M©§½¸G¾íâ§l½W¼ç>¬´ÜP†ˆ KG?Uwªc´ib¹?a†Ø‘ÿBNº;ãXº‡´ h_ntÊ`JÉÇ\øŒöÐ*wšS _'îö«õêÿ<À>hÐÕjÉ 6î‘.@±(Pø”tHº‰Ä3Ñ©IW¬w«ªÓ_n|(?x;F,QèGƒªVc6Ø•gOvÁˆu]nòÇø[âýIu€î³íˆõΧfî׊÷>é,5çÓ*ØÄÎpð®Þýb-Ðl$žñVÄÏæÚP8ž­kš‹u&ù[ kÙÅóóÁNÉžÛâ÷ß—a“@oÌbƒ)P7á‚ Ð?¥zÄhÛ-LÄ:ŸÎ_açñA!{Ìo]Ò›ªÂ߯}û=Þ’>²Ð\¼>nÝm&é“õrņg-讋իÓzP×$ÿ»`A\!Ò›b=ÉÚ¼–P-Í!ŒQœË z{ñÚìµ_ü\éûW_B{ZÍ]š? k 5ïOW3‹ü–ºþ4'5:’n®°ˆ|®W粋42âÚ6Ò>´9ùÃsîÓûªýÆÊPñÙA:pí?zï Gf 4«|÷õ[Sýd  ÷©@Jú}7†¥S‚±"™ |@߇öA…oöä®8[ õ;Ÿ¸f·5n'?»àM¾æ[ho&$kþ<«[çw´üðçpýVc!z&çJƒwÞMÇ“›ü!âr.{QÁ¢_ê²d¹ @uòÕ8Í*`H¶òzÜôù³÷À©“ Ãñ€ê­j^¤Åô|G-pùTsê~°8`æÓºq(±áû´Üñäc< ‰—I_áWoÏ’=-ÎËÿ¼>h±~¤ûs°üS{â $K¹¾­¶Ø}·r0¤÷f¶Šžèh*~}§è„´Lk×ÄkÄ ¢:Ì/˜úÅÈ<Χ“`©mÞ4r™Ì*ÂkòýÆ$‘Ä}ð«°ží@’Æy]¦ò-YK­2W‚¤ù/Ãw’o­ÔeݾÏZ ã>}ÓÏlf[t•ÿóŽ£Yµ3»œ´…Ôä³ ?M¾W׫7ËžÈU°zÿM… ›”~úaø1V9»qRs?D~ ;ì·ª¦^ñ|ù²ÂíˆGàïü÷ª¤A+HXðßw±#€Ø0ΡyÅ,f„º½T:CF·…ì ¯Õ'ÿ[´ì&sž58úuéûlÚg’Ž<úJÃNÅ+¦``JÇœ{@bâÕú7:ЦÃßöeÁÖ³aèÓH¿®3$@x^«¬…wÀë¦i|ç²HH ¥9zÆZÖ·ƒ¨GôÞç`cÿêã õ‚Ø^–¾†([ÚŸ 'ž¼ô|Yæ°:ÿrhÿ_ÏÀ÷Þ4ÕøÃ—²X»§„ÀœûÕ¼‹ z0ŸO }u~þË?mLžõaÌf ›ø’ é äÙ×ÇI6À³Þ“Aæ¿›£ƒ~ñõšC¾@RSꃂ-åaVs!IBuoòZ÷ŠgGÉ9=ÿh>òX)§ˆ–¼,»Ðq͹í¹Žöv‰6Twž’{îP$tüÄ^tÈç?F¿9íÿNºgú¡ïïwúB;tv²R?×-|a Øm·Ðy¸Ç;—xF5ÞQÙ—Yb°šnr£iòO£Ü~s9µ§¦ÜuiÝüŸÞ¿z]sb#Ÿˆ'½„o$ ôÛ~±3Aê:š_»+ï °J€(}]6À€Øò…¹{Žõƒd7âhűÓ<÷ ×çsEô˜4ÕÿcIß—Øf›ßñÅk îÕ“!kúŠ…ïht<-{va‘"”TÇÅ’ßÁíú©m‘o€GÏ;ý*S‚dãH™KA&Z*Ò«Ò‚céþŸ“{ï‡ÔbòÛyg›÷ú:!ür¨žJ_ÇsÀéŒyÃ3ÎÛ!èz ñ¦ÏáJÇ¢3*°ØwsÆ¢÷ 1ì?†Ñˆ¿[ä‹2R])¶C-ƒu®Cû) _ÖÔôãQ‚ûaèÉíIG2“t2ÉŸÙÇ›þ• #Ÿ×»ƒ§õ1£eàì])·{\ñi´ÏŠŠ?Ä ]B:ý´ª¹wÊIÖfuIoÒ±{öñúôÆ›àpuEÑÆµÀæþ›–&†€5³vžWž‚Pk±íÔ—Ad÷¡÷x³I}çóÔnÏ»wæ¯~Ælié~Ï´cí¥Ò¬ŸÞ œZöÝZô¬x´"gŸ;ÉfüŸý« ¦3Õµžçî5ŸXà.²”¡]Á%³xI·Aèìö½à”{4Äv¤{Üß¶Ãæ]æW AÚ×¹äêNtêwùð¯1´?ñ~#•4I~H>öÔß±“»+ƒà†ØB hq›Ù$†Cêz fü…dâ|Èr‰‡Y§W×ÃGÒíÁ®¶Œ¶ä'ŸVÖKñÛ ­W·]}OÖ¹ß!Må¼&ÓM›söÜ; >àÓiù5%x_ÚÖ<ò6Dì\ÒB™ ‰Åü4}ó´?y±AþüêééB—!àhøx=ùÊ´=˜ö»ÑHç2;«ÌôµlYô½éMp½˜üÇǹ™†ís‘‹ÀýÚö˧-ì!¹ÆÃÃ3Ü^A‡̰–;[7h)ˆa¤ß¥÷(Ü•üjÞ9GF7ÿܪÕÎ8q†1@Ľ¡9ß&âò;ÏSh„w!°±Sëû³ßBÂõÛ v¼¹M’.œ_k ~§}í; Ÿ‰ÞkÖßT½ìÇ-¾£ã)ùåÏW:;™.Cxêÿݶ.)/(»Éï©>Œ;L(Éãúbãéþ†Òív·žCÌlª;­Ú‘"0ØõÄÇ6¿äŸo=SÍ1Z‚ÿ~«‹] á Õ9áMZ$ȇ|ÙwânÛ²1sðÞE¸¹# "Ìz1CDw4¨,u‘—«½ŸvÙŸ€N–×çš®žZmg‹Ž¦û‹N8}²Mä{q0i«9_ýá¹í-ÞG)Ï«:ìÒw¾¯ø½F)ïÇѦˆêèÄ.bíb‰ ͨÿ”-šÞLR~ bÓ\1^Mó«$9å'8ÉH§VŸøyNfÁCfª\Àï=×KÉK¯kWhŽU«-X¤êoú{‰-ø ¹j®*áò$wSi·»ÞBg@Pâ†JÏÌÝP1ý#´òÝ!½ ²§´‡ÉšGß…ëçg,ïß|Þ¿ËÿžøÔ³sNGˆØMúPï¾n¶é•í!líï‚‹·Zÿ­WKÙßk>DÝ?Ð'²¼&Ĥ“Ž¥ºôÆ}¨Õ|toG-XnyÿzOw ÒÚÑž:¼˜ášbe‘é# ú“MØAÄW®‡@ûa·¯uU‡P®§A¿>—zÕM»·Nk¦Ý –ËÝ·mŒr…ø TgGí ÝBlö¬Ô°SƒäÏç'•§\k‰Éo;ŠtöQûI'Y—ü&/±m^»ÝÛ3Øl?¶iÖ¢•yÌþœXù‚g:ï3²øû(?ë_§ûH›{Zõ^'¥=fÚ7U¬þNÀ­·—óÚ®úùâꆌ»vÇ1èŸü<6Ç÷H3ŒíP° Û¯?q¢âìin´šô¼)::c~Þ.q-Ã50}ýDù7ö 3'™-kfãcÔëƒ+!°Ï¹z %ò«³£¿Ú\í±£‰»•t€á{˜¾>¬ö0df;>E__d &3lI=ÎGü÷$p?š cmamˆY•s°}|R¬½Üfnʾ ?àþ½¤3‹!©å½¿']†¿kŸ…Gˆç×!òÊv^õ~½š1ÑŠK Þž³_ÏZM­= âFÑsçVQtãqo±Þ~'­ÿÑ÷!ZK”Ln¡3HïÌÖËŽN|‘XâNJJˆŸ.–±ÇvC½†ÄþÉç'è;Fè\ò¨døžO^^y 7;BtO±Üoýjõ;>jp/¬Ñ+ªCÎíþ–@zÏÄd&_n!'š^E®€ºó<»g_N¤‹ÙÍ„ê÷¿Ö¿0ó#¤5føÕD¥}QÄRÚJŸpÚÍÿøø¢µøó?\!m1Š€_7Ï!i|‰üÅo0ËÔì‹¢øÏVE¯O­À+»FVO…ð]›+GIM 5'yµ2Ò…†ýG|¬ÐûäfCr*Ÿß sí)«^]I€Ø9Äw ™L{¶^÷㊼ A^@çmPâ&ÉÈ{忞þœ‰‘¤ ÛF—„åõ˜1]þ÷Ó0׿N· TM~?¿;äÃKªÒ"ÝdÄ?òÙËiÄã 2ÁarÁŒYï÷·`É–¾_!Ö—Éˤ ;N}lÜLòG¤™U0ãÔ¼4çôÀå Þóªï—õŽë¹å¿Ÿ‘žªÖöOÇÔ“!VB¾êˆpÒ)ÇÖ#}`Œ嫸Ì麩"§D­%®n¸’öûu×ÅlöO¸1®¤/zÏyö ­Éõ\¦u.¶2²)¸µÊ¦¨‰´‡wyOìdÀýÅè× »]ÄêUÜz9Ž“¿Yækþ¶÷´9ñHœ•Äpòï„\á¾yå<îD—Ëû?fÿ—}¤ï<}þÁìã= ÕUü”j†È[g½ ú~3X Y%Ö)QÜ+ )~ÍÜ¢Î~·ªd›=§ÁÛ}û¯ý=ä¿J‰7ëS1xÈ¿Uè×z×ýwÿJ!Ù‹æNñùáÒÜ«ò¾ªr=%9'ÆôøYîÛ÷ÝÐi%Ïg@³ÍôþGãØä_n“Ž86±3É|Öìž;`„”= éZ2¢»0Ùa$ê¹nFþ·Í¶¶…AÐmšk†[WZ4:Ò›2™Y°øyKÙ“nãF­2î°ä˘<¯DJªx.í*Yp—ümÑ‘‹ rÁ§Ã|« ®çôåe#!¹¸ÅN§#Pó@ç#–»Ê+^u)j·¢ ¸\}˜ý~î" „»âƒy‚¶“^#3®jNý†ø°2;âö$vb2ˆp¨µšôqÇ)OD20œÁ/~îÒ6 ÁE8¹kÌ­®à:üyå™MÑáiÔsw÷M`Ó/¾pq›S;Žü§1=ÉÐh•힯M;G’¿.qÿœY.íkCF“®CþöZÉïˆ_ЩÓþ¿‡e {Kïab†AhA·³`8ˆîKüݤÄßNQ1ùu0„…û2A&Ä;“C¶”xAG&õ~Øy3$Ö%ŸopG¾Ï‘ÿÝ^Ôéš$FþiZŸV⦻ #œ§6€Dnsnz²·Y€üÄH.'}“¬/éæ×ü:iÑt+­"¸ÌƒöþÞ›XìhM°Šý»ïïÓ õä9 }ˆôì² t¯Æ¶£\ÛÀïÄ ¬Þ„'[@½&”ãg3am‰OûBz» 4â>fô´X´<‚6…™\¤PK±'³—-ºÚç8ÎtrÒWEî!°Sçü˜>Ÿav¹0ðž²I¥©Ñ "úPÎBòGÞï¡ÇøÉIfùâ½xŸÏ¡AmFy`Æš”¦«ßŽ]Añ¼#Ð?%îwáUÒ‰h6S½®^ÇÖ¶P°é,[ôƒq[‚bå–æGŽN8ÍÖ,ý!/žÞÝ(ÊÉÒš‘.%· ù ´çFÑþA“J¹Š´_V. œDC0“©ÕÝ—xR»èýPM⹫`èMþ0eͶ¾“,«ƒ2r# F÷OqŒü¦ú)ä‡Ö &.Œ`¢\e%ål‚Ö…ò„•ÓˆS¬u!¾iþDÒÕhRب3蛓~Ì ¢½a^m«Ë‹æBAª“Çx^ø9UéT 'ÞŤCþKÊ×Ó¥ü=m_X׋žígÒUç.#¸á,ùõ û·V('߸á*õ ªK¤OV¬$ßgAWâèS—±†”Û~¾-è ÄÑÊ÷å (Èq&ý¿a2“¸€>©Êñ†êEÃ&º¯4!¤S/-Þ®·@Q—êrƒ=“w¥€p†8 ºqîûë¬êsôïWu¦þ_oF~.ÝD±:nàÂWÒ¯+¼‰S®Cz>ÍÜÏbÃt„¼Lö…‚²€ööº#Ä(H ”I<¡‚b#3ò-ó›Ä”Mò“æ¥<1c û²@w™=¶ Rò§$ü=h^’þ@søIÊrÖþÕƒüp3• 9;VÿPon…•ä—Q»%µ25½ ¯v…žtðºhò‘j¤óP.&ŽƒÇÆP Aמx#ªöâ[Òr+.äÃÐW§½¢vqå”»H÷¤_×@,XÿƒœÊ΂‚4âÚçú’ŸË8žt¡Â9šóe½`v×¥êyšMsHA Ý‹VK¹“êb⽫6SNœ6fœØMűÝù±”éÄûW@ 3~€j7‹-ˆ†KÚKå\g1¯ãÈ[D9IwH?¦J:Xy{âži$äûÊ—ŸZ»Ÿô¡ªþ¤·Ê›«cFg(èGïGÎÊóš°-=h¢Ï±ämcñ¬ÉPp‚•µjÐö£nœJ{[ý\ÊA)ŒdØÎ4’MÛ›6”ƒ°‡ÎÃâ:hŒÄ¾¯HoOõšðüœºEÄ©ºÓþÎЇüCÊ3b×^û¸ø¼U/%_Tnû',@4Ù¤OÌúCç›êùúò“‰c«Up(¶<ü3(eþ´Q½¤¼uÕXvÝØ@^Ž7+üAXÜ©xÅä› îÁ}AÅó Çœú^ÝZfçHãkº/´AyÇo÷AhGõº¢ÌuþùT3Ð'’oE+ž-ß‚Îaý†ßª ôMHÊáÔ;’OW¼‰{@õŒ•sù žÌp¥]A·øbŒp÷9ä>$>†ÂüѪÕÄ×w&ݼV|Šå—/ƒîu•N|Y%tƒðˆôЇˆ×¥)'}¾n?ñý :âgç5$^µj9éÞµ1gØ@´Ó¨®V#»qt“çÜó@›\óÉâï@XМ- >ŸVíFº@ÅH†óìúÊÓ4¬¢çV‘t™©@}+ûxRñ=qê…¤[Sͦ9IÁò9«õ »×òôb£¶V¡l±™[ÙºÏ 4=Éϯ]J\}Õ+Z3ÒÕ©]±‡û~;Pl >Xk £J¼UaåÖ fOßyeG‚ÁH¾NE#â,h³º-OWYáý¶hý#ò…ä÷!ß‘Pfö¹«£ø\°ȶ îЕ³!w%åìsÅw¿d=hý §] ·ºÌ€`,xñ°îYÐM#߇ Iÿ¡ùF<áqØr§h¶c$’v9qØUÖ¤ÛÒêˆÏ™3‰î]UEf¤å-ò³¨G±ñÒзÊO(øE:uõb66ŠáÕ¿Â`ò·€üLZ q·Ô;(ï>ûùUçøAÊ5HØokŠ?´ÿ4„?£à!“¿÷…¬ó”;©´ N²Ñ¸EªRâ&ª—RN£â&ñûBöâ—Ô¿Bý€få‚+*¨oÒR¾Ÿþù4m‰ç§8º&)ñ"S³Þlüò§†0á(gR=­Ì/,Pjɘ,¶A›N€f Õ…ùÏhþ§y@ÏE^Ñ©}3n¬œ#”«›C>%Ãê ˜šBò·hó†lY[ Þ«¿J¯.9õkTån<žòªúÖ} ~©`(ðþ„óÄ™3XšNÚœÝÖ5âA'¾OÙœ»hNÑ|CÙšòPôÑb5û d÷bC8³H‡¬+Ç{ƾä7|Ú-¬y~èR‰G¡~°/‰  £½ˆRIu°:‰Š‚âéßÕ©¿Ro•Üó&Ð÷R¨®RšÌ„°×šògUOª|FÒ3(O±õD}P!}¡ö:=·úV ëj_ÊEÓÈ«ü´‰§ÝEý¡nùï„,â(Êk¬œ$>G”ÿ¨ªi;±Ž=AœÕLn‡uýDš{¨å4*pcsÅ>æòZ9éPÕÉG«üÀÆIi`Ëp÷b=ÂÆMAÑ|£êÁT÷ª†—±)¯UcNºÞü1¬=Ï¿^ò(kÓž_ý˜rÙóNx² Pû3P(†ÐüKw…ž!šþœªP×Ó´¯Éǯ3Ò×]ð‰øûªuYAÊÙ w!ÖÙÓÈGšõŠ|ýÊ ”£™AœÁf¹c㥷![G:WC>é…•c«rK†_SWFÜa Õ±ê‡4Ð4})âgsP!=ж.q ó«Q^•¾:+ãÌAñƒ¸[FuÍ”ÏKBéÜòhŸ-<±l»£!h¥¤»Ö<ëË Rb]M:m2éfµ5hž©êIûNCz® NÐ}¨ž@:UâæçØQÿ¦lE~E„ölŠð*ŸÇÀgfÎ?öˆNò9æ¿%_¶ÒôÊm]÷"Pô¬ò¡|.ÅfëËU½D&܃–Ùû²!ó [c8€&‡çÓ‚Þæ]Ú±TW*÷ÞLµ–êõâíªÃH¿(|£ûÆx…>w!vôŒ¬Ûâsp’æJ)ñE¤Gþ#εzíSóíH׬ž@sGÝ.âÝ ›È®±æAãbœ.þƒP?±3:ƒ~ÍÛT^‹Ø‚42âÊ kd,Ø„$v¼´áéÓÔ æ0;(o/^ïCu§ZGÏ›îù Rœ²‚ôïÂ}´]åxhBÎÔöŠŠï+>w„¾l|¨¡¨ŠK”)ž&ñ¹ûIœé•U©T¯-È÷¢õ¤ù‹b=qÍÔ-©_.x=R|¡öæåuiÎ_°À‘}\=Ä:Æ•H nKú¢‚¿¤cЮà9¥ Äc h”¤êSÎ’ªh¨‰õ ñŠ{Iß¡:Kü4U3ªŸ3½hÿc¸@yÚ¶ÄgÏ}Gù££Ëܸ š-ÄS½äºP†±µ‰ ôÆíc Ö†‚@K¶(ÕPÒW+›Ñ~_=†ž3uªóò‹éüÖ?È„šPPÙ› Àx‘ü­ù-È¿«ÐSÎFa0WÙ‡ižjH"^„® ëöÑ’ú ¤sYxAþ°‚ÝÄÏÒÚßEaÉÆfA5€ôqŒj6t(¶R} ºMŸ¿0¼·ÿFU±^&߸փö“ÚLñš?þ ´›Éß ^CyFú¹ÄÙËóüô>cìÐ_§ÜVÕC>Çåú*þQ?âˆè£×1Á;(²g°à(|Kõ°â;‹Go ùfÔeä0tªÊïXC\1E)ñ´ki m7@,<¼@ó^¬ö$b½°›¸9ŠoÄ“Ð×$}»JAïŸq;ñkôÁÄ+Õ]¢º@ØKu¶þ7å˨¶²qµr—×BytIꤿ/ cx’& ó¤½žf8ßkCþmÊëÍîFï­Þ;ržôùús”Ÿ¤SÅß–0ã¯xßÇP×áo V×\øÅìêÉ QÅ稻ڡøq?ÈZ;¹Ñ´ÄéPÿ:í5„íU¹,-)/À¸”rÌU Ûß³p,‘/ TV OÒô/¨ßÔ{±²ÎM¬÷©P÷¤Ü9mÝSÂ1âã«?oDy™æHê!|n ÚTo)Ëȯ­Ò¹è,Kì›RÎ@î"6–ÊÅCš·)ÐûªoÄ®GsÐà‹BÐneØ’>â=E\ uWú|•»Hï¯>Lº èyÒ}`åbˆØ¿0¿Ê'«ª³`ÂÖk@u’Îã ñõ8» TG‰iÈ .ZfÎäù†ƒ®'åI(cˆkYÐï+ô@7þº’*ß,òÕ*<¾¿=ä¤PÝ`œËÊñÜ ?‰áºFlœþˆ÷å| •]˜„4ϺOF]Aþ"}¯k²9^£@»>ŸÂÛUÏǘÜa ñQ•%¤[Э®ò­w¡|Gcâ ?‰×ªÉ%Ÿºpæ…ÃNK@{„úma Ãhi@3ºŠ«·“8Eú„;,˜ò?Uù[s@6’¿Oy…¸]ŠAX!ªÄ…×®cx±n¼N~°\Ú£BÎÛªûÐX\çȣХWqÈRˆ' ØO~;Õ?Ââàf %î´â+ùtjò9{•ë>³Q[ƒZMý¥ò'tBA2Õw‚Û².³¿ÌÍ\âE©¼È®u =²ªäŠZB}Žöq~„§¸T”˨ý#)?:½¨¶Q£;@¹zyU´ˆ|¶º ÄÑ× y™víß…Ú¤#ÒüaeL2¯)SUõ>(ú‘Ï\aM9ÔÚ½¬Œˆ¡ åÙè§9oñâ´£Är¸ÇhPnañ}!ûc û7ºß³ËIw)Ó9$¤Ó{¡ò!š¶Ý‹º!üÛ!öçÄ»È]=5øýe#h°5ƒ¨jº·—^;y+Æ¿µx~’ß«þªNGv‹÷Ú}â-(Û%3ðjÒã©WUñ‡¬––™¶‹ß‹K‹¼ ¤WTùÒ “É·gxKs:Må#h†GOßg[XCÎBʹúR¯yÏpý Ðu63°úÕÉê%”ûª8[Ã9­"ÔÊ—6\X&ö TjõÔéVÑû™@~ðÜÉ4Ç×¥ÏMÑ8Æù;hþ©s'n’n;;¶ûp8ÜŠ×4ÇÕvaòo7PÓÜOc{qk°—»øž‹×­¿xÎúR^ ®Ç•'µ‰ï¥7q6ur†)(ÞŸôüàZ“±ãç€^Cý¥êÝšS4wÏÚ æ¯61#™Ý”åÝÙ Œ÷~ˆðFP«šoœøÅ@VbŸ@9$ºý¤5FѯSUp‹øuѼBu›ëò ßžxBOâÓè¦Q}l˜Cû\‹ª=Ì{§`ZëÕÏŒâÏsgëÐе#ÿœ²OKÂh@œ`½é§ôŽ”{¡ÜI{$‰òÏ…ïb™µ£T)Ä5З±x= ¨ƒˆ·­ôæüÞë® Š"î¢x_ž >ötÍl˜X¼o‰û¥´<Í ( ˜Oœã¼ĽЦ‘K(¢}²îç|mû#+@u‘ø4†Ub;ÜQì;'²Ø@±oó'ß›æí1õmÄjVJWf›¯9Ù,0t“H¥_¾E¿bݹŽîCE âp*ŽSÿ•Žr‹iNdOó[E4q;õc)WJ-· =]Â|ÊÅÈB{a7õg†=4O6Óç«¸Ž²ƒ®5Ã2«Àð|Kúwâ•{@þT|Á_Šýå<çªø‡FÚ; @¹RùÏÉ_®Î`ë­DÐñ`÷ õˤºbß»›þ×Pòñ µÚ©ãêЉÄõNR}¥[ÎÚÎZ ŠpÜÕk(·Nß›Íf‚v ùöu½ÈŸ®?LûÍ;Ê5H)_)7‹êGã7öbƒª)[Ã4/q‹ô‰Ú’u¥bÝûƒaOÚŠç­xÛÛæ‚^A\ • ÍËt/èýÕd’ÏEß‹êk½3å¬*÷×U²-(Äï#õéÂ8º'ôýÙõÓ 4®ëØ@T‡)×Xšö–ùåäcÖºSž?½ŽøŒ}®«aÝ_z§2ó/?Ç‹ý6é\ ¶§H[—ô]¦~^7~.—x_êÆ”_©iBú©‚«äŒÌÞÞt7> p“Ïu›*ÞAÔˆ> _öÝ_z~µ³IdÈ=Ú¾Ëáçû›îáÜôŸ- £œ'E_eCÊ%Ò[ÿZ¢FãKú_½åäM¥Üí!ÊÖÚÓžDïM{(½[‹÷ÝPâFé’éŸ ñ«+¾¯åôu Aÿ˜ÀT¿XYš®,>Ä N‡VCõ]îÁãÛ–.xÚ);æ¾y²]üù,þZ º+¤›Ò}"Ÿ¬ð–¸ÇBñóJ)·@µ…]G A¥³‹ xL¹™š’*NëWòêU”۪ʧ é{Å M¬Wöq-èÚÒçc°$¿½få¢êI?T°™ötêTŸ(gRZ°†½>ƒÅç­'P€ÁŠt¬Ê#t~¨­ÈOfìË®ÅFbÝËð$RPNf¸ö @:J!‡æ´†é¤72–Ñ{¤™Hü@eø—Š÷åΟÉw¯¶sðµ‰?*žCËŽô;º‰Ôê=œK®î@“¯×ðŠ¸¼ê*.Œá§sAW¸¥šÄåV(iÞ.ü¥º_•Cœbã^óVb•Lû¬¼dškh&Ó¾;+„aÄïÃMâ ç6~ÃBÐþ%þsÞBâåï¾uO¼×¿gbßEß'}(׋çsqÕç›VÈ $Я¤|M;ñ¾t›¹/T¨Î"˜Ì¨™Ø·ÏD{­jNLõ ö0銄ãÄ9T¢ç\ù‡µïù ¬A9,‚ ùV´j¶öïÑrÖŽ‡Î’ö‰†FÔ/æÄ½ÕºÐ}¥šDóѼմ‡U^¤½¿v#ík´C)?@Õ8»º´¯Ì÷$˜¢1åu+oRνPå6úÐ^]¨âùêoМQXÁÆûvgA¹=Š3–¦â6bßЕµ­bßk%cF ÚÓý­ÒÒ|Jw¹ŠÇûwßó}ƒ@Á Úÿë[·@ù“üš;U\‡Lñ»¥ù úQÔ¿ ÄqS¿#½ƒö,åß©ÿRž °ÉnƼƒ A?¡Š[6”ëeAwüzƒ(ËJÐt ùœ^Bùu†»”_­˜NúPeùÿúºGujâN¨ãɤŸ˜/ƒñž¿Ò´zÓN  »›Ôà9K9=º³Ä¿Ñ‚úS}³ªü¿cÔ·ô"?¿²«èA½ž¸6Ê”×£Åù˜ôz=kø°nä¡õ=ú¡4‹Q/À˜ºôcË»•á®á&Læ@‡0Îü‘Xð¾GÙMÓ×ôÛ+¦q½–{1f5ÏÙÁÈý¼ÅðK<çØôÏ0¦x‡á¢ékõlPfú·lZ*žŒÂøU”j×ÿÝÏ¢|ùŸYœ‹)ßsæ6̓ðªóÔx™ÓþÏLÜÈ9âö”çl¡×·E ûÜ)CW]æ–ï?>™~ØÄ7©—ЉƒyN0JJ¹Îã9Æ?CW1LZ¬ü\cG<ÿ\‰>ÿ•>ÆÈõ<7Cs–K?D,x!ÇØQôï±ßÒƒÎ0Xòþ…ªà:ÆOå}-ÆNfqsÁ`_½V·Ö·18/=úîÝ1±pJnò~Öôq×'£¿Ÿï¡¯ggGG=&ï =˜ÇæÅ-æîŠÉ=xŸ…²PÎB©IüTrSÐR8Þh’ÅL´çüs¬ù”çŽa(³eT¬Æ8g^§c-‹ ¿Î&z`Ì¥-â:ãB¹㪳qgWô·XÖ΢õŽóÄ´•<¿=Üy½Š6—ãÃ×Wì->é6~h 7^ßÈ´ÇÈ\%?k_ ^öî˜éóÙÆØ~Oz÷™ßàLjoLõ">œ}w>ŸÂ4ò`Ô]ž3Œé­yŸƒá­¸Ïãã8G"+ ãÁvÓíù‡v‡ÎYˆ²!¼Ž@ßмٳÓ7zÆšîS-Z>qÀ í9ê]¶kÖ@‡•œ¯ˆNñwFÏé;cîð\!ŒîÀýYWt^ûcò|?7Ÿ¡ '¢û¤<×´±¯1ã ÷ûc/{]½±Þw®×@ÿµ¼ß5½|×Ó}¶ö/&µ¥¼[§ÄswÆŸŒÅøâÓL@Ž©¯j¬­ýþ8LÎý<øö”ýæ:iŒNàu¾üxÖ³ -žİß}ú®ÊÞ[§¼Ê ¬ ﵤúíË`Ý’Ó‡Š¯=1ýÒX.­Ó§&zñùºž¥s5þ³gµB‡™|¯±§9¥×øygú–tÍêzÏF^üõž£÷˜“¿Þ.7oü< mÀÖ'Žè¤|Ø~ð˜û( ã{¬}åþ­š6ès9¥Ó­Æ¡Æ¤ÉÿÍ2bÚ*ž¯#û‰ò Boò<\LzÃu.èYÂó.M ²÷ÏŽ:‡ ‹7õ¶Ù1S |~Š~þ~Cµ–0%çA`Ì[aøîCÇÌ5|ŠöÕw,ò\¶#{p=.ÆŒãœ|Œ^ÄõvòcŒ h÷oñúcžÐÜÑÖ´tðˆõÐçÇí-Ìßa°ÍÛ/úÒ9à¯ýÓhã,DßGœ_Þ5æeŠ7ƒéËY®/B‡Äþ‘-jyaÜrî/Ǩ¶\w‡qwxî*†ié½ñ_öío÷aÁñÂ<¿Nõ Qº¼ [Ä¢ï¤3ÝNüþ!E¼î”ÿ˜¿Ôåæ}Œ«Íu?è?b÷¹Êü>¦Ÿ#:zx¸øçÝÍ@;˜Úˆá=±Z¤þ‡G£Þ‚|þ/~ÿ¨/ðQx7¬\ÜcJÚ”/X Vݸ~L¼èûæR°1x§Æ»ò¹†/åŒìÅy٦ʟ%ÅžèÒ£Ã9ûx)ÊNñ\DŒOú~M6Ç“»ùvòå] îÛÃj¦¢Š­kaB ‹IïŠRÝfÌŸG†ûÍ4}Û|1eWƒ](ëÄû=LzÅs®MåËwœ®wz6Æ<ÓïËê”ÍÏMþ˜€!=[1!úe Ýo.‘aòlîsä_|Žn—fz}­ƒ_ó=&FVgñ(®ò·âC¢=™5Γ®X6°ˆý†àpÇíYðõ5Ö‰ë…ÑsíŒ}Š –Àì–òß´—FûŒäI“k?Àˆ<ï CZs½†¹ÞEþóôŸ5Rþ O6ç¥cr"×›^ô_Ú±ÅηúÀ0ÌP·?z5HmæÕj¢©üçAbX&ç4É?­rñðÞ7e3Z²Á’éK‡Òås0¦6ågTÒséŸ/3zü#„4®ÁzÊ=Îl}Š68/ëçsa 9Î÷°éÊ¡u&8|ê"™°Cmyž Fi8{Ÿ:ttö4 âvĺ˜zrÁý{Ig1qHµU=¢v kµÌ5³‡ú¡ÿM®2ýü=îÛàŽÃ12çã C3ªk‚ZoªšüxZ䵺–÷…02 ftô9ð‡i‹“oZaF ŸcLX»ÈÑï¤õÌÈtØ ?¿t} &ž'¾sèI¾?Á˜æ\ÇŒz4»þ>“Ü÷ïé9;£;Þd)8tü2üù¡-Gœp [Ìu]˜lÆóa16‰ç}£k-MOÝ‰Ê Ë½É¯0!†cЪçM¡‡JV4mÖ Lt;‘-Vrô™çÔšþ¾ev†Œ>KçŠ9§eø¼#Ïñœ(¬Ý‚ûQÑÞ¨82ý«~“îÞ~Á+ç~['¡K„òä…­*ôïÎ÷ΦµrIÜtQo›`çWͦç ky%·…w’_°<üáÙ+´Ÿz$Ý^?ý;29Q{tx‘²oBQ8†Zr$:.rJ÷z…þÃoþì7°:Æû³õ¦'f©97 kò=ÚvnïÏ[èÙ—Ï¥PZÖÎx‹ Åœƒ.íø|×tsy7϶Q˜ð-®ÈÛx¥ãÅöü‹xß÷ãz?”ÝåúŒp úUúr‡ÝŽ(z<¼[†æ®Û¾oî>Ú)ù+†g¢ÿùK ˜±k¸®ëªÏasƒX7ÃïwKk^ýø¶¥ 1á&ùÅì׳˜½aqfxQŠŸã?~NÊ_:s¾!†ßæû-ù#µ[ÍñæGÐvg¸bøêkh~ªÏSÝ»+(ëCßÿ˜WÇX­ë÷·¯vãBCŽ•ÃÌ©Üß….»Ì¯t]¶3¨~_ÈðPÖ¨hæ7+Ï„IZ¾/ÄŒ ãª2ó¯Xw{a»ûè7¿üµÎÒµîó{CÄñM†;«¶oM­‹’:âWÙªºüg?GèÛ®&®ã{ôÌÿqvä‚/´†Ï§ÐÌ·«G¸f;V“ó\Eô˜½Ú2¥=Æÿà\”år† ãºGLœÄ÷|è5yê ÁìŒéé)ÙÆ…ýZ`r ¾/ÇèÅœ‹'ÿþ¢ÓêµÖbðižÏ‚Ù 9ïe/™Ì, ¥*®×ÆŒí¤³t´çsVL:ÄõCèÿòë§gÏÐZ~;´ÏSCÚpÞ­éÏâ+ï—üÝ„!ݸ.AþÍÜ:Cù<ÜT¹²²öÄ´aS.6ÂCÑ-lmé ‰qè§ûÑþÖ¹(ô>Ðæ}B€?J£i>ëráV‡ÑG`âžSг˜í,]Nþy¿a6:Œ^Ö?,B2=çË¿•Ö¿QÞe0z½{ß×&³!øtmµeÞ±¾Û÷†:1Ö—ï)1ÖûÏ1éëEfÂøxÞŽbÈ}±MztUœwñ6œ7€énœ³‰Áÿ<Ÿ6©¥OTÅ{ÆLAŸã5‡|>‚‰³¹>FþΆ7õnŽ¡]xð:†'PnoSMÁ„è:hže†Ÿ|÷aÈ:®Ãz!œSŠ¡½¶;ý¶ µz¿ð<ºü˜÷ do:ø¾tpÎ<” àŸ»éß(>7CçD;ÁðÄ+xS?ø|V[&ùSž£%ñ0Àÿ^û²cÏÐfç±cr{š{8Fª6)ÿ}—ê™râdH~0;×ùóõŽŒµîŽ1§øý+ÿzgmZÖùHŒÊâüjô¯kצϬe˜pŠÏÙ1vßˡ׀–S£ôj”ä9=(]Ź'(yÊumâ×ÁyF˜4“ÙW­Á¿ÔãÅéÃè¶}Úïm/^¢çý~W\wK0rÕaa\_…‹¾’²Û÷.žÆ°Î?1UÔÜè\æ§CYon8”׬ ÇàëÖLPŒN­øÍ;ŽdŒ9ÇûGSùOÿãÿ½Ä8zÎÁ+ÿSǧç£C2Ÿÿcü/žóˆ²ÑNGÄ7 ¥³˜==-ç‡'ïÛ‹q”“†~…3»•ô°„P'òa»Ê6ç•¿æÇwìíù‹ü3/‹0ò9{¬b0á2×9bà¼à5£öH0‘cŲäemo¿ï6|,X¯’éÍVÍâE ³MÛÐ÷c®ÉŸÅvåkÀš fcÈß›cý&>ÃÔ+. …pO>'BG3îKDÙG®¿ÅàQܯ€Râba`ÊGCìÕƒ(mÌß;L>Èu¦sî×ìî—ÝDçégO¿œ&—KXi{¿õ\4{ôê€Z1ðÝþÏ¡å¯Ñ’Ü{—bЉÙ7¤è´mtýIýìMŸV2¬Öpôûݱù©üa@ÐûuvN*>ò †\ྌÃâÂäèò›øZ±!œ'oú2"/3âÓ/ñ}æ9½è¿ÏPñmÁqŒ%ž†þä¹…(¹!½v¬µú¯j™14ż‚™]°;†§q=#úOùoä”f‹Ð#Ï0ȯá4´X86ÔóÂ!p²¬-¬X]//u\íƒ!?8'­Î´fAèõâvEG?ŽÙnªcLõnBº®ÆØŸ<‡ í_Þ¾ÕiŽ»âfo̶ÃH³­+?5éñs˜ÀW‹þ“ÄvÞâ+VÛ:¦ÚÈÇrL^Çûù£“Eò}Cva\~þÊ‚¹¦oã†u¬Õ*#n{ë5ÚòœvŒâùǘ0Ìœ ì0å»>Ú ¤³¯tÇ=¤ŽºDujÔJ®wE§9é©YŸß›Êö”ÍØÛã?‹¿*ð)ÖkÉóÀ±ÚKÍÑðM1b'÷—¢ë£¬ÇØÄ­ªÆ9†èsºî³ùN›Ñc Ï•A8ÁOü Ñâ?GÐã;¯g1n6Ï+Ã0_>WÃ+ÎÓïüMÂÀ¯ç~pꯆֿ2bè1¾wÂôd®ßG·÷iÝ/‚òf|ý%~|ßñý¸Nƒ»\ü`—¾ ÝŒßv.">¯ Çï þaÞO´¨@«…±Û#ã1ñ“õ×ûKÿ¾Î[ŽÒXÎwÁÀo,î;#¾{²£é3ÿ¶ö’¿íYËçvl3 èÒ¥¬VÐ^¬Ym]HPƒ ´¿Ò¼—÷2 J®p}Œéæ&sý›[˨_@§!:í usV? Hy…Îÿ°']òc®>~fö ¹Þ Ór9oeY\O…’ä¦bAXŒ²Vó.8õLþ¦Å¡Ñ뻫埘©†71¢ä7ß+™7ýo­Úò8fÖ=:½™ä;:Žõ3'È “Õ™<üßBÀ3ª7ã¶µh){U öUßW™;Ã~Ű¡”Ó#­ê7¥ké _Á‚¶1õ1“ ›¡kë+‡{vÆàµ”$ã:L轿Îú—ÁoÓ¹¦;ÇüEÉÃnÌ(n]}Sê´Õ˜û$‹ó`yåð±zÛä‹XMð¿bíûÑô{:ç›>xFî[öÑûÜg ´ÖqNÛK;M¯÷ {Ú"jJ;qý¦Žã91è¿ß:sÈJGŒýA{˜ÒÔø?9 Ö,SŪ’Ý ¦ÂÄ;üs—¿4fœmÿÐÿ5ÏÁÈ»cÇÏ~°ý®Ú®œ‘vzîÄäU­ÅÂk5¦a²ºÚàHÒÃÙËL_m¹¿%1¼.CÇUŽÒÁ[.` çXÈËŒÄÈ:ÒcÆÜˆéïˆáô„ïÇä}Ë~Þ"Öw<ÞÄ3 ø=Óùé#WKõ‡Û€ãN®cÃø×ö\ ±ÌîT ^°¦p6fná; žÇsãQvÉrX{oÊW¸~S"y.5&Dp †Ì»áðžÛ„ç†aWä [é’õgfÃèªóTvšë 0`Ö#›u1fEÈ›×ÿa„„óèLm ?/X[c¬Ï{Æ ï—Á-ßÖwU\?ô °?2'è%ÆŸãÆ´4ÎÅ}äòÓ‹¢ùÊnrýzÍä¼HL¬ÍÆ‚bŸ¢ã~_ôr幓ò+/4²­¥Ãø'|ŒV!½†ˆëîvÖ¬YžþÆßÄèñÜ÷€±»Â¨£âùÞÝxn/†œæs Ðð\,ôÊ…‰Í­û¢Ì‚|0N8ƒ Ð1öpÆØâ)³Ñý6}ýæưÁ›ÑÜY¶óÝ0ù1÷É™™Y˜›™™Uÿ²ÿªÑ£u÷ö}Äÿc/þe^õ7ÍÄüÿÿû~eQÏþQÿûE¶ì§Œÿ«²ò[ÁÿýÛvkÝç¿óÿþ¦U»Ö}[Gu(½ø£ì¯ÿ†ð™àR¼cluster/data/chorSub.rda0000644000176200001440000000255110417224251014742 0ustar liggesusers‹]–{—SÇÏî¢m©ã.Y¦ÙhßË^J¹dÌήØ-+&íÍZS»è2CÆ$#†©$Ö¦Ò¦-ƒ¡±R£þ°.[#5­m—¢–©×÷û{¿oÏO|~Ï÷œ÷œç9·çœßÍ×Vù9U9ιL—™åR¸2ñ“á\nØ~µw5ßW1³ßXW|pbE;ÁŸàs”‡£×`öGù Õ-‡ýöFØßÀ\ð)ʃSÀ(¯‚-C¡ÝЃa÷2<ì¯ ‚žA_àôØ—ao€]ξ`8åu°a{aOƒÝCWÂþ >†^e`2ê~À7(€Š¡=Ø«`OVû±l§q-¿`_…½¶T€yZ—§@ xEcüŠcƒP÷mjÙ»Lz£r/Xn]¨Ë‚ÝöC7s~`*¸\Ä5kmC­Ù_УÁЫAôl0z-ì…Ü+°Pk;Wkù­?AŸE jÀk(ážÃ> ÛÛÈ6`)Ê[Áõå|J9ØVîX ý¢Æ”òð¡Ö%x:Wc¼åEÚ‹gÀwú~6ì÷<ž°%àz°¼¥¸\ƒNŽÌA»ùàjè]ÚžŸÍÐu€~·íаOꌲox,oãû,Ø¿çY>Ð *À(à4×Í)4Ð×l°„畹zPÏ|:T¡|X{rúˆÎj7øŒ¾´ëÁKhÓ{þ£89ç(/i^۴׫éö Àï£8'ðÎáåÓ^ÐÊñÀ/h¿é÷i­st×Ìçž‚¢8çØgóú~î ìtÝô±Usáz¶jì´^ô·uÃÀåZÞA=xPûÑ-¿C·Ss:ø¬ƒ=Sõ¼è³z•ÎóP'æTžî—iå<èßu¶¹§w§—µ÷¨_R×!ýϨQûI»´º.­?ëºÒ¾u¨mÒn¦ÆÕžÖ®+cc–í—|ã˜5îŽ4¿íºw®ä^ƒBßeï€eÚ¯#ÊýÀ©à#íÏÈ ùnÖ¼îQÿyÌ#åÖ>Ý_Ü‹jp+`ŽÔ¾ð®½{jï×›Àxi2ب±MtñÝÛ«6•à|”‹hÁð(Îoö+Õ¸yV+w¸ÿûÁn¿ ôÅ{bê¢8SeðKòÝÅ÷Ûd'–ó‚îSÛ>ùÛ­óž*ƒ3ŽóE½g¢%¶®M¶A¾ÙæùÄGš¿dL}‰/´—óH‹ŸfSý\üP3Ï~äš(V¾‹ß×Ôç)?è3ˆâ÷ŽwíØK¸?Qün ƒ½ÍÅï<ï¦7Á.~Gë>yÝ¥Þ|wýDñýñ‡ÖŠïÈtØM.¾[9×:;|·g$9.ík¯ÇèŒqožsñ»÷¥Î ý̉âÿ <3µ:s¼×ztŸìSÀCQüö×8xwÍŠsÔ•©=ß°%°ãt›rs™òf öî­Ó!åP1ìÚ(¾¹ÆuZ3¾3Œ»(Šÿ<«ñl×¹à4AßÚõçy3×^k9Bñ9î|Åäù#ÌÇż4®ÿßß´¬ºÆi0ø‹–úKÁ4Ï9®I6š4UO«gJŸ®v¹j›rá,0é™ôM&C“…&‹L›,192‘~AIϤo20š,4Yd²Ød‰I‹æY4Ï¢yͳhžEó,šgÑ<‹æY4Ï¢ùÍ·h¾Eó-šoÑ|‹æ[4ߢùÍ·hE ,Z`Ñ‹X´À¢-°hE ,ZhÑB‹Z´Ð¢…-´h¡E -ZhÑB‹VX cš£ªÌ±SuMu¢ÆÕKe”&Ue ÇTS¢Ê“ã“ªŠÆDUR%ÿã! cluster/data/animals.tab0000644000176200001440000000111410400542206014746 0ustar liggesusers war fly ver end gro hai ant 1 1 1 1 2 1 bee 1 2 1 1 2 2 cat 2 1 2 1 1 2 cpl 1 1 1 1 1 2 chi 2 1 2 2 2 2 cow 2 1 2 1 2 2 duc 2 2 2 1 2 1 eag 2 2 2 2 1 1 ele 2 1 2 2 2 1 fly 1 2 1 1 1 1 fro 1 1 2 2 NA 1 her 1 1 2 1 2 1 lio 2 1 2 NA 2 2 liz 1 1 2 1 1 1 lob 1 1 1 1 NA 1 man 2 1 2 2 2 2 rab 2 1 2 1 2 2 sal 1 1 2 1 NA 1 spi 1 1 1 NA 1 2 wha 2 1 2 2 2 1 cluster/data/ruspini.tab0000644000176200001440000000150410400542206015016 0ustar liggesusers x y 1 4 53 2 5 63 3 10 59 4 9 77 5 13 49 6 13 69 7 12 88 8 15 75 9 18 61 10 19 65 11 22 74 12 27 72 13 28 76 14 24 58 15 27 55 16 28 60 17 30 52 18 31 60 19 32 61 20 36 72 21 28 147 22 32 149 23 35 153 24 33 154 25 38 151 26 41 150 27 38 145 28 38 143 29 32 143 30 34 141 31 44 156 32 44 149 33 44 143 34 46 142 35 47 149 36 49 152 37 50 142 38 53 144 39 52 152 40 55 155 41 54 124 42 60 136 43 63 139 44 86 132 45 85 115 46 85 96 47 78 94 48 74 96 49 97 122 50 98 116 51 98 124 52 99 119 53 99 128 54 101 115 55 108 111 56 110 111 57 108 116 58 111 126 59 115 117 60 117 115 61 70 4 62 77 12 63 83 21 64 61 15 65 69 15 66 78 16 67 66 18 68 58 13 69 64 20 70 69 21 71 66 23 72 61 25 73 76 27 74 72 31 75 64 30 cluster/data/plantTraits.rda0000644000176200001440000000656010432451454015652 0ustar liggesusers‹Õ\{ŒUŸ;÷µ-EÚ‚(P£’@P”"„sa[ZÌ®l·Ý A§÷Îî̽3;÷Îv·EY"HU|A"Q1Ò˜È`ƒ òH°E(ÒŠ¤å‘µP±íR¤(48sç<¾9÷Ìë¾Zor:óó½¿ßùιw“.¾üìÙ—Ï–$I–ä´TRFvþIIÒÜYÎóSW*µ•–¢Õª’”>Þ™ZàŒO8ãæÂå‹6ßzÕ©‡ WÞsºW—Þƒîypùß=ùAô{—:a=zÏ›/Èwí˜}¡¹í¬/2ÃõYG»¼õÂlo=†isËB÷ƒþø3÷sGa.ž_€õ~¥¾¼°€–ºËÐFÏná²yú÷yr×p¼•ò¿F3Ž·ïn¾ÂÏkŽÉ‚ü®Gëûá2W@"rõË[ϳ…©Ñú|alÊ¿¾ ®fz ûuÅ‹u»è é:<†^wÕ¿ûg´û¹É sùþÂ\Ï>Õ3ßË ¥Çê )|ÛÓWXq~®¾ÐÕLù>OòèÅã|¥½'±_0eÏϘïÏoªçÓõ´\Eó­xq¢ŸâzÞˆŸÿÄÏ^=h~I}‡õ:™z¢]ñ»vðó…c½ùBFòìÄyÛçå =Rwó4´ ãêy¯nè/8^B?áÅÝ j}}ú±ë} ãâm]äïXî“oˆëÏô¡?¿è}åßÇqòöS!q„iêǪ¯{õüÃlЋ~Ü&±¾÷·z8îyµžP4í×GåwûãG{½º2œ`||ë} ïÛ­^] ½ØïEž{<þÂ\‰|ê}Dâ>èõ¡¡¡ïœb£\úΣ×MOîùå’ïÍA»ðúþ·Ÿ»ð„›'Цyóæ_ÿããÐÓÿ¹éÑOêŸE;~óÎô™½¯¡§×ß>)7’ýOôÒx¶ŽmùÜ{??©aþÕ-'Z™³¢™õ·Ï»ÿà—ÖßÄë°»î¾ûîë^Ú@ýÞ¹ûçËŸ9Lü¤óøýªŸÄ÷ò3çÞ6œÎï9qìÉ÷äÑã‹^?vÛ<º¯H|T¡Usnû{”=ôˆ?}¾´zõêu›òèùW~÷ý{où"z¦üÀKÛ6ž‚v,Ù^ûÓ1{ù}Eõìî?çùE‹nâã ë3œÝÝ›.8þº«…Þ¸ï¶ô¿§OGûñü›¼\>¸ÙbyxèŒ O•ÖêÝÅåmÏ£o­?pßoy>Ê¿÷·ìüÖß¾‰¶azúä“OzvI½ñðÃïÛð2Ú‡ç÷m9ñ†9×Ñx_»ÿôÁ™ü“hçgFìµó Î'Á/W~Ÿͳ}|nÿOìþ‹öœzíÓWÍyŽè‹²Oå§ßYæÊÅÇÞ‰‰‰¥‡l´—“#ëû½þ@é}½W<´ñp£_þ}…öÝ{êµÛWmn¨Óôy»¿ÿÁ_kÀ÷î…¾þÉôLœöÌîÜ@ô£W°?pq½04´òðýŸûìXÉë#îÕ%|ç‡{²dø2xŽ —Î Ö3Þ4÷ÌÚ}OágÈdñ¼,5ú—‘üñÈ//åcž“Íq:\›sâò$ÒÉûãâk‘•Ä9ùœðÌtxÏù¬@'i‚“<‡þò1e¾.O$–Éô#âÈb»ÄW¢W„· XËaYüì‘ã$þöHþðù˜"ò9ð„þò9 ò¾â#Ájˆ='ˆ…ðÀ¼>¨›ä&ÏÑDÌ…¨v)`; ø`)î+PNWÇUÝùö#ÍÅ’îlê,òr6yYH^Î!/‹È˹äå«äå<ÎJ¶¨+UbDÆ\yÃ*©–ZÂdnX)Ö Ëyû`æ+ÏѰö9ðó›“ÆF_žÓ›rYÀ sãÑñëœèL“ˆÁÏGtç9»YÎï#”'Ï4Gç±}‚¸'øýÓÃÙ釾Á¹”Ô˜/ÈClå=B?e©1^°7\”ÉK°fImC¯÷r¾g M $B.ß½ÈåOkÑIžš’êŸ:í¾cš?1dž‡ÈñòÜ»´i—ã÷ùÊñÆò!À‰W”'™¾Üˆì=|<‚øˆ?)p}0ºó1ÀH¿Û´Þ"ytòÑóYäyáA--HŠ“||K€ Ó³O”l>¨—GFÔ.NbO”?ò%=®Þ(;¹8B¨]J¢FÐ÷r%süA‡| ^>®a¾‡=[¢CS? Ç‰3(‡aµÈNˆÿ>T`ùPéƒ^JJrIlç«Y3o§OíÂR»òÓ,Ö:UŸ£k-Å7%Õ?ÂNås}hÖ\3ý³xi6W1ÏŽb-¬·ÖOƒ°W‡ÔXt¾6s¶Gʹ>`?÷ à¿(O­ö 8÷‚0;Àm[±äPO[‹º;À?N„É…å7Î}'w2ñûfC8üÂL¨þ‡Å…½$¹Šâm7ÖšÙ_Qû(joÆÙSIöh3=0®œhÿ­5ã{3#IÞ[ô¥+÷µV°ÖíÑŠq±&¢Ãúñÿ#Ö¼]ékíÄS3ñ6Ó«:Í4Œ.ûÜÑûZœ{CÔ™ÏÏ󨉣3Žý¤þ¶"´’ä¥ÓCd7i¹¹Ž`-É>Õ‰¯EoPÍ阒ê‘Ý0¼´»o4äø–·0¿‚êêãÁv¢j¶§©Ð§¾ÝÕ34n]Ú:@M¨-úuTØI KÇ®ý–ÕÓ’ŒDrm®iœþÐ ¿š¶ÙÎø[ÓÕ¬…iqæâž£Qx€gUè9`Gt¦٠âPøæ˜Ý¨œÊÀN`~bä%%Ð%:k#òxD~óh[oˆa+Éß‚’è[ÿ@[~ŪyÎN+w™Ó'/`tüoTÁO@­’`­ã÷2`WˆËÿ[ÊÉa5êf_‹ë_’üýªAW@MCebúvàÿg$­eÐ9vÖ‡ÝmDw—°þY/Œ]ÿnåì|Ǩß?âœOQ~†É$Â’`½½ª½;ɹR£®öµ¶öý¨Z&åk÷ˆ²Û¿Úq÷kcºú[nœxƒú|Cߎ[+ÌÖ÷Ûåw+X ³÷ÌJt逭ˆtô7°:Æ=3ejÙ À7qî0B^]Ÿ,^ÝÃîVI÷E’{CÓµŠÁŸƒv`ÍÿŸUT”²Jþ³Š˜=k–4¥Š‰YºQÑ*%uOäK¶5¬k‰îQU­‘Å5êXÌ–'‹u»uÎquDQ •w¨ªaÁÅ®¦¡ëdY«TÕbx‘Yë¸@Þum¤‚ßÓ¦6F^-ƒpç«jYcdVW•áIBTí²BijŽZJô”ŠQT,“ÐŽ;“€v´*UE­BrT‡ä8 OuÞ$b–KšŠUÓˆeUW4ƒ2WJÆ:ƒ9ÕÔ•UÆl…¤)çæa„$)cWª&WÑY–±ö XÕ›‰ž‹ŠjQ„IósшVF¬jר–J ]7QQ‹j¬ŒT'Q3J”°,UgDmÜf„SB\¬Öª&%,…i»Ø)j“%šÎ^E¯ª€`ª{k X±€Ì¨ªè€`ôj Î!t@µQ)_ÃK°cXU¦ÚA$ʴνvq [™¬U‹„X¬iÍÂd +6«Übµ:ÌØ4PŸÅÚˆI½^⢚¦f2Â6•2%Æ •Ê\¢€š^b),o.Q«œCŒÓÄ/u¢6ÁÂ^ªZ l›z½TWG©‚ej N£PÁ´-›TF5@TÀŠÉÐ{©ÓHãÈ~Í® @¨Ã„èSŠ U}ŠÉØú›©îSmŠ>m¶úŒ ó Ï^W¦lýzizûÕÃ[¿ªÀ0-@ØFX¬ ýšÎBè7tVíÅ´F)¡+ ñ(£C°íį̀CÔ¡3Ä;„è,¸Ä25 ¨®±í<`i,o– T[vQ+½CTiµj ¦“Câr[Õ(`•ŠRsgÐXÃzâ QeûÇ!Xí5>bØ+ð ÓÑŠ€`Øq S®mU&³B)Whp+ŠÃÛ C/ÙŒ¨:#¬`³jŒ¨>º¢¦Ž‚µL½^1Yfy[©¯W*\™`½j¥j³^µÒÒXF‡tç fP=dÕXƒ\¥ZE ËUZ‘%Ä%TFT˜¶Uš1 רðò3»¤Ô”3†Në*úÈÿ¾PK.Ycluster/data/votes.repub.tab0000644000176200001440000002156610400542206015613 0ustar liggesusers"1856" "1860" "1864" "1868" "1872" "1876" "1880" "1884" "1888" "1892" "1896" "1900" "1904" "1908" "1912" "1916" "1920" "1924" "1928" "1932" "1936" "1940" "1944" "1948" "1952" "1956" "1960" "1964" "1968" "1972" "1976" "Alabama" NA NA NA 51.44 53.19 40.02 36.98 38.44 32.28 3.95 28.13 34.67 20.65 24.38 8.26 21.97 30.98 27.01 48.49 14.15 12.82 14.34 18.2 19.04 35.02 39.39 41.75 69.5 14 72.4 43.48 "Alaska" NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 50.94 34.1 45.3 58.1 62.91 "Arizona" NA NA NA NA NA NA NA NA NA NA NA NA NA NA 12.74 35.37 55.41 41.26 57.57 30.53 26.93 36.01 40.9 43.82 58.35 60.99 55.52 50.4 54.8 64.7 58.62 "Arkansas" NA NA NA 53.73 52.17 39.88 39.55 40.5 38.07 32.01 25.11 35.04 40.25 37.31 19.73 28.01 38.73 29.28 39.33 12.91 17.86 20.87 29.84 21.02 43.76 45.82 43.06 43.9 30.8 68.9 34.97 "California" 18.77 32.96 58.63 50.24 56.38 50.88 48.92 52.08 49.95 43.76 49.13 54.48 61.9 55.46 0.58 46.26 66.24 57.21 64.7 37.4 31.7 41.35 42.99 47.14 56.39 55.4 50.1 40.9 47.8 55 50.89 "Colorado" NA NA NA NA NA NA 51.28 54.39 55.31 41.13 13.84 42.04 55.27 46.88 21.88 34.75 59.32 57.02 64.72 41.43 37.09 50.92 53.21 46.52 60.27 59.49 54.63 38.7 50.5 62.6 55.89 "Connecticut" 53.18 53.86 51.38 51.54 52.25 48.34 50.52 48.01 48.44 46.8 63.24 56.94 58.13 59.43 35.88 49.8 62.72 61.54 53.63 48.54 40.35 46.3 46.94 49.55 55.7 63.73 46.27 32.2 44.3 58.6 52.64 "Delaware" 2.11 23.71 48.2 40.98 50.99 44.55 47.86 42.75 43.55 48.55 52.94 53.65 54.04 52.09 32.85 50.2 55.71 57.71 65.03 50.55 43.43 45.05 45.27 50.04 51.75 55.09 49 39.1 45.1 59.6 47.27 "Florida" NA NA NA NA 53.52 50.99 45.83 46.82 39.94 NA 24.3 19.03 21.15 21.58 8.25 18.08 30.79 28.06 56.83 25.04 23.85 25.99 29.68 33.63 55.01 57.2 51.51 48.9 40.5 71.9 46.83 "Georgia" NA NA NA 35.72 43.77 27.94 34.33 33.84 28.33 21.8 36.82 28.56 18.32 31.4 4.27 7.07 28.57 18.19 43.37 7.77 12.6 14.84 18.25 18.31 30.34 33.22 37.44 54.1 30.4 75 33.02 "Hawaii" NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA 49.97 21.2 38.7 62.5 48.72 "Idaho" NA NA NA NA NA NA NA NA NA 44.87 21.3 47.14 65.84 54.09 31.02 41.13 66.02 47.12 64.74 38.23 33.19 45.31 48.07 47.26 65.42 61.18 53.78 49.1 56.8 64.2 61.77 "Illinois" 40.25 50.68 54.41 55.69 56.27 50.09 51.11 50.16 49.54 45.7 55.65 52.83 58.77 54.52 22.13 52.56 67.81 58.84 56.93 42.04 39.69 48.54 48.05 49.24 54.84 59.52 49.8 40.5 47.1 59 51.11 "Indiana" 40.03 51.09 53.6 51.39 53 48.27 49.33 48.16 49.05 46.17 50.81 50.6 53.99 48.4 23.11 47.44 55.14 55.25 59.68 42.94 41.89 50.45 52.38 49.58 58.11 59.9 55.03 44 50.3 66.1 53.77 "Iowa" 49.13 54.87 64.23 61.92 64.18 58.58 56.85 52.42 52.36 49.6 55.46 57.99 63.37 55.62 24.3 54.06 70.91 55.06 61.8 39.98 42.7 52.03 51.99 47.58 63.76 59.06 56.71 38.1 53 57.6 50.51 "Kansas" NA NA 78.61 68.89 66.64 63.1 60.4 58.18 55.39 48.4 47.46 52.56 64.81 52.46 20.48 44.09 64.76 61.54 72.02 44.13 45.95 56.86 60.25 53.63 68.77 65.44 60.45 45.9 54.8 67.7 53.91 "Kentucky" 0.26 0.93 30.17 25.45 46.45 37.61 39.8 42.81 44.99 39.74 48.92 48.5 47.11 48.04 25.46 46.52 49.25 48.93 59.33 40.15 39.92 42.3 45.22 41.48 49.84 54.3 53.59 36 43.8 63.4 46.24 "Louisiana" NA NA NA 29.31 55.69 51.57 37.1 42.39 26.48 23.59 21.79 20.96 9.65 11.92 4.83 6.95 30.57 20.23 23.71 7.03 11.16 14.09 19.4 17.45 47.08 53.28 28.59 56.8 23.5 65.3 47 "Maine" 61.37 64.15 60.22 62.42 67.86 56.73 51.45 55.35 57.49 54.06 67.9 61.89 67.1 63 20.48 50.95 68.92 72.03 68.63 55.83 55.49 51.1 52.44 56.74 66.05 70.87 57.05 31.2 43.1 61.5 50.34 "Maryland" 0.32 3.11 55.1 32.8 49.65 43.94 45.37 46.09 47.4 43.48 54.6 51.5 48.83 48.85 23.69 44.78 55.11 45.29 57.06 36.04 37.04 40.83 48.15 49.4 55.36 60.04 46.39 34.5 41.9 61.3 46.87 "Massachusetts" 64.72 62.75 72.22 69.67 69.25 57.74 58.5 48.32 53.38 51.85 69.36 57.67 57.92 58.21 31.89 50.54 68.55 62.26 49.15 46.64 41.76 46.36 47 43.17 54.22 59.33 39.55 23.8 32.9 45.2 41.93 "Michigan" 56.98 57.18 55.89 56.98 62.67 52.45 52.54 47.89 49.73 47.81 53.85 58.1 69.5 61.93 27.63 52.09 72.8 75.37 70.36 44.45 38.76 49.85 49.18 49.23 55.44 55.63 48.84 33.3 41.5 56.2 52.68 "Minnesota" NA 63.42 59.06 60.8 61.55 58.77 62.28 58.8 54.12 45.96 56.62 60.21 73.95 59.11 19.25 46.35 70.78 51.18 57.77 36.29 31.01 47.66 46.86 39.89 55.33 53.68 49.16 36.2 41.5 51.6 44.3 "Mississippi" NA NA NA NA 63.47 31.92 29.94 36.25 26.63 2.64 7.27 9.73 5.46 6.56 2.47 4.91 14.03 7.6 17.9 3.55 2.74 4.19 6.44 2.62 39.56 24.46 24.67 87.1 13.5 78.2 49.21 "Missouri" NA 10.29 70.17 58.9 43.65 41.23 38.65 46.01 45.31 41.97 45.24 45.94 49.92 48.5 29.75 46.94 54.57 49.58 55.58 35.08 38.16 47.5 48.43 41.5 50.71 49.87 49.74 36 44.9 62.2 48.22 "Montana" NA NA NA NA NA NA NA NA NA 42.54 19.72 39.84 54.21 46.98 23.19 37.57 61.13 42.5 58.37 36.07 27.59 40.17 44.93 43.15 59.39 57.13 51.1 41.1 50.6 57.9 53.65 "Nebraska" NA NA NA 64.14 70.12 59.65 62.87 57.33 53.51 43.57 45.98 50.46 61.38 47.6 21.73 41.08 64.68 47.09 63.19 35.29 40.74 57.19 58.58 54.15 69.15 65.51 62.07 47.4 59.8 70.5 60.31 "Nevada" NA NA 59.84 55.39 57.43 52.73 47.6 56.21 57.23 25.84 18.79 37.75 56.66 43.93 15.89 36.4 56.92 41.76 56.54 30.59 27.19 39.92 45.38 47.26 61.45 57.97 48.84 41.4 47.5 63.7 52.27 "New Hampshire" 53.59 56.89 52.56 55.02 53.95 51.84 51.94 51.15 50.35 51.11 68.74 59.34 60.14 59.32 37.43 49.06 59.84 59.83 58.66 50.42 47.98 46.78 47.87 52.41 60.92 66.11 53.42 36.1 52.1 64 55.68 "New Jersey" 28.52 48.13 47.16 49.12 54.22 47 49.02 47.31 47.52 46.24 59.66 55.27 56.68 56.79 20.54 54.35 67.6 62.16 59.77 47.59 39.57 47.93 48.95 50.33 56.81 64.68 49.16 34.4 46.1 61.6 50.99 "New Mexico" NA NA NA NA NA NA NA NA NA NA NA NA NA NA 35.91 46.53 54.68 48.52 59.01 35.76 36.5 43.28 46.44 42.93 55.39 57.81 49.41 41 51.8 61 51.04 "New York" 46.14 53.71 50.46 49.41 53.12 48.07 50.32 48.15 49.2 45.59 57.55 53.1 53.13 53.11 28.68 51.53 64.56 55.76 49.79 41.33 38.97 48.04 47.3 45.99 55.45 61.2 47.27 31.4 44.3 58.5 47.84 "North Carolina" NA NA NA 53.37 57.48 46.36 48.04 46.58 47.14 35.79 46.87 45.47 39.7 45.55 11.94 41.73 43.22 39.72 54.87 29.28 26.6 25.97 33.29 32.68 46.09 49.34 47.89 43.8 39.5 69.5 44.43 "North Dakota" NA NA NA NA NA NA NA NA NA 48.5 55.58 62.11 74.83 60.87 26.67 49.2 77.79 47.68 54.8 28 26.58 55.06 53.84 52.17 70.97 61.72 55.42 42 55.9 62.1 52.93 "Ohio" 48.49 52.33 56.33 53.97 53.24 50.21 51.73 50.99 49.51 47.66 51.86 52.3 59.73 51.03 26.82 44.18 58.47 58.33 64.89 47.04 37.43 47.8 50.18 49.24 56.76 61.11 53.28 37.1 45.2 59.6 49.9 "Oklahoma" NA NA NA NA NA NA NA NA NA NA NA NA NA 43.03 35.69 33.21 50.11 42.82 63.72 26.7 32.69 42.23 44.2 37.25 54.59 55.13 59.02 44.3 47.7 73.7 50.52 "Oregon" NA 34.48 53.9 49.63 58.74 50.91 50.51 50.99 53.82 44.59 50.07 55.25 67.06 56.39 25.3 48.47 60.2 51.01 64.18 36.89 29.64 45.63 46.94 49.78 60.54 55.25 52.62 36.3 49.8 52.4 50.01 "Pennsylvania" 33.95 56.25 51.75 52.2 62.18 50.61 50.84 52.68 52.73 51.45 60.98 60.74 67.99 58.84 22.4 54.25 65.8 65.35 65.24 50.84 40.85 46.34 48.36 50.93 52.74 56.49 48.74 34.5 44 59.1 48.57 "Rhode Island" 57.85 61.22 62.2 66.49 71.94 59.29 62.25 58.07 53.89 50.71 68.33 59.74 60.6 60.76 35.57 51.08 63.97 59.63 49.55 43.31 40.18 43.24 41.26 41.44 50.89 58.31 36.37 19.1 31.8 53 44.24 "South Carolina" NA NA NA 57.93 75.95 50.26 33.97 23.72 17.27 18.99 13.51 7.04 4.63 5.97 1.06 2.43 3.9 2.21 8.54 1.89 1.43 4.37 4.46 3.78 49.28 25.18 48.76 58.9 38.1 70.8 43.54 "South Dakota" NA NA NA NA NA NA NA NA NA 49.48 49.48 56.73 71.09 58.84 NA 49.8 60.74 49.69 60.18 34.4 42.49 57.41 58.33 51.84 69.27 58.39 58.21 44.4 53.3 54.2 50.92 "Tennessee" NA NA NA 68.33 47.57 40.21 44.53 47.83 45.85 37.51 46.23 44.93 43.4 45.95 23.84 42.7 51.28 43.59 53.76 32.46 30.81 32.36 39.22 36.87 49.98 49.21 52.92 44.5 37.8 67.7 43.21 "Texas" NA NA NA NA 40.71 29.96 23.95 28.63 24.73 19.28 30.75 30.83 21.9 22.35 8.77 17.45 23.54 19.78 51.77 11.35 12.31 19.13 16.64 24.6 53.13 55.27 48.52 36.7 39.9 66.2 48.01 "Utah" NA NA NA NA NA NA NA NA NA NA 17.27 50.59 61.45 56.19 37.46 37.82 55.93 49.26 53.58 41.05 29.79 37.59 39.42 45.52 58.93 64.56 54.81 45.3 56.5 67.6 64.94 "Vermont" 78.23 75.79 76.1 78.57 78.26 68.58 69.88 66.54 71.24 68.1 80.1 75.79 77.98 75.12 37.13 62.44 75.87 78.22 66.88 57.66 56.44 54.79 57.06 61.55 71.46 72.18 58.65 33.7 52.8 62.7 56.01 "Virginia" 0.19 1.15 NA NA 50.48 40.62 39.52 48.9 49.47 38.75 45.9 43.81 36.67 38.36 17 32.05 37.85 32.79 53.91 30.09 29.39 31.55 37.39 41.04 56.32 55.37 52.44 46.5 41.4 67.8 50.73 "Washington" NA NA NA NA NA NA NA NA NA 41.45 41.84 53.44 69.95 57.47 21.82 43.89 55.96 52.24 67.06 33.94 29.88 40.58 42.24 42.68 54.33 53.91 50.68 38 45.1 56.9 51.37 "West Virginia" NA NA 68.95 58.84 51.82 42.47 41.03 47.74 49.03 46.94 52.23 54.27 55.26 53.41 21.1 49.38 55.3 49.45 58.43 44.47 39.2 42.9 45.11 42.24 48.08 54.08 47.27 32.1 40.8 63.6 41.95 "Wisconsin" 55.29 56.58 55.88 56.24 54.6 50.9 54.04 50.38 49.77 46.02 59.93 60.04 63.24 54.52 32.68 49.25 70.65 37.06 53.52 31.19 30.26 48.32 50.37 46.28 60.95 61.58 51.77 37.9 47.9 53.4 49.16 "Wyoming" NA NA NA NA NA NA NA NA NA NA NA NA NA NA 34.42 41.86 62.38 52.39 63.68 40.82 37.47 46.89 51.23 47.27 62.71 60.04 55.05 43.4 55.8 69 59.85 cluster/data/flower.R0000644000176200001440000000133010400542206014253 0ustar liggesusersflower <- data.frame(V1 = factor(c(1, 2, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1), labels = 0:1), V2 = factor(c(2, 1, 2, 1, 2, 2, 1, 1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1), labels = 0:1), V3 = factor(c(2, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 2, 1, 2, 1, 1, 1, 2), labels = 0:1), V4 = factor(c(4, 2, 3, 4, 5, 4, 4, 2, 3, 5, 5, 1, 1, 4, 3, 4, 2, 2)), V5 = ordered(c(3, 1, 3, 2, 2, 3, 3, 2, 1, 2, 3, 2, 2, 2, 2, 2, 2, 1)), V6 = ordered(c(15, 3,1,16, 2,12,13, 7, 4,14, 8, 9, 6,11,10,18,17, 5)), V7 = c(25, 150, 150, 125, 20, 50, 40, 100, 25, 100, 45, 90, 20, 80, 40, 200, 150, 25), V8 = c(15, 50, 50, 50, 15, 40, 20, 15, 15, 60, 10, 25, 10, 30, 20, 60, 60, 10) ) cluster/data/agriculture.tab0000644000176200001440000000032610400542206015654 0ustar liggesusers x y B 16.8 2.7 DK 21.3 5.7 D 18.7 3.5 GR 5.9 22.2 E 11.4 10.9 F 17.8 6.0 IRL 10.9 14.0 I 16.6 8.5 L 21.0 3.5 NL 16.4 4.3 P 7.8 17.4 UK 14.0 2.3 cluster/data/pluton.tab0000644000176200001440000000224210400542206014646 0ustar liggesusersPu238 Pu239 Pu240 Pu241 0.126 75.804 21.204 2.18 0.133 75.515 21.408 2.24 0.127 75.175 21.668 2.305 0.156 78.872 18.428 1.906 0.503 73.317 20.223 4.128 0.113 79.116 18.548 1.69 0.129 75.751 21.162 2.26 0.124 75.326 21.557 2.282 1.022 63.287 24.493 6.99 1.412 59.553 25.576 8.027 1.533 58.688 25.719 8.279 1.534 58.758 25.692 8.261 1.437 59.728 25.146 8.377 1.439 59.544 25.126 8.569 1.375 59.877 25.128 8.428 1.153 61.182 25.1 7.802 0.201 78.244 18.488 2.351 0.176 78.166 18.629 2.365 0.239 74.254 21.515 2.901 0.102 79.84 17.872 1.674 1.07 62.455 24.656 7.512 0.851 73.189 18.285 5.597 0.125 75.968 20.794 2.407 0.142 75.957 20.867 2.341 0.352 72.885 21.718 3.618 0.351 72.907 21.721 3.601 0.346 72.919 21.713 3.6 0.217 76.089 20.225 2.556 1.068 70.129 18.573 7.689 1.171 69.273 18.633 8.3 1.213 69.147 18.64 8.363 1.226 68.294 18.869 8.826 1.111 71.076 18.122 7.248 0.183 75.714 20.75 2.488 0.162 76.15 20.345 2.524 0.113 77.845 19.108 2.275 1.309 62.382 22.754 9.311 1.638 60.112 23.32 9.972 1.589 60.519 23.128 9.97 1.411 61.585 23.133 9.339 1.457 61.332 23.239 9.321 0.397 72.291 21.761 3.836 0.328 73.451 21.429 3.419 0.242 74.888 20.939 2.875 1.367 60.507 23.603 9.839 cluster/src/0000755000176200001440000000000014764126505012534 5ustar liggesuserscluster/src/ind_2.h0000644000176200001440000000205210761764276013705 0ustar liggesusers/* inlined, to be included in pam.c and clara.c */ static #ifdef __GNUC__ __inline__ #endif int ind_2(int l, int j) { /* Utility, originally FORTRAN, called "meet"; called from CLARA, PAM & TWINS. * Original code had MEET(), MEET2(), and MEET3() in the 3 source files. * ind_2(l,j) returns the *index* of dys() where diss. d(l,j) is stored: * d(l,j) == dys[ind_2(l,j)] * * MM: changed to work with 0-origin matrices dys[], but l,j are >= 1 */ #ifdef was_orig if(l > j) return (l-2)*(l-1)/2 + j; else if(l == j) return 0;/* and the first element, dys[0] is := 0. permanently! */ else /* l < j */ return (j-2)*(j-1)/2 + l; #else /* from Li Long -- optimizes particularly well on Itanium2 */ /* max_m check by MMächler: max_m is the largest integer m * ----- such that (m-2)*(m-1) < MAX_INT : */ #define max_m 46342 int result = 0; if (l != j) { int m = l>j ? l : j; int n = l>j ? j : l; result = (m <= max_m) ? (m-2)*(m-1)/2 + n : (int) (((double) m-2)*(m-1)/2 + n); } return result; #endif } cluster/src/sildist.c0000644000176200001440000000353013655010241014337 0ustar liggesusers/* Donated by Francois Romain */ #include /* fmax2() */ #include #include "cluster.h" void sildist(double *d, /* distance : in matrix or dist format; i.e., of length n^2 or n*(n-1)/2; see 'ismat' */ int *n, /* number of Subjects (attr(d,'Size')) */ int *clustering,/* clustering vector, values from {1..k} */ int *k, /* number of clusters */ double *diC, /* diC */ int *counts, /* counts[k] := #{cluster k} */ double *si, /* (a_i - b_i) / max(ai,bi) */ int *neighbor, /* neighbor */ int *ismat) /* boolean : is 'd' a matrix (1) or a dist vector (0) */ { int i,j,l, ci; Rboolean computeSi ; /* do we compute si[i] */ double ai, bi ; for(i = 0, l = 0; i < *n; i++) { ci = clustering[i] - 1; counts[ci]++; if(*ismat) l = (*n)*i + i+1; for(j = i+1; j < *n; j++, l++) { int cj = clustering[j]-1; /* TODO: d_ij += dist(x_i, x_j) -- computed "on the fly", * ---- but not stored in a length n(n-1)/2 = O(n^2) * distance object */ diC[(*k)*i + cj] += d[l]; diC[(*k)*j + ci] += d[l]; } } for(i = 0; i < *n; i++) { int ki = (*k)*i; ci = clustering[i] - 1; computeSi = TRUE; for(j=0; j < *k; j++) { if(j == ci) { if(counts[j] == 1) /* only one subject in the cluster */ computeSi = FALSE; else diC[ki + j] /= (counts[j]-1); } else { diC[ki + j] /= counts[j]; } } ai = diC[ki+ci]; /* bi = min_C diC : */ if(ci == 0) { /* cluster #1 */ bi = diC[ki+1]; neighbor[i] = 2; } else { bi = diC[ki]; neighbor[i] = 1; } for(j = 1; j < *k; j++) if(j != ci) { if(bi > diC[ki + j]) { bi = diC[ki + j]; neighbor[i] = j+1; } } si[i] = (computeSi && (bi != ai)) ? (bi - ai) / fmax2(ai, bi) : 0.; } } cluster/src/twins.c0000644000176200001440000003362314724553316014053 0ustar liggesusers/* Produced by * $Id: f2c-clean,v 1.10 2002/03/28 16:37:27 maechler Exp $ * * twins.f -- translated by f2c (version 20031025). */ #include #include #include /* for diagnostics */ #include /* for interrupting */ #include "cluster.h" #include "ind_2.h" // the auxiliary routines static void agnes(int nn, int *kwan, int *ner, double *ban, double dys[], int method, double *alpha, int *merge, int trace_lev); static void splyt(int nn, int *kwan, int *ner, double *ban, double dys[], int stop_at_k, int *merge, int trace_lev); static double min_dis(double dys[], int ka, int kb, int ner[]); /* This program performs agglomerative nesting (AGNES) using the */ /* group average method (_or others_) of Sokal and Michener (1958), */ /* as well as divisive analysis (DIANA) using the method of */ /* Mcnaughton-Smith, Williams, Dale, and Mockett (1964). */ /* Extended by Martin Maechler to allow the (flexible) */ /* Lance-Williams clustering method (with parameters alpha[1:4]) */ void twins(int *nn, // = maximal number of objects int *jpp,// = maximal number of variables used in the analysis double *x, double *dys, double *dys2,// dys2(.) can have length 1, if(!keep.diss) int *jdyss, /* jdyss (in/out): initially, jdyss mod 10 = 1 : <==> diss = TRUE * jdyss < 10 : don't save dissimilarities (C.keep.diss = FALSE) */ double *valmd, int *jtmd, int *ndyst, int *jalg, int *method, // for agnes() only currently, to be 'stop_at_k' for diana() int *kwan, int *ner, // = order [] (in R) double *ban, // = height[] double *coef, double *alpha, int *merge, int *trace_lev) { if (*jdyss % 10 == 1) { // have distances; do not access x[] *jpp = 1; } else { // compute distances int jhalt = dysta(nn, jpp, x, dys, ndyst, jtmd, valmd);/* --> ./dysta.c */ if (jhalt != 0) { *jdyss = -1; return; } } if (*jdyss >= 10) { /* save distances for S */ Memcpy(dys2, dys, (*nn * (*nn - 1) / 2 + 1)); } if (*jalg != 2) { // AGNES agnes(*nn, kwan, ner, ban, dys, *method, alpha, merge, trace_lev[0]); } else { // *jalg == 2 // DIANA splyt(*nn, kwan, ner, ban, dys, *method, merge, trace_lev[0]); } // Compute agglomerative/divisive coefficient from banner: *coef = bncoef(*nn, ban); return; } /* twins */ // merge[i,j] i=0..n_1, j = 1,2. --- for agnes() and splyt() [= diana] --- #define Merge(i,j) merge[(j==1) ? (i) : (i+n_1)] /* ----------------------------------------------------------- */ /* AGNES agglomeration */ static void agnes(int nn, int *kwan, int *ner, double *ban, double dys[], int method, double *alpha, int *merge, int trace_lev) { /* VARs */ int n_1 = nn - 1, _d, j, k, la = -1, lb = -1; // -Wall] Rboolean has_a3 = FALSE, has_a4 = FALSE,// is alpha[3] or [4] != 0 -- for Lance-Williams flex_meth = (method == 6 || method == 7); // 6: "flexible": "Flexible Strategy" (K+R p.236 f) extended to 'Lance-Williams' // 7: "gaverage" aka Flexible UPGMA (Belbin et al., 1992) /* Parameter adjustments */ --ban; --ner; --kwan; --alpha; if(trace_lev) { _d = (nn >= 100) ? 3 : (nn >= 10) ? 2 : 1; Rprintf("C agnes(n=%*d, method = %d, ..): ", _d,nn, method); } else _d = -1;// -Wall if(flex_meth) { has_a3 = (alpha[3] != 0.); has_a4 = (alpha[4] != 0.); if(trace_lev) { if(has_a4) Rprintf("|par| = 4, alpha[1:4] = (%g,%g,%g,%g); ", alpha[1],alpha[2],alpha[3],alpha[4]); else if(has_a3) Rprintf("|par| = 3, alpha[1:3] = (%g,%g,%g); ", alpha[1],alpha[2],alpha[3]); } } // Starting with nn clusters, kwan[j] := #{obj} in cluster j for (j = 1; j <= nn; ++j) { kwan[j] = 1; ner[j] = j; } // ---------------------------------------------------------------------------- /* find closest clusters */ if(trace_lev) Rprintf("%d merging steps\n", n_1); for (int nmerge = 0; nmerge < n_1; ++nmerge) { // j := min_j { kwan[j] > 0} = first non-empty cluster (j >= 2) j = 1; do { j++; } while(kwan[j] == 0); if(trace_lev >= 2) Rprintf(" nmerge=%*d, j=%*d, ", _d,nmerge, _d,j); double d_min = dys[ind_2(1, j)] * 1.1f + 1.; for (k = 1; k <= n_1; ++k) if (kwan[k] > 0) { for (j = k + 1; j <= nn; ++j) if (kwan[j] > 0) { int k_j = ind_2(k, j); if (d_min >= dys[k_j]) { // Note: also when "==" ! d_min = dys[k_j]; la = k; lb = j; } } } // --> closest clusters {la < lb} are at distance d_min if(trace_lev >= 2) Rprintf("d_min = D(%*d,%*d) = %#g; ", _d,la, _d,lb, d_min); /* merge-structure for plotting tree in S */ int l1 = -la, l2 = -lb; for (j = 0; j < nmerge; ++j) { if (Merge(j, 1) == l1 || Merge(j, 2) == l1) l1 = j+1; if (Merge(j, 1) == l2 || Merge(j, 2) == l2) l2 = j+1; } Merge(nmerge, 1) = l1; Merge(nmerge, 2) = l2; if(trace_lev >= 3) Rprintf(" -> (%*d,%*d); ", _d,l1, _d,l2); if(flex_meth && l1 == l2) { // can happen with non-sensical (alpha_1,alpha_2,beta, ...) error(_("agnes(method=%d, par.method=*) lead to invalid merge; step %d, D(.,.)=%g"), method, nmerge+1, d_min); } /* determine lfyrs and llast */ int llast = -1, lfyrs = -1; // -Wall for (k = 1; k <= nn; ++k) { if (ner[k] == la) lfyrs = k; if (ner[k] == lb) llast = k; } ban[llast] = d_min; if(trace_lev >= 2) Rprintf("last=%*d;", _d,llast); /* if the two clusters are next to each other, ner must not be changed */ int lnext = lfyrs + kwan[la]; if (lnext != llast) { /* updating ner and ban */ if(trace_lev >= 2) Rprintf(" upd(n,b);"); int lput = lfyrs + kwan[la], lenda = llast + kwan[lb] - 2; for (k = 1; k <= llast - lput; ++k) { int lka = ner[lput]; double akb = ban[lput]; for (j = lput; j <= lenda; ++j) { ner[j] = ner[j + 1]; ban[j] = ban[j + 1]; } ner[lenda+1] = lka; ban[lenda+1] = akb; } } if(trace_lev >= 3) Rprintf("\n"); /* We will merge A & B into A_{new} */ // Calculate new dissimilarities d(q, A_{new}) for (int lq = 1; lq <= nn; ++lq) { // for each other cluster 'q' if (lq == la || lq == lb || kwan[lq] == 0) continue; int naq = ind_2(la, lq); int nbq = ind_2(lb, lq); if(trace_lev >= 3) Rprintf(" old D(A, j), D(B, j), j=%*d = (%g,%g); ", _d,lq, dys[naq], dys[nbq]); switch(method) { case 1: { // 1: unweighted pair-]group average method, UPGMA double ta = (double) kwan[la], tb = (double) kwan[lb], fa = ta / (ta + tb), fb = tb / (ta + tb); dys[naq] = fa * dys[naq] + fb * dys[nbq]; break; } case 2: /* 2: single linkage */ dys[naq] = fmin2(dys[naq], dys[nbq]); break; case 3: /* 3: complete linkage */ dys[naq] = fmax2(dys[naq], dys[nbq]); break; case 4: { // 4: ward's method double ta = (double) kwan[la], tb = (double) kwan[lb], tq = (double) kwan[lq], fa = (ta + tq) / (ta + tb + tq), fb = (tb + tq) / (ta + tb + tq), fc = -tq / (ta + tb + tq); int nab = ind_2(la, lb); dys[naq] = sqrt(fa * dys[naq] * dys[naq] + fb * dys[nbq] * dys[nbq] + fc * dys[nab] * dys[nab]); break; } case 5: /* 5: weighted average linkage */ dys[naq] = (dys[naq] + dys[nbq]) / 2.; break; case 6: { // 6: "Flexible Strategy" (K+R p.236 f) extended to 'Lance-Williams' double dNew = alpha[1] * dys[naq] + alpha[2] * dys[nbq]; if(has_a3) dNew += alpha[3] * dys[ind_2(la, lb)]; if(has_a4) dNew += alpha[4] * fabs(dys[naq] - dys[nbq]); dys[naq] = dNew; /* Lance-Williams would allow alpha(1:2) to *depend* on |cluster| * could also include the extensions of Jambu(1978) -- * See Gordon A.D. (1999) "Classification" (2nd ed.) p.78 ff */ break; } case 7: {/* 7: generalized "average" = Flexible UPGMA (Belbin et al., 1992) * Applies the flexible Lance-Williams formula to the UPGMA, aka * "average" case 1 above, i.e., alpha_{1,2} depend on cluster sizes: */ double ta = (double) kwan[la], tb = (double) kwan[lb], fa = alpha[1] * ta / (ta + tb), fb = alpha[2] * tb / (ta + tb), dNew = fa * dys[naq] + fb * dys[nbq]; if(has_a3) dNew += alpha[3] * dys[ind_2(la, lb)]; if(has_a4) dNew += alpha[4] * fabs(dys[naq] - dys[nbq]); dys[naq] = dNew; break; } default: error(_("invalid method (code %d)"), method); } if(trace_lev >= 3) Rprintf(" new D(A', %*d) = %g\n", _d,lq, dys[naq]); } // for (lq ..) kwan[la] += kwan[lb]; kwan[lb] = 0; if(trace_lev >= 2) Rprintf("%s size(A_new)= %d\n", (trace_lev >= 3)? " --> " : "", kwan[la]); }// for(nmerge ..) return; } /* agnes */ /* ----------------------------------------------------------- */ /* cf = ac := "Agglomerative Coefficient" from AGNES banner */ /* or cf = dc := "Divisive Coefficient" from DIANA banner */ void R_bncoef(int *nn, double *ban, double *cf) { *cf = bncoef(*nn, ban); } double bncoef(int n, double *ban) { int k, n_1 = n-1; double sup = 0.;// sup := max_k ban[k] for(k = 1; k < n; ++k) if (sup < ban[k]) sup = ban[k]; double cf = 0.; for (k = 0; k < n; ) { int kearl = (k > 0) ? k : 1, kafte = (++k < n) ? k : n_1; double syze = fmin2(ban[kearl], ban[kafte]); cf += (1. - syze / sup); } return cf / n; } /* bncoef */ /* ----------------------------------------------------------- */ /* DIANA "splitting" */ static void splyt(int nn, int *kwan, int *ner, double *ban, double dys[], int stop_at_k, int *merge, int trace_lev) { /* Local variables */ int j, ja, jb, k, l; int jma, jmb, lmm, llq, lmz, lxx, lmma, lmmb, lner, nclu; int lchan, nhalf, n_1 = nn - 1, splyn; /* Parameter adjustments */ --ban; --ner; --kwan; /* initialization */ nclu = 1; nhalf = nn * n_1 / 2 + 1; for (l = 1; l <= nn; ++l) { kwan[l] = 0; ban[l] = 0.; ner[l] = l; } kwan[1] = nn; ja = 1; /* cs := diameter of data set */ double cs = 0.; for(k = 0; k < nhalf; ++k) { if (cs < dys[k]) cs = dys[k]; } if(trace_lev) Rprintf("C diana(): ndist= %d, diameter = %g\n", nhalf, cs); /* prepare for splitting */ //____________ Big Loop _________________________________________________ L30: jb = ja + kwan[ja] - 1; jma = jb; if (kwan[ja] == 2) { // special case of a pair of objects kwan[ja] = 1; kwan[jb] = 1; ban [jb] = dys[ind_2(ner[ja], ner[jb])]; } else { /* finding first object to be shifted */ double bygsd = -1.; int lndsd = -1; for (l = ja; l <= jb; ++l) { lner = ner[l]; double sd = 0.; for (j = ja; j <= jb; ++j) sd += dys[ind_2(lner, ner[j])]; if (bygsd < sd) { bygsd = sd; lndsd = l; } } /* shifting the first object */ --kwan[ja]; kwan[jb] = 1; if (jb != lndsd) { lchan = ner[lndsd]; lmm = jb - 1; for (lmma = lndsd; lmma <= lmm; ++lmma) { lmmb = lmma + 1; ner[lmma] = ner[lmmb]; } ner[jb] = lchan; } splyn = 0; jma = jb - 1; /* finding the next object to be shifted */ do { splyn++; int rest = (jma - ja), jaway = -1; double bdyff = -1.; for (l = ja; l <= jma; ++l) { lner = ner[l]; double da = 0., db = 0.; for (j = ja; j <= jma; ++j) da += dys[ind_2(lner, ner[j])]; da /= rest; for (j = jma + 1; j <= jb; ++j) db += dys[ind_2(lner, ner[j])]; db /= splyn; double dyff = da - db; if (bdyff < dyff) { bdyff = dyff; jaway = l; } } /* end for(l ..) */ jmb = jma + 1; /* shifting the next object when necessary */ if (bdyff <= 0.) break; // out of "object shifting" while(.) loop if (jma != jaway) { lchan = ner[jaway]; lmz = jma - 1; for (lxx = jaway; lxx <= lmz; ++lxx) ner[lxx] = ner[lxx + 1]; ner[jma] = lchan; } for (lxx = jmb; lxx <= jb; ++lxx) { int l_1 = lxx - 1; if (ner[l_1] < ner[lxx]) break; lchan = ner[l_1]; ner[l_1] = ner[lxx]; ner[lxx] = lchan; } --kwan[ja]; kwan[jma] = kwan[jmb] + 1; kwan[jmb] = 0; --jma; jmb = jma + 1; } while (jma != ja); // 200: switch the two parts when necessary if (ner[ja] >= ner[jmb]) { int lxxa = ja; for (int lgrb = jmb; lgrb <= jb; ++lgrb) { ++lxxa; lchan = ner[lgrb]; int lxg = -1; for (int ll = lxxa; ll <= lgrb; ++ll) { int lxf = lgrb - ll + lxxa; lxg = lxf - 1; ner[lxf] = ner[lxg]; } ner[lxg] = lchan; } llq = kwan[jmb]; kwan[jmb] = 0; jma = ja + jb - jma - 1; jmb = jma + 1; kwan[jmb] = kwan[ja]; kwan[ja] = llq; } /* 300 : compute level for banner */ if (nclu == 1) { ban[jmb] = cs; } else { ban[jmb] = min_dis(dys, ja, jb, &ner[1]); } } if (++nclu < nn) { /* continue splitting until all objects are separated */ if (jb != nn) { L420: ja += kwan[ja]; if (ja <= nn) { if (kwan[ja] <= 1) goto L420; else goto L30; } } ja = 1; if (kwan[ja] == 1) goto L420; else goto L30; } //____________ End Big Loop _________________________________________________ /* 500 : merge-structure for plotting tree in S */ for (int nmerge = 0; nmerge < n_1; ++nmerge) { int nj = -1, l1, l2; double dmin = cs; for (j = 2; j <= nn; ++j) { if (kwan[j] >= 0 && dmin >= ban[j]) { dmin = ban[j]; nj = j; } } kwan[nj] = -1; l1 = -ner[nj - 1]; l2 = -ner[nj]; for (j = 0; j < nmerge; ++j) { if (Merge(j, 1) == l1 || Merge(j, 2) == l1) l1 = j+1; if (Merge(j, 1) == l2 || Merge(j, 2) == l2) l2 = j+1; } Merge(nmerge, 1) = l1; Merge(nmerge, 2) = l2; } return; } /* splyt */ /* ----------------------------------------------------------- */ /* used in splyt() above */ static double min_dis(double dys[], int ka, int kb, int ner[]) { double dm = 0.; for(int k = ka -1; k < kb -1; ++k) { int ner_k = ner[k]; for (int j = k+1; j < kb; ++j) { int k_j = ind_2(ner_k, ner[j]); if (dm < dys[k_j]) dm = dys[k_j]; } } return dm; } /* min_dis */ cluster/src/spannel.c0000644000176200001440000001005611646600017014331 0ustar liggesusers/* Compute the SPANNing ELlipsoid * ------------------------------ for clusplot.default(*, span = TRUE) * Original spannel.f -- translated by f2c (version 20010821). * and f2c-clean,v 1.10 2002/03/28 16:37:27 maechler */ #include #include "cluster.h" #ifdef DEBUG_spannel # include #endif void spannel(int *ncas, /* = number of objects */ int *ndep, /* = number of variables */ double *dat,/* [ncas, 0:ndep] */ double *dstopt, /* = squared distances [1:ncas] */ double *cov,/* matrix [0:ndep, 0:ndep] */ double *varsum, /* [1:ndep] */ double *varss, /* [1:ndep] */ double *prob, /* [1:ncas] */ double *work, /* [0:ndep] */ double *eps, int *maxit, /* = maximal # iterations (and returns #{iter.})*/ int *ierr) { static int c__0 = 0; int it, i, j, k; double dmax, p, deter; int dat_dim1 = *ncas; int cov_dim1 = *ndep + 1; #define COV(i,j) cov[i + j * cov_dim1] #define X(i,j) dat[i + j * dat_dim1] /* X(i,j) : i = 0..(n-1), j = 0,..p often 1..p */ /* Parameter adjustments */ --varss; --varsum; /* When spannel() is called, dat[i,0] are all == 1 -- left unchanged: * Scale Data dat[i,j] to mean = 0 and var{1/n} = 1 -- for j= 1:ndep (not j=0!) */ for (j = 1; j <= *ndep; ++j) { varsum[j] = 0.; varss[j] = 0.; } for (i = 0; i < *ncas; ++i) { for (j = 1; j <= *ndep; ++j) { p = X(i,j); varsum[j] += p; varss [j] += p * p; } } for (j = 1; j <= *ndep; ++j) { double aver = varsum[j] / *ncas, scal = sqrt(varss[j] / *ncas - aver * aver); #ifdef DEBUG_spannel Rprintf("j= %d, scal = %g\n", j, scal); #endif for (i = 0; i < *ncas; ++i) X(i,j) = (X(i,j) - aver) / scal; } p = 1. / (double) (*ncas); for (i = 0; i < *ncas; ++i) prob[i] = p; *ierr = 0; p = (double) (*ndep); /* ---- Repeat { ... up to `maxit' times ] */ for(it = 0; it < *maxit; it++) { /* Cov[,] = weighted covariance of dat[,] {weights = prob[]} */ for (j = 0; j <= *ndep; ++j) for (k = 0; k <= j; ++k) COV(k,j) = 0.; for (i = 0; i < *ncas; ++i) { for (j = 0; j <= *ndep; ++j) { work[j] = X(i,j); double tempo = prob[i] * work[j]; for (k = 0; k <= j; ++k) COV(k,j) += tempo * work[k]; } } for (j = 0; j <= *ndep; ++j) for (k = 0; k <= j; ++k) COV(j,k) = COV(k,j); deter = 1.; for (i = 0; i <= *ndep; ++i) { cl_sweep(cov, ndep, &c__0, &i, &deter); if (deter <= 0.) { *ierr = 2; return; } } #ifdef DEBUG_spannel Rprintf(" it= %d; after all sweep()s : deter = %g\n", it, deter); #endif dmax = 0.; for (i = 0; i < *ncas; ++i) { double dist = -1.; for (j = 0; j <= *ndep; ++j) { /* work(j) = - sum_{k=0}^p dat(i,k) * cov(k,j) { = cov(j,k) }, * i.e., work_j = - X[i,] %*% COV[,j] */ double w_j = 0.; for (k = 0; k <= *ndep; ++k) w_j -= COV(j,k) * X(i,k); dist += w_j * X(i,j); } dstopt[i] = dist;/* Dist{opt}_i = -1 - t(X[i,]) %*% COV %*% X[i,] */ if (dmax < dist) dmax = dist; }/* for() : now dmax == max{ dstopt[i] } */ if (dmax <= p + *eps) { /* _converged_ */ *maxit = it; return; } /* else not yet converged */ for (i = 0; i < *ncas; ++i) prob[i] *= (dstopt[i] / p); } return;/* with it == *maxit and no convergence */ } /* spannel */ #undef X /* This is currently also called from R : ../tests/sweep-ex.R * ==> keep pointer args !*/ void cl_sweep(double *cov, int *nord, int *ixlo, int *nel, double *deter) { int i, j, cov_dim1 = *nord + 1; double temp = COV(*nel,*nel); *deter *= temp; if (*deter <= 0.) return; /* singular case -- signaled via *deter */ if (*nord <= 1) { COV(1,1) = 1. / temp; } else { /* nord > 1 */ for (i = *ixlo; i <= *nord; ++i) if (i != *nel) { for (j = *ixlo; j <= i; ++j) if (j != *nel) { COV(j,i) = COV(i,j) - COV(i,*nel) * COV(*nel,j) / temp; COV(i,j) = COV(j,i); } } COV(*nel,*nel) = 1.; for (i = *ixlo; i <= *nord; ++i) { COV(*nel,i) = -COV(i,*nel) / temp; COV(i,*nel) = COV(*nel,i); } } return; } /* cl_sweep */ #undef COV cluster/src/fanny.c0000644000176200001440000003106614724553316014021 0ustar liggesusers/* FANNY : program for Fuzzy cluster ANalysis */ /* was $Id: fanny.c 8465 2024-12-06 10:49:50Z maechler $ * fanny.f -- translated by f2c (version 20020621). * and treated by f2c-clean v 1.10, and manually by Martin Maechler */ #include #include /* for diagnostics */ #include "cluster.h" static int dysta3(int *nn, int *p, double *x, double *dys, int *ndyst, int *jtmd, double *valmd); static void fuzzy(int nn, int k, double *p, double *dp, double *pt, double *dss, double *esp, double *ef, double *obj, double r, double tol, int *nit, int trace_lev); static void caddy(int nn, int k, double *p, int *ktrue, int *nfuzz, int *ncluv, double *rdraw, int trace_lev); static void fygur(int kk, int nn, int ncluv[], double dss[], double s, int *nsend, int *nelem, int *negbr, double *syl, double *srank, double *avsyl, double *ttsyl, double *sylinf); void cl_fanny(int *nn, /* = number of objects */ int *jpp, /* = number of variables for clustering */ int *kk, /* = number of clusters */ double *x, double *dss, int *jdyss, double *valmd, int *jtmd, int *ndyst, int *nsend, int *nelem, int *negbr, double *syl, double *p, double *dp, double *pt, int *nfuzz, double *esp, double *ef, double *dvec, double *ttsyl, double *obj, /* input/output; see fuzzy() below */ int *ncluv, double *sylinf, double *r, double *tol, int *maxit) { int ktrue, trace_lev = (int) obj[1]; Rboolean all_stats = (obj[0] == 0.);/* TODO: consider *not* doing caddy() */ if (*jdyss != 1) { /* compute dissimilarities from data */ int jhalt = dysta3(nn, jpp, x, dss, ndyst, jtmd, valmd); if (jhalt) { *jdyss = -1; return; } } fuzzy(*nn, *kk, p, dp, pt, dss, esp, ef, obj, *r, *tol, maxit, trace_lev); caddy(*nn, *kk, p, /* -> */ &ktrue, nfuzz, ncluv, pt, trace_lev); obj[0] = (double) ktrue; /* Compute "silhouette": */ if (all_stats && 2 <= ktrue && ktrue < *nn) { int i, nhalf = *nn * (*nn - 1) / 2; double s = 0.; /* s := max( dss[i,j] ) */ for(i = 0; i < nhalf; i++) if (s < dss[i]) s = dss[i]; fygur(ktrue, *nn, ncluv, dss, s, nsend, nelem, negbr, syl, dvec, pt, ttsyl, sylinf); } return; } /* cl_fanny */ static int dysta3(int *nn, int *p, double *x, double *dys, int *ndyst, int *jtmd, double *valmd) { int jhalt = 0, nlk = 0, x_d = *nn; for (int l = 0; l < (*nn - 1); ++l) { for (int k = l + 1; k < *nn; ++k, ++nlk) { double clk = 0.; int j, jj, npres = 0; for (j = 0, jj = 0; j < *p; j++, jj+=x_d) { double d; if (jtmd[j] < 0) { if (x[l + jj] == valmd[j] || x[k + jj] == valmd[j]) continue; /* next j */ } ++npres; d = x[l + jj] - x[k + jj]; if (*ndyst != 2) /* 1 or 3 */ clk += d * d; else /* if (*ndyst == 2) */ clk += fabs(d); } if (npres == 0) { dys[nlk] = -1.; jhalt = 1; } else { clk *= (*p) / (double) npres; dys[nlk] = (*ndyst == 1) ? sqrt(clk) : /*ndyst = 2 or 3 */ clk; } } } return jhalt; } /* dysta3 */ static void fuzzy(int nn, int k, double *p, double *dp, double *pt, double *dss, double *esp, double *ef, double *obj,/* of length 4; * in : (cluster_only, trace_lev, compute_p, 0) * out: (ktrue , cryt, PC ("dunn"), normalized_PC) */ double r, /* the exponent, > 1. -- was fixed to 2 originally */ double tol,/* the precision for the iterations */ int *nit, /* the maximal number of iterations -- originally fixed to 500 */ int trace_lev) { double dt, xx, ddd, crt, reen, cryt; int p_d = nn, dp_d = nn; int i, j, m, mi, it; Rboolean converged = FALSE, compute_p = (int)obj[2]; if(trace_lev) Rprintf("fanny()'s fuzzy(n = %d, k = %d):\n", nn, k); if(compute_p) { /* Compute initial fuzzy clustering, i.e. membership matrix p[,] */ int nd, ndk; double p0 = 0.1 / (k - 1); for (m = 0; m < nn; ++m) for (j = 0; j < k; ++j) p[m + j * p_d] = p0; ndk = nn / k; nd = ndk; j = 0; for (m = 0; m < nn; ++m) { int jj; p[m + j * p_d] = 0.9; if (m+1 >= nd) { ++j; if (j+1 == k) /* reset */ nd = nn; else nd += ndk; } for (jj = 0; jj < k; ++jj) p[m + jj * p_d] = pow(p[m + jj * p_d], r); } } else { /* p[,] already contains memberships */ for (m = 0; m < nn; ++m) for (j = 0; j < k; ++j) p[m + j * p_d] = pow(p[m + j * p_d], r); } /* initial criterion value */ cryt = 0.; for (j = 0; j < k; ++j) { esp[j] = 0.; ef[j] = 0.; for (m = 0; m < nn; ++m) { esp[j] += p[m + j * p_d]; for (i = 0; i < nn; ++i) { if (i != m) { mi = imin2(m,i); mi = mi * nn - (mi + 1) * (mi + 2) / 2 + imax2(m,i); dp[m + j * dp_d] += p[i + j * p_d] * dss[mi]; ef[j] += p[i + j * p_d] * p[m + j * p_d] * dss[mi]; } } } cryt += ef[j] / (esp[j] * 2.); } crt = cryt; if(trace_lev) { Rprintf("fuzzy(): initial obj = %g\n", cryt); if(trace_lev >= 2) { Rprintf(" ef[]= ("); for(j=0; j < k; j++) Rprintf(" %g%s", ef[j], ((j < k-1)? "," : ")\n")); Rprintf(" esp[]= ("); for(j=0; j < k; j++) Rprintf(" %g%s",esp[j], ((j < k-1)? "," : ")\n")); } } reen = 1. / (r - 1.); it = 0; while(++it <= *nit) { /* . . . . . iterations . . . . . . . . . . . . . */ for(m = 0; m < nn; m++) { /* the new membership coefficients of the objects are calculated, and the resulting value of the criterion is computed. */ dt = 0.; for (j = 0; j < k; ++j) { pt[j] = pow(esp[j] / (dp[m + j * dp_d] - ef[j] / (2 * esp[j])), reen); dt += pt[j]; } xx = 0.; for (j = 0; j < k; ++j) { pt[j] /= dt; if (pt[j] < 0.) xx += pt[j]; } /* now: sum_j (pt[j]) == 1; xx := sum_{pt[j] < 0} pt[j] */ for (j = 0; j < k; ++j) { double d_mj; pt[j] = (pt[j] > 0.) ? pow(pt[j] / (1 - xx), r) : 0.; d_mj = pt[j] - p[m + j * p_d]; esp[j] += d_mj; for (i = 0; i < nn; ++i) { if (i != m) { mi = imin2(m,i); mi = mi * nn - (mi + 1) * (mi + 2) / 2 + imax2(m,i); ddd = d_mj * dss[mi]; dp[i + j * dp_d] += ddd; ef[j] += p[i + j * p_d] * 2. * ddd; } } p[m + j * p_d] = pt[j]; } if(trace_lev >= 3) { Rprintf(" pt[m= %d, *]: ",m); for (j = 0; j < k; ++j) Rprintf(" %g%s", pt[j], ((j < k-1)? "," : "\n")); } } /* m == nn */ cryt = 0.; for (j = 0; j < k; ++j) cryt += ef[j] / (esp[j] * 2.); if(trace_lev >= 2) Rprintf(" m == n: obj = %#20.14g", cryt); /* Convergence check */ if((converged = (fabs(cryt - crt) <= tol * cryt))) break; if(trace_lev >= 2) Rprintf(" not converged: it = %d\n", it); crt = cryt; } /* while */ *nit = (converged)? it : -1; if(trace_lev) { Rprintf("%s%sonverged after %d iterations, obj = %#20.*g\n", trace_lev >=2 ? "\n" : "", (converged) ? "C" : "NOT c", it, (int)((trace_lev >= 2)? 20 : 7), cryt); } /* obj[0] = (double) it; << no longer; return it via *nit ! */ obj[1] = cryt; /* PC (partition coefficient), "non-fuzzyness index" of libert is computed * C = 1/n sum_{i,j} u_{i,j} ^ r fulfills * 1 >= C >= sum_j (1/k)^r = k * k^-r = k^(1-r) * ==> normalization (C - k^(1-r)) / (1 - k^(1-r)) = (k^(r-1) * C - 1) / (k^(r-1) - 1) */ for (j = 0, crt = 0.; j < k; ++j) crt += esp[j]; crt /= nn; obj[2] = crt; /* the PC */ xx = pow((double)k, r - 1.); obj[3] = (xx * crt - 1.) / (xx - 1.); /* Note however, that for r != 2, MM rather prefers to use * the "original definition" C = 1/n sum_{i,j} u_{i,j} ^ 2, and its normalization */ /* p[m,j] := (u_{m,j} ^ r) ^{1/r} == u_{m,j} : */ xx = 1. / r; for (m = 0; m < nn; ++m) for (j = 0; j < k; ++j) p[m + j * p_d] = pow(p[m + j * p_d], xx); } /* fuzzy */ static void caddy(int nn, int k, double *p, int *ktrue, int *nfuzz, int *ncluv, double *rdraw, int trace_lev) { Rboolean stay; int i, m, ktry, nbest; double pbest; if(trace_lev) Rprintf("fanny()'s caddy(*, k = %d):\n", k); pbest = p[0]; nbest = 1; for (i = 1; i < k; ++i) { if (pbest < p[i * nn]) { pbest = p[i * nn]; nbest = i+1; } } nfuzz[0] = nbest; ncluv[0] = 1; *ktrue = 1; for (m = 1; m < nn; ++m) { pbest = p[m]; nbest = 1; for (i = 1; i < k; ++i) { if (pbest < p[m + i * nn]) { pbest = p[m + i * nn]; nbest = i+1; } } stay = FALSE; for (ktry = 0; ktry < *ktrue; ++ktry) { if (nfuzz[ktry] == nbest) { stay = TRUE; ncluv[m] = ktry+1; break; } } if (! stay) { nfuzz[*ktrue] = nbest; (*ktrue)++; ncluv[m] = *ktrue; } } if(trace_lev) Rprintf(" -> k_true (crisp) = %d", *ktrue); if (*ktrue < k) { int kwalk, kleft; if(trace_lev) Rprintf(" < k (= %d) !!\n", k); for (kwalk = *ktrue; kwalk < k; ++kwalk) { for (kleft = 1; kleft <= k; ++kleft) { stay = FALSE; for (ktry = 0; ktry < kwalk; ++ktry) { if (nfuzz[ktry] == kleft) { stay = TRUE; break; } } if (! stay) { nfuzz[kwalk] = kleft; break; } } } } else if(trace_lev) Rprintf("\n"); for (m = 0; m < nn; ++m) { for (i = 0; i < k; ++i) rdraw[i] = p[m + (nfuzz[i]-1) * nn]; for (i = 0; i < k; ++i) p[m + i * nn] = rdraw[i]; } return; } /* caddy */ /* ----------------------------------------------------------- Compute Silhouette Information : TODO cleanup: this is almost identical to dark() in ./pam.c -- difference : different dys[] / dss[] indexing, but that -- dss[] indexing change needs to be "synchronized" in all functions here */ static void fygur(int kk, int nn, int ncluv[], double dss[], double s, int *nsend, int *nelem, int *negbr, double *syl, double *srank, double *avsyl, double *ttsyl, double *sylinf) { int sylinf_d = nn; /* sylinf[nn, 4] */ int j, l, k, k_, nj, ntt, nsylr; double dysa, dysb; /* pointers to sylinf[] columns:*/ double *sylinf_2, *sylinf_3, *sylinf_4; sylinf_2 = sylinf + sylinf_d; sylinf_3 = sylinf_2 + sylinf_d; sylinf_4 = sylinf_3 + sylinf_d; /* Parameter adjustments */ --avsyl; --ncluv; --dss; nsylr = 0; *ttsyl = 0.; for (k = 1; k <= kk; ++k) { /* nelem[0:(ntt-1)] := indices (1-based) of obs. in cluster k : */ ntt = 0; for (j = 1; j <= nn; ++j) { if (ncluv[j] == k) { nelem[ntt] = j; ++ntt; } } for (j = 0; j < ntt; ++j) {/* (j+1)-th obs. in cluster k */ nj = nelem[j]; dysb = s * 1.1 + 1.; negbr[j] = -1; /* for all clusters k_ != k : */ for (k_ = 1; k_ <= kk; ++k_) if (k_ != k) { int nbb = 0; double db = 0.; for (l = 1; l <= nn; ++l) { if (ncluv[l] == k_) { ++nbb; if (l < nj) { db += dss[nn * (l - 1) + nj - l * (l + 1) / 2]; } else if (l > nj) { db += dss[nn * (nj - 1) + l - nj * (nj + 1) / 2]; } /* else dss(.)=0 ; nothing to add */ } } db /= nbb; /* now db(k_) := mean( d[j, l]; l in C_{k_} ) */ if (dysb > db) { dysb = db; negbr[j] = k_; } }/* negbr[j] := arg min_{k_} db(k_) */ if (ntt > 1) { dysa = 0.; for (l = 0; l < ntt; ++l) { int nl = nelem[l]; if (nj < nl) { dysa += dss[nn * (nj - 1) + nl - nj * (nj + 1) / 2]; } else if (nj > nl) { dysa += dss[nn * (nl - 1) + nj - nl * (nl + 1) / 2]; }/* else dss(.)=0 ; nothing to add */ } dysa /= ntt - 1; if (dysa > 0.) { if (dysb > 0.) { if (dysb > dysa) syl[j] = 1. - dysa / dysb; else if (dysb < dysa) syl[j] = dysb / dysa - 1.; else /* dysb == dysa: */ syl[j] = 0.; if (syl[j] < -1.) syl[j] = -1.; else if (syl[j] > 1.) syl[j] = 1.; } else { syl[j] = -1.; } } else /* dysa == 0 */ if (dysb > 0.) syl[j] = 1.; else syl[j] = 0.; } else { /* ntt == 1: */ syl[j] = 0.; } } /* for( j ) */ avsyl[k] = 0.; for (j = 0; j < ntt; ++j) { int lang = 0 /* -Wall */; double symax = -2.; for (l = 0; l < ntt; ++l) { if (symax < syl[l]) { symax = syl[l]; lang = l; } } nsend[j] = lang; srank[j] = symax; /* = syl[lang] */ avsyl[k] += srank[j]; syl[lang] = -3.; } *ttsyl += avsyl[k]; avsyl[k] /= (double) ntt; if (ntt < 2) { sylinf [nsylr] = (double) k; sylinf_2[nsylr] = (double) negbr[0]; sylinf_3[nsylr] = 0.; sylinf_4[nsylr] = (double) nelem[0]; ++nsylr; } else { for (j = 0; j < ntt; ++j) { nj = nsend[j]; sylinf [nsylr] = (double) k; sylinf_2[nsylr] = (double) negbr[nj]; sylinf_3[nsylr] = srank[j]; sylinf_4[nsylr] = (double) nelem[nj]; ++nsylr; } } } /* for (k) */ *ttsyl /= nn; } /* fygur */ cluster/src/init.c0000644000176200001440000000554014724553316013647 0ustar liggesusers#include #include #include "cluster.h" #include #define CDEF(name) {#name, (DL_FUNC) &name, sizeof(name ## _typ)/sizeof(name ## _typ[0]), name ##_typ} #define CALLDEF(name, n) {#name, (DL_FUNC) &name, n} static R_NativePrimitiveArgType R_bncoef_typ[3] = { INTSXP, REALSXP, REALSXP }; static R_NativePrimitiveArgType cl_clara_typ[34] = { /*n:*/ INTSXP, INTSXP, INTSXP, REALSXP, INTSXP, INTSXP, REALSXP, INTSXP, /*valmd:*/ REALSXP, INTSXP, INTSXP, /* rng_R: */ LGLSXP, /* pam_like:*/ LGLSXP, /*d_flag:*/ INTSXP, /*nrepr: */ INTSXP, INTSXP, INTSXP, INTSXP, INTSXP, /*radus:*/ REALSXP, REALSXP, REALSXP, REALSXP, REALSXP, REALSXP, INTSXP, /*obj: */ REALSXP, REALSXP, REALSXP, REALSXP, INTSXP, INTSXP, /*tmp: */ REALSXP,INTSXP }; static R_NativePrimitiveArgType cl_fanny_typ[27] = { INTSXP, INTSXP, INTSXP, REALSXP, REALSXP, /*jdyss: */ INTSXP, REALSXP, INTSXP, INTSXP, INTSXP, INTSXP, /*negbr: */ INTSXP, /*syl: */ REALSXP, REALSXP, REALSXP, REALSXP, /*nfuzz: */ INTSXP, REALSXP, REALSXP, REALSXP, REALSXP, /*obj: */ REALSXP, INTSXP, REALSXP, REALSXP, REALSXP, INTSXP }; #ifdef _UNUSED_C_pam static R_NativePrimitiveArgType cl_pam_typ[24] = { INTSXP, INTSXP, INTSXP, REALSXP, REALSXP, /*jdyss: */ INTSXP, REALSXP, INTSXP, INTSXP, INTSXP, /*nrepr: */ LGLSXP, INTSXP, /*radus: */ REALSXP, REALSXP, REALSXP, REALSXP, /*ttsyl: */ REALSXP, REALSXP, /*medoids*/ INTSXP, INTSXP, REALSXP, REALSXP, INTSXP, /*optim: */ INTSXP }; #endif static R_NativePrimitiveArgType spannel_typ[12] = { // ./spannel.c : INTSXP, INTSXP, REALSXP, REALSXP, REALSXP, REALSXP, /*varss: */ REALSXP, REALSXP, REALSXP, REALSXP, INTSXP, INTSXP }; static R_NativePrimitiveArgType sildist_typ[] = { REALSXP, INTSXP, INTSXP, INTSXP, REALSXP, INTSXP, /* si: */ REALSXP, INTSXP, LGLSXP }; // .C(twins, ..) called from R's agnes() and diana(): static R_NativePrimitiveArgType twins_typ[18] = { INTSXP, INTSXP, REALSXP, REALSXP, REALSXP, /* jdiss: */ INTSXP, REALSXP, INTSXP, INTSXP, INTSXP, INTSXP, /* kwan: */ INTSXP, INTSXP, REALSXP, REALSXP, REALSXP, INTSXP, INTSXP }; /* is only .C()-called from ../tests/sweep-ex.R : */ static R_NativePrimitiveArgType cl_sweep_typ[5] = { REALSXP, INTSXP, INTSXP, INTSXP, REALSXP }; static const R_CMethodDef CEntries[] = { CDEF(R_bncoef), CDEF(cl_clara), {"cl_daisy", (DL_FUNC) &cldaisy, 11},/* ./daisy.c */ CDEF(cl_fanny), {"cl_mona", (DL_FUNC) &clmona, 9},/* ./mona.c */ CDEF(spannel), CDEF(cl_sweep), CDEF(sildist), CDEF(twins), {NULL, NULL, 0} }; static const R_CallMethodDef CallEntries[] = { CALLDEF(cl_Pam, 13), {NULL, NULL, 0} }; void R_init_cluster(DllInfo *dll) { R_registerRoutines(dll, CEntries, CallEntries, NULL/*FortEntries*/, NULL); R_useDynamicSymbols(dll, FALSE); } cluster/src/clara.c0000644000176200001440000007362514724553316013777 0ustar liggesusers /* Clustering LARge Applications ~ ~~~ ~ Clustering program based upon the k-medoid approach, and suitable for data sets of at least 100 objects. (for smaller data sets, please use program pam.) */ /* original Id: clara.f,v 1.10 2002/08/27 15:43:58 maechler translated by * f2c (version 20010821) and run through f2c-clean,v 1.10 2002/03/28 */ #include #include /* for diagnostics */ #include /* when R's RNG is used */ #include /* for interrupting */ #include "cluster.h" #include "ind_2.h" static void dysta2(int nsam, int jpp, int *nsel, double *x, int n, double *dys, DISS_KIND diss_kind, int *jtmd, double *valmd, Rboolean has_NA, Rboolean *toomany_NA); void cl_clara(int *n, /* = number of objects */ int *jpp,/* = number of variables */ int *kk, /* = number of clusters, 1 <= kk <= n-1 */ double *x, /* Input: the data x[n, jpp] _rowwise_ (transposed) * Output: the first `n' values are the `clustering' * (integers in 1,2,..,kk) */ int *nran, /* = #{random samples} drawn (= `samples' in R)*/ int *nsam, /* = #{objects} drawn from data set (`sampsize' in R) */ double *dys,/* [1:(1 + (nsam * (nsam - 1))/2)] * Output: to contain the distances, -1. instead of NA */ int *mdata, /*= {0,1}; 1: min(x) is missing value (NA); 0: no NA */ double *valmd,/*[j]= missing value code (instead of NA) for x[,j]*/ int *jtmd, /* [j]= {-1,1}; -1: x[,j] has NA; 1: no NAs in x[,j] */ DISS_KIND *diss_kind, // aka 'metric' \in {EUCLIDEAN, MANHATTAN, JACCARD, GOWER} // NB: GOWER is *buggy* (<--> ../tests/clara-gower_valgrind.Rout ; ---*AND* disabled from R 2023-11-30 int/*logical*/ *rng_R,/*= {0,1}; 0 : use clara's internal weak RNG; * 1 : use R's RNG (and seed) */ int/*logical*/ *pam_like,/* if (1), we do "swap()" as in pam(), otherwise use the code as it was in clara() "forever" upto 2011-04 */ int *correct_d,/* option for dist.computation: if (0), use the "fishy" formula to update distances in the NA-case, if (1), use a dysta2()-compatible formula */ int *nrepr, /* logical (0/1): 1 = "is representative object" */ int *nsel, int *nbest,/* x[nbest[j],] : the j-th obs in the final sample */ int *nr, int *nrx,/* prov. and final "medoids" aka representatives */ double *radus, double *ttd, double *ratt, double *ttbes, double *rdbes, double *rabes, int *mtt, double *obj, double *avsyl, double *ttsyl, double *sylinf, int *jstop, int *trace_lev, double *tmp, /* = double [ 3 * nsam ] */ int *itmp /* = integer[ 6 * nsam ] */ ) { #define tmp1 tmp #define tmp2 &tmp[*nsam] #define ntmp1 itmp #define ntmp2 &itmp[*nsam] #define ntmp3 &itmp[nsamb] #define ntmp4 &itmp[nsamb+ *nsam] #define ntmp5 &itmp[2*nsamb] #define ntmp6 &itmp[2*nsamb+ *nsam] /* Local variables */ Rboolean has_NA = mdata[0]; int j, jk, js, l, nrun; *jstop = 0; double rnn = (double) (*n), zba = -1., sx = -1.;/* Wall */ /* n_dys := size of distance array dys[] (-1): dys[0] remains unused */ int n_dys = *nsam * (*nsam - 1) / 2;/* >= 0 */ int nsamb = *nsam * 2, n_sam; Rboolean full_sample = (*n == *nsam), /* only one sub sample == full data */ lrg_sam = (*n < nsamb); /* sample more than *n/2 */ if (lrg_sam)/* generate indices for the other, smaller half */ n_sam = *n - *nsam; else n_sam = *nsam; if(*trace_lev) Rprintf("C clara(): (nsam,nran,n) = (%d,%d,%d);%s\n", *nsam, *nran, *n, full_sample ? " 'full_sample',": (lrg_sam ? " 'large_sample',": "")); if(*rng_R && !full_sample) GetRNGstate(); else /* << initialize `random seed' of the very simple randm() below */ nrun = 0; #define NEW_rand_k_trace_print(_nr_) \ rand_k= 1+ (int)(rnn* ((*rng_R)? unif_rand(): randm(&nrun))); \ if (rand_k > *n) {/* should never happen */ \ warning(_("C level clara(): random k=%d > n **\n"), rand_k); \ rand_k = *n; \ } \ if(*trace_lev >= 4) { \ Rprintf("... {" #_nr_ "}"); \ if(*rng_R) Rprintf("R unif_rand()"); \ else Rprintf("nrun=%5d", nrun); \ Rprintf(" -> k{ran}=%d\n", rand_k); \ } /* __LOOP__ : random subsamples are drawn and partitioned into kk clusters */ Rboolean kall = FALSE; /* kall becomes TRUE iff we've found a "valid sample", i.e. one for which all d(j,k) can be computed */ Rboolean dyst_toomany_NA = FALSE; int nunfs = 0; for (int jran = 1; jran <= *nran; ++jran) { if (!full_sample) {/* `real' case: sample size < n */ if(*trace_lev) Rprintf("- clara sample %2d ", jran); int rand_k, ntt = 0; if (kall && nunfs+1 != jran && !lrg_sam) { /* Have had (at least) one valid sample; use its representatives * nrx[] : nsel[] := sort(nrx[]) for the first j=1:k */ if(*trace_lev >= 2) Rprintf(" if (kall && nunfs...): \n"); for (jk = 0; jk < *kk; ++jk) nsel[jk] = nrx[jk]; for (jk = 0; jk < *kk-1; ++jk) { /* sort(nsel[0:(kk-1)] */ /* FIXME: nsel[] is 0-indexed, but *contains* 1-indices*/ int nsm = nsel[jk], jsm = jk; for (int jkk = jk + 1; jkk < *kk; ++jkk) { if (nsm > nsel[jkk]) { nsm = nsel[jkk]; jsm = jkk; } } nsel[jsm] = nsel[jk]; nsel[jk] = nsm; } ntt = *kk; } else { /* no valid sample _OR_ lrg_sam */ if(*trace_lev >= 2) Rprintf(" finding 1st... new k{ran}:\n"); /* Loop finding random index `rand_k' not yet in nrx[0:(*kk-1)] : */ L180: NEW_rand_k_trace_print(180) if (kall) { for (jk = 0; jk < *kk; ++jk) if (rand_k == nrx[jk]) goto L180; } /* end Loop */ nsel[ntt] = rand_k; if (++ntt == n_sam) goto L295; } if(*trace_lev >= 2) { Rprintf(".. kall: %s, ", (kall) ? "T" : "FALSE"); if(*trace_lev == 2) { Rprintf("nsel[ntt=%d] = %d\n", ntt, nsel[ntt]); } else { /* trace_lev >= 3 */ Rprintf("\n... nrx [0:%d]= ",*kk-1); for (jk = 0; jk < *kk; jk++) Rprintf("%d ",nrx[jk]); Rprintf("\n... nsel[0:%d]= ",ntt-1); for (jk = 0; jk < ntt; jk++) Rprintf("%d ",nsel[jk]); Rprintf("\n"); } } do { /*------------------------------------------------------------ * Loop finding random index 'rand_k' in {1:n}, * not in nrx[0:(k-1)] nor nsel[1:ntt] : */ L210: NEW_rand_k_trace_print(210) if (kall && lrg_sam) { for (jk = 0; jk < *kk; ++jk) { if (rand_k == nrx[jk]) goto L210; } } /* insert rand_k into nsel[1:ntt] or after and increase ntt : */ for (int ka = 0; ka < ntt; ++ka) if (nsel[ka] >= rand_k) { if (nsel[ka] == rand_k) goto L210; else {// nsel[ka] > rand_k : for (int na = ntt; na > ka; --na) nsel[na] = nsel[na-1]; nsel[ka] = rand_k; /* continue _outer_ loop */ goto L290; } } // else: rand_k > nsel[ka] for all ka = 0:(ntt-1) : nsel[ntt] = rand_k; L290: ++ntt; } while (ntt < n_sam); L295: if(*trace_lev) Rprintf(" [ntt=%d, nunfs=%d] ", ntt, nunfs); if (lrg_sam) { /* have indices for smaller _nonsampled_ half; revert this: */ for (j = 1, jk = 0, js = 0; j <= *n; j++) { if (jk < n_sam && nsel[jk] == j) ++jk; else nrepr[js++] = j; } for (j = 0; j < *nsam; ++j) nsel[j] = nrepr[j]; } if(*trace_lev >= 3) { Rprintf(".. nsel[1:%d]= ", *nsam); for (jk = 0; jk < *nsam; jk++) Rprintf("%d ",nsel[jk]); } } else { /* full_sample : *n = *nsam -- one sample is enough ! */ for (j = 0; j < *nsam; ++j) nsel[j] = j+1;/* <- uses 1-indices for its *values*! */ } char nl[] = " "; if(*trace_lev) { Rprintf(" -> dysta2()"); if(*trace_lev >= 2) nl[0] = '\n'; } dysta2(*nsam, *jpp, nsel, x, *n, dys, *diss_kind, jtmd, valmd, has_NA, &dyst_toomany_NA); if(dyst_toomany_NA) { if(*trace_lev) Rprintf(" gave dyst_toomany_NA --> new sample.%s", nl); dyst_toomany_NA = FALSE; ++nunfs; continue;/* random sample*/ } else if(*trace_lev) Rprintf(";%s", nl); double s = 0., sky; for(l = 1; l <= n_dys; l++) /* dys[0] is not used here */ if (s < dys[l]) s = dys[l]; if(*trace_lev >= 2) Rprintf(" clara -> s:= max{dys[1..%d]} = %g;", n_dys,s); bswap2(*kk, *nsam, s, dys, *pam_like, *trace_lev, /* --> */ &sky, nrepr, /* dysma */tmp1, /*dysmb*/tmp2, /* beter[], only used here */&tmp[nsamb]); if(*trace_lev >= 2) Rprintf(" end{bswap2}: sky = %g\n", sky); Rboolean nafs; double zb; selec(*kk, *n, *jpp, *diss_kind, &zb, *nsam, has_NA, jtmd, valmd, *trace_lev, nrepr, nsel, dys, x, nr, &nafs, ttd, radus, ratt, ntmp1, ntmp2, ntmp3, ntmp4, ntmp5, ntmp6, tmp1, tmp2, *correct_d); if (nafs) { /* couldn't assign some observation (to a cluster) * because of too many NA s */ ++nunfs; if(*trace_lev >= 2) Rprintf(" selec() -> 'NAfs'"); } else if(!kall || zba > zb) { /* 1st proper sample or new best */ if(*trace_lev >= 2) Rprintf(kall ? "new best" : "1st proper sample"); kall = TRUE; zba = zb; for (jk = 0; jk < *kk; ++jk) { ttbes[jk] = ttd [jk]; rdbes[jk] = radus[jk]; rabes[jk] = ratt [jk]; nrx [jk] = nr [jk]; } for (js = 0; js < *nsam; ++js) nbest[js] = nsel[js]; sx = s; } /* if(*trace_lev) Rprintf("%sobj= %g\n", (*trace_lev < 2) ?", " :" ", zb/rnn); */ if(*trace_lev) Rprintf(" obj= %g\n", zb/rnn); if(full_sample) break; /* out of resampling */ } /* --- end random sampling loop */ if(*rng_R && !full_sample) PutRNGstate(); if(*trace_lev && !full_sample) { Rprintf("C clara() -> best sample _found_ "); if(*trace_lev >= 2) { Rprintf("; nbest[1:%d] =\n c(", *nsam); for (js = 0; js < *nsam; ) { Rprintf("%d", nbest[js]); if(++js < *nsam) Rprintf((js % 20) ? "," : ",\n "); } Rprintf(")\n"); } } *obj = zba / rnn; if (nunfs >= *nran) { *jstop = 1; return; } /* else */ if (!kall) { *jstop = 2; return; } /* for the best subsample, the objects of the entire data set are assigned to their clusters */ dysta2(*nsam, *jpp, nbest, x, *n, dys, *diss_kind, jtmd, valmd, has_NA, &dyst_toomany_NA); if(dyst_toomany_NA) { error(_("clara()'s C level dysta2(nsam=%d, p=%d, n=%d) gave 'toomany_NA'"), *nsam, *jpp, *n); } if(*trace_lev) Rprintf(" resul(), "); resul(*kk, *n, *jpp, *diss_kind, has_NA, jtmd, valmd, x, nrx, mtt, *correct_d); if (*kk > 1) { if(*trace_lev) Rprintf(" black()"); black(*kk, *jpp, *nsam, nbest, dys, sx, x, /* compute --> */ avsyl, ttsyl, sylinf, ntmp1, ntmp2, ntmp3, ntmp4, /* syl[] */ tmp1, tmp2); } if(*trace_lev) Rprintf(" and return() from C.\n"); return; } /* End clara() ---------------------------------------------------*/ #undef tmp1 #undef tmp2 #undef ntmp1 #undef ntmp2 #undef ntmp3 #undef ntmp4 #undef ntmp5 #undef ntmp6 /** * Compute Dissimilarities for the selected sub-sample ---> dys[,] */ void dysta2(int nsam, int jpp, int *nsel, double *x, int n, double *dys, DISS_KIND diss_kind, int *jtmd, double *valmd, Rboolean has_NA, Rboolean *toomany_NA) { int nlk = 0; int current_group = 0; // for GOWER only: Counter for overall index dys[0] = 0.;/* very first index; *is* used because ind_2(i,i) |-> 0 ! */ for (int l = 1; l < nsam; ++l) { int lsel = nsel[l]; if(lsel <= 0 || lsel > n) error(_("C level dysta2(): nsel[%s= %d] = %d is outside 0..n, n=%d"), "l", l, lsel, n); for (int k = 0; k < l; ++k) { /* compute d(nsel[l], nsel[k]) {if possible}*/ int ksel = nsel[k]; if(ksel <= 0 || ksel > n) error(_("C level dysta2(): nsel[%s= %d] = %d is outside 0..n, n=%d"), "k", k, ksel, n); ++nlk; int npres = 0, j, lj, kj, N_ones = 0; double clk = 0.; for (j = 0, lj = lsel-1, kj = ksel-1; j < jpp; ++j, lj += n, kj += n) { if (has_NA && jtmd[j] < 0) { /* x[,j] has some Missing (NA) */ /* in the following line (Fortran!), x[-2] ==> seg.fault {BDR to R-core, Sat, 3 Aug 2002} */ if (x[lj] == valmd[j] || x[kj] == valmd[j]) { continue /* next j */; } } ++npres; // number of present pairs if (diss_kind == EUCLIDEAN) clk += (x[lj] - x[kj]) * (x[lj] - x[kj]); else if (diss_kind == JACCARD) { if( x[lj] > 0.9 && x[kj] > 0.9) { // both "are 1" - increment numerator clk++ ; N_ones++ ; } else if( x[lj] > 0.9 || x[kj] > 0.9)// any is 1 - increment N_ones N_ones++ ; } else if (diss_kind == MANHATTAN) clk += fabs(x[lj] - x[kj]); // NB: GOWER is *buggy* (<--> ../tests/clara-gower_valgrind.Rout ; ---*AND* disabled from R 2023-11-30 else if (diss_kind == GOWER) { if (x[lj] == x[kj]) { continue /* next j */; } double diff; if (jtmd[j] >= 0) { // Numerical feature diff = fabs(x[lj] - x[kj]); // Find the maximum and minimum values of this feature double max_val = -1.0 / 0.0; double min_val = 1.0 / 0.0; for (int i = 0; i < nsam; ++i){ double val = x[i + nsam * current_group]; if (val > max_val) { max_val = val; } if (val < min_val) { min_val = val; } } current_group = (current_group + 1) % 2; // Toggle between 0 and 1 double range = max_val - min_val; diff /= range; } else { // Categorical feature diff = (x[lj] != x[kj]); } clk += diff; } } /* for( j ..) */ if (npres == 0) {/* cannot compute d(.,.) because of too many NA */ *toomany_NA = TRUE; dys[nlk] = -1.; } else { double d1 = clk * (jpp / (double) npres); dys[nlk] = (diss_kind == EUCLIDEAN) ? sqrt(d1) : (diss_kind == JACCARD) ? 1 - clk / (double) N_ones : (diss_kind == MANHATTAN) ? d1 : /* diss_kind == GOWER */ d1 / jpp; } } /* for( k ) */ } /* for( l ) */ return; } /* End dysta2() -----------------------------------------------------------*/ double randm(int *nrun) { /* we programmed this generator ourselves because we wanted it to be machine independent. it should run on most computers because the largest int used is less than 2^30 . the period is 2^16=65536, which is good enough for our purposes. */ /* MM: improved the original speed-wise only: */ *nrun = (*nrun * 5761 + 999) & 0177777; /* Masking off all but the last 16 bits is equivalent to % 65536 */ return ((double) (*nrun) / 65536.); } /* randm() */ /* bswap2() : called once [per random sample] from clara() : */ void bswap2(int kk, int n, /* == nsam == 'sampsize', here in clara */ double s, const double dys[], Rboolean pam_like, int trace_lev, // result (though *only* nrepr[] is really used in caller:) double *sky, int *nrepr, double *dysma, double *dysmb, double *beter) { int i, j, ij, k,h, hbest = -1, nbest = -1;/* init for -Wall */ double dzsky; /* Parameter adjustments */ --nrepr; --beter; --dysma; --dysmb; if(trace_lev >= 2) { if(trace_lev == 2) Rprintf("\n bswap2(), 1. BUILD:"); else Rprintf("\n bswap2(*, s=%g), 1. BUILD: ", s); } s = s * 1.1 + 1.;/* value larger than all dissimilarities */ /* ====== first algorithm: BUILD. ====== */ for (i = 1; i <= n; ++i) { nrepr[i] = 0; dysma[i] = s; } for(k = 0; k < kk; k++) { int nmax = -1; /* -Wall */ double ammax = 0.; for (i = 1; i <= n; ++i) { if (nrepr[i] == 0) { beter[i] = 0.; for (j = 1; j <= n; ++j) { double cmd = dysma[j] - dys[ ind_2(i, j)]; if (cmd > 0.) beter[i] += cmd; } if (ammax <= beter[i]) { /* does < (instead of <= ) work too? -- NO! */ ammax = beter[i]; nmax = i; } } } nrepr[nmax] = 1;/* = .true. : found new representative */ if(trace_lev >= 2) { if(trace_lev == 2) Rprintf(" %d", nmax); else Rprintf(" new repr. %d\n", nmax); } /* update dysma[] : dysma[j] = D(j, nearest_representative) */ for (j = 1; j <= n; ++j) { ij = ind_2(nmax, j); if (dysma[j] > dys[ij]) dysma[j] = dys[ij]; } } // output of the above loop: nrepr[], dysma[], ... *sky = 0.; for (j = 1; j <= n; ++j) *sky += dysma[j]; if(trace_lev >= 2) /* >= 2 (?) */ { Rprintf(" after build: medoids are"); for (i = 1; i <= n; ++i) if(nrepr[i] == 1) Rprintf(" %2d", i); if(trace_lev >= 3) { Rprintf("\n and min.dist dysma[1:n] are\n"); for (i = 1; i <= n; ++i) { Rprintf(" %6.3g", dysma[i]); if(i % 10 == 0) Rprintf("\n"); } if(n % 10 != 0) Rprintf("\n"); } else Rprintf("\n"); Rprintf(" --> sky = sum_j D_j= %g\n", *sky); } if (kk == 1) return; // asky = *sky / ((double) n); /* ====== second algorithm: SWAP. ====== */ /* Big LOOP : */ L60: for (j = 1; j <= n; ++j) { /* dysma[j] := D_j d(j, ) [KR p.102, 104] * dysmb[j] := E_j d(j, <2-nd cl.medi>) [p.103] */ dysma[j] = s; dysmb[j] = s; for (i = 1; i <= n; ++i) { if (nrepr[i]) { ij = ind_2(i, j); if (dysma[j] > dys[ij]) { dysmb[j] = dysma[j]; dysma[j] = dys[ij]; } else if (dysmb[j] > dys[ij]) { dysmb[j] = dys[ij]; } } } } dzsky = 1.; /* 1 is arbitrary > 0; only dzsky < 0 matters in the end */ for (h = 1; h <= n; ++h) if (!nrepr[h]) { for (i = 1; i <= n; ++i) if (nrepr[i]) { double dz = 0.; /* dz := T_{ih} := sum_j C_{jih} [p.104] : */ for (j = 1; j <= n; ++j) { int ij = ind_2(i, j), hj = ind_2(h, j); if (dys[ij] == dysma[j]) { double small; if(pam_like) small = dysmb[j] > dys[hj] ? dys[hj] : dysmb[j]; else // old clara code which differs from pam()'s // and seems a bit illogical: small = dysmb[j] > dys[ij] ? dys[hj] : dysmb[j]; dz += (- dysma[j] + small); } else if (dys[hj] < dysma[j]) dz += (- dysma[j] + dys[hj]); } if (dzsky > dz) { dzsky = dz; // dzsky := min_{i,h} T_{i,h} hbest = h; nbest = i; } } } /* once had some 64-bit compiler / data configuration that looped forever*/ R_CheckUserInterrupt(); if (dzsky < 0.) { /* found an improving swap */ if(trace_lev >= 3) Rprintf( " swp new %d <-> %d old; decreasing diss. by %g\n", hbest, nbest, dzsky); nrepr[hbest] = 1; nrepr[nbest] = 0; *sky += dzsky; goto L60; } if(trace_lev >= 2 && hbest != -1) // in my examples hbest == -1 and it does not print: Rprintf( " Last swap: new %d <-> %d old; decreasing diss. by %g\n", hbest, nbest, dzsky); } /* End of bswap2() -------------------------------------------------- */ /* selec() : called once [per random sample] from clara() */ void selec(int kk, int n, int jpp, DISS_KIND diss_kind, double *zb, int nsam, Rboolean has_NA, int *jtmd, double *valmd, int trace_lev, // currently unused -- FIXME !? int *nrepr, int *nsel, double *dys, double *x, int *nr, Rboolean *nafs, /* := TRUE if a distance cannot be calculated */ double *ttd, double *radus, double *ratt, // [i]tmp* for clara(), i.e. not used later! int *nrnew, int *nsnew, int *npnew, int *ns, int *np, int *new, double *ttnew, double *rdnew, int correct_d) { /* Parameter adjustments */ --nsel; --nrepr; --ratt; --radus; --ttd; --np; --nr; --ns; --rdnew; --ttnew; --npnew; --nrnew; --nsnew; --new; /* nafs := TRUE if a distance cannot be calculated (because of NA s)*/ *nafs = FALSE; /* identification of representative objects, and initializations */ for (int j = 1, jk = 0; j <= nsam; ++j) { if (nrepr[j] != 0) { ++jk; nr [jk] = nsel[j]; ns [jk] = 0; ttd [jk] = 0.; radus[jk] = -1.; np [jk] = j; } } /* - assignment of the objects of the entire data set to a cluster, * - computation of some statistics, * - determination of the new ordering of the clusters */ double pp = (double) (jpp); *zb = 0.; int newf = 0; for(int i = 1; i <= n; i++) { /* for obj i, find its cluster jk in 1:kk */ int jkabc = -1/* -Wall */; double dsum, dnull = -9./* -Wall */; if (!has_NA) { for (int jk = 1; jk <= kk; ++jk) { dsum = 0.; int nr_k = nr[jk]; if (nr_k != i) { int N_ones = 0; double tra = 0.; // init only for JACCARD for (int jp = 0; jp < jpp; ++jp) { int na = (nr_k - 1) + jp * n, nb = (i - 1) + jp * n; // d_j(x[na], x[nb]) : if (diss_kind == JACCARD) { if(x[na] > 0.9 && x[nb] > 0.9) { // both "are 1" - increment numerator (and denom.) tra += 1; N_ones ++; } else if( x[na] > 0.9 || x[nb] > 0.9) { // any is 1 - increment denominator N_ones N_ones ++; } } else { // Euclidean or Manhattan tra = fabs(x[na] - x[nb]); if (diss_kind == EUCLIDEAN) tra *= tra; dsum += tra; } } if (diss_kind == JACCARD) dsum = 1 - tra / (double)N_ones; if (jk != 1 && dsum >= dnull) continue /* next jk */; } /* (nr_k != i) */ // new best: dsum < "previous" dnull //---------------- FIXME for JACCARD ------------------------- dnull = dsum; jkabc = jk; } /* for (jk 1:kk) */ } else { // _has_ missing data Rboolean first = TRUE; for (int jk = 1; jk <= kk; ++jk) { dsum = 0.; int nr_k = nr[jk]; if (nr_k != i) { int nobs = 0, N_ones = 0; double tra = 0.; // init only for JACCARD for (int jp = 0; jp < jpp; ++jp) { int na = (nr_k - 1) + jp * n, nb = (i - 1) + jp * n; if (jtmd[jp] < 0) { if (x[na] == valmd[jp] || x[nb] == valmd[jp]) continue /* next jp */; } nobs++; if (diss_kind == JACCARD) { if(x[na] > 0.9 && x[nb] > 0.9) { // both "are 1" - increment numerator (and denom.) tra += 1; N_ones ++; } else if( x[na] > 0.9 || x[nb] > 0.9) { // any is 1 - increment denominator N_ones N_ones ++; } } else { // Euclidean or Manhattan tra = fabs(x[na] - x[nb]); if (diss_kind == EUCLIDEAN) tra *= tra; dsum += tra; } } if (nobs == 0) /* all pairs partially missing */ continue /* next jk */; if (diss_kind == JACCARD) dsum = 1 - tra / (double)N_ones; if(correct_d) // correct -- only since 2017-06 dsum *= (pp / nobs); else dsum *= (nobs / pp); } if (first) first = FALSE; else if (dnull <= dsum) continue /* next jk */; /* here : first was TRUE {i.e. 1st time} or * dnull > dsum {i.e. new best} */ dnull = dsum; jkabc = jk; }/* for(jk ..) */ if (first) { /* found nothing */ *nafs = TRUE; return; } } /* else: has_NA */ if (diss_kind == EUCLIDEAN) dnull = sqrt(dnull); *zb += dnull; ttd[jkabc] += dnull; if (radus[jkabc] < dnull) radus[jkabc] = dnull; ++ns[jkabc]; if (newf < kk) { if (newf != 0) { for (int jnew = 1; jnew <= newf; ++jnew) { if (jkabc == new[jnew]) goto L90;/* next i */ } } ++newf; new[newf] = jkabc; } L90: ; } /* for( i = 1..n ) -------------------------------------------------*/ /* a permutation is carried out on vectors nr,ns,np,ttd,radus using the information in vector new. */ for (int j = 1; j <= kk; ++j) { int nj = new[j]; nrnew[j] = nr[nj]; nsnew[j] = ns[nj]; npnew[j] = np[nj]; ttnew[j] = ttd[nj]; rdnew[j] = radus[nj]; } for (int j = 1; j <= kk; ++j) { nr[j] = nrnew[j]; ns[j] = nsnew[j]; np[j] = npnew[j]; ttd[j] = ttnew[j] / (double) ns[j]; radus[j] = rdnew[j]; } if (kk > 1) { /* computation of ratt[ka] := minimal distance of medoid ka to any other medoid for comparison with the radius of cluster ka. */ for (int ka = 1; ka <= kk; ++ka) { Rboolean first = TRUE; int npa = np[ka]; for (int kb = 1; kb <= kk; ++kb) { if (kb == ka) continue /* next kb */; int npb = np[kb], npab = ind_2(npa, npb); if (first) first = FALSE; else if (dys[npab] >= ratt[ka]) continue /* next kb */; ratt[ka] = dys[npab]; if (ratt[ka] == 0.) ratt[ka] = -1.; } if (ratt[ka] > -0.5) ratt[ka] = radus[ka] / ratt[ka]; } } return; } /* End selec() -----------------------------------------------------------*/ void resul(int kk, int n, int jpp, DISS_KIND diss_kind, Rboolean has_NA, int *jtmd, double *valmd, double *x, int *nrx, int *mtt, int correct_d) /* option for dist.computation: if (0), use the "fishy" formula to update distances in the NA-case, if (1), use a dysta2()-compatible formula */ { // __FIXME__ "Jaccard" not yet supported ! <<<<<<<<<<<<<<<<<<<<<<<<<<<<< /* clustering vector is incorporated into x, and ``printed''. */ for(int i = 0; i < n; i++) { for (int jk = 0; jk < kk; ++jk) { if (nrx[jk] == i + 1)/* 1-indexing */ goto L220; /* continue next i (i.e., outer loop) */ } int njnb = i, nrjk, /* = nrx[jk -1 */ jksky = -1/* Wall */; double dnull = -9./* Wall */; if (!has_NA) { for (int jk = 0; jk < kk; ++jk) { double dsum = 0.; nrjk = (nrx[jk] - 1); for (int j = 0; j < jpp; ++j) { double tra = fabs(x[nrjk + j * n] - x[njnb + j * n]); if (diss_kind == EUCLIDEAN) tra *= tra; dsum += tra; } if (diss_kind == EUCLIDEAN) dsum = sqrt(dsum); if (jk == 0 || dnull > dsum) { // have new best dnull = dsum; jksky = jk; } } } else { /* _has_ missing data */ double pp = (double) jpp; for (int jk = 0; jk < kk; ++jk) { double dsum = 0.; nrjk = (nrx[jk] - 1); int nobs = 0; for (int j = 0; j < jpp; ++j) { int na = nrjk + j * n, nb = njnb + j * n; if (jtmd[j] < 0) { if (x[na] == valmd[j] || x[nb] == valmd[j]) continue /* next j */; } nobs++; double tra = fabs(x[na] - x[nb]); if (diss_kind == EUCLIDEAN) tra *= tra; dsum += tra; } if (diss_kind == EUCLIDEAN) dsum = sqrt(dsum); if(correct_d) // correct -- only since 2016-04 dsum *= (pp / nobs); else dsum *= (nobs / pp); // MM: "fishy" (had note since r4321, 2007-05-01 !) if (jk == 0 || dnull > dsum) { // have new best dnull = dsum; jksky = jk; } } } x[njnb] = (double) jksky + 1;/* 1-indexing */ L220: ; } /* for(i = 0; i < n ..)*/ for (int jk = 0; jk < kk; ++jk) x[nrx[jk] - 1] = (double) jk + 1;/* 1-indexing */ /* mtt[k] := size(k-th cluster) : */ for (int ka = 0; ka < kk; ++ka) { mtt[ka] = 0; for(int i = 0; i < n; i++) { if (((int) x[i]) == ka + 1)/* 1-indexing */ ++mtt[ka]; } } return; } /* end resul() -----------------------------------------------------------*/ // called 'dark()' in ./pam.c void black(int kk, int jpp, int nsam, int *nbest, double *dys, double s, double *x, /* --> Output : */ double *avsyl, double *ttsyl, double *sylinf, /* but the following output vectors are never used by clara() : */ int *ncluv, int *nsend, int *nelem, int *negbr, double *syl, double *srank) { /* Silhouettes computation and "drawing" --> syl[] and sylinf[] */ /* System generated locals */ int sylinf_dim1 = nsam, sylinf_offset = 1 + sylinf_dim1 * 1; /* Parameter adjustments */ --avsyl; --srank; --syl; --negbr; --nelem; --nsend; --ncluv; --nbest; sylinf -= sylinf_offset; /* construction of clustering vector (ncluv) of selected sample (nbest). */ for (int l = 1; l <= nsam; ++l) { ncluv[l] = (int) x[nbest[l] - 1]; } /* "drawing" of the silhouettes */ int nsylr = 0; *ttsyl = 0.; for (int numcl = 1; numcl <= kk; ++numcl) { int ntt = 0, j, l; double dysa, dysb; for (j = 1; j <= nsam; ++j) { if (ncluv[j] == numcl) { ++ntt; nelem[ntt] = j; } } for (j = 1; j <= ntt; ++j) { int nj = nelem[j]; dysb = s * 1.1 + 1.; negbr[j] = -1; for (int nclu = 1; nclu <= kk; ++nclu) { if (nclu != numcl) { int nbb = 0; double db = 0.; for (l = 1; l <= nsam; ++l) { if (ncluv[l] == nclu) { ++nbb; db += dys[ind_2(nj, l)]; } } db /= (double) nbb; if (db < dysb) { dysb = db; negbr[j] = nclu; } } } if (ntt == 1) { syl[j] = 0.; continue /* j */; } dysa = 0.; for (l = 1; l <= ntt; ++l) { int nl = nelem[l]; dysa += dys[ind_2(nj, nl)]; } dysa /= (double) (ntt - 1); if (dysa <= 0.) { if (dysb > 0.) syl[j] = 1.; else syl[j] = 0.; continue /* j */; } if (dysb > 0.) { if (dysb > dysa) syl[j] = 1. - dysa / dysb; else if (dysb < dysa) syl[j] = dysb / dysa - 1.; else /* (dysb == dysa) */ syl[j] = 0.; if (syl[j] < -1.) syl[j] = -1.; else if (syl[j] > 1.) syl[j] = 1.; } else { syl[j] = -1.; } } /* for(j ..) */ avsyl[numcl] = 0.; for (j = 1; j <= ntt; ++j) { int lang = -1/* -Wall */; double symax = -2.; for (l = 1; l <= ntt; ++l) { if (syl[l] > symax) { symax = syl[l]; lang = l; } } nsend[j] = lang; srank[j] = syl[lang]; avsyl[numcl] += srank[j]; syl[lang] = -3.; } *ttsyl += avsyl[numcl]; avsyl[numcl] /= ntt; if (ntt >= 2) { for (l = 1; l <= ntt; ++l) { int lplac = nsend[l]; ++nsylr; sylinf[nsylr + sylinf_dim1 ] = (double) numcl; sylinf[nsylr + (sylinf_dim1 << 1)] = (double) negbr[lplac]; sylinf[nsylr + sylinf_dim1 * 3 ] = srank[l]; sylinf[nsylr + (sylinf_dim1 << 2)] = (double) nbest[nelem[lplac]]; } } else { ++nsylr; sylinf[nsylr + sylinf_dim1 ] = (double) numcl; sylinf[nsylr + (sylinf_dim1 << 1)] = (double) negbr[1]; sylinf[nsylr + sylinf_dim1 * 3 ] = 0.; sylinf[nsylr + (sylinf_dim1 << 2)] = (double) nbest[nelem[1]]; } } /* for( numcl ) */ *ttsyl /= (double) (nsam); return; } /* black */ cluster/src/daisy.c0000644000176200001440000001034714726055031014007 0ustar liggesusers/* Produced by f2c and Martin's f2c-clean,v 1.11 2012/05/04 -- and some pretty editing */ #include #include #include /* -> Rconfig.h, but also Boolean.h RS.h */ /* called _only_ once from ../R/daisy.q currently as .C(cl_daisy, ........) */ void cldaisy(int *nn, int *jpp, double *x, double *valmd, /* valmisdat[1:p] */ double *weights,/* weights[1:p */ int *jtmd, int *jdat, int *vtype, int *ndyst, int *mdata, double *disv) { /* Calculating dissimilarities between objects or variables nn = number of objects jpp = number of variables used for the calculations The following vectors and matrices must be dimensioned in the main program : vtype was character originally vtype(j) is the type of variable j: = 1 (A) for an Asymmetric binary variable = 2 (S) for a Symmetric binary variable = 3 (N) for a Nominal variable = 4 (O) for an Ordinal variable = 5 (I) for an Interval variable (additive) = 6 (T) for a raTio variable (log transformed) ndyst is the "kind of dissimilarity/distance" aka 'diss_type' = 0 "mixed" / gower == here treated _identically_ to "manhattan" (L1) ! = 1 "euclidean" (= L2 ) = 2 "manhattan" (= L1 ) jtmd[ ] is only read if there are missing values : if(mdata) jtmd(j) = 0 if variable j is binary = -1 if variable j is not binary and has missing values = +1 if variable j is not binary and has no missing values */ int x_dim1 = *nn; Rboolean hasna = *mdata != 0; /* calculation of the dissimilarities */ int nlk = 0; if (*jdat == 1) { /* Case I: `mixed' type variables <==> ndyst == 0 */ for (int l = 1; l < *nn; ++l) { for (int k = 0; k < l; ++k) { /* disv(nlk) := d(l,k) := Dissimilarity between obs. l & k := dlk/ppa */ double ppa = 0., dlk = 0.; for (int j = 0; j < *jpp; ++j) { if (vtype[j] >= 3) { if (hasna) { if (jtmd[j] < 0) { if ((x[l + j * x_dim1] == valmd[j]) || (x[k + j * x_dim1] == valmd[j])) { continue; // goto L420; } } } ppa += weights[j]; if (vtype[j] == 3) { /* type = "N"ominal */ if (x[l + j * x_dim1] != x[k + j * x_dim1]) { dlk += weights[j]; } } else { /* type in {"O", "I", "T"} */ dlk += weights[j] * fabs(x[l + j * x_dim1] - x[k + j * x_dim1]); } } else { /* vtype(j) in {1, 2} <---> binary variable x(*,j) */ if((x[l + j * x_dim1] != 0.f && x[l + j * x_dim1] != 1.f) || (x[k + j * x_dim1] != 0.f && x[k + j * x_dim1] != 1.f)) { continue; // goto L420; } if (vtype[j] == 2 || x[l + j * x_dim1] != 0. || x[k + j * x_dim1] != 0.) { ppa += weights[j]; } if (x[l + j * x_dim1] != x[k + j * x_dim1]) { dlk += weights[j]; } } /* L420: -- continue -- */ } // for(j ..) if (ppa == 0.f) { disv[nlk] = -1.; } else { disv[nlk] = dlk / ppa; } ++nlk; } // for( k ..) } // for( l ..) } else { /* Case II : jdat != 1: all variables are interval scaled ------- ~~~~~~~~~ { basically === dysta() in ./dysta.f FIXME: common code! } */ double pp = (double) (*jpp); for (int l = 1; l < *nn; ++l) { for (int k = 0; k < l; ++k) { double clk = 0.; int npres = 0; /* disv(nlk) := d(l,k) := Dissimilarity between obs. l & k */ for (int j = 0; j < *jpp; ++j) { if (hasna) { if (jtmd[j] < 0) { if ((x[l + j * x_dim1] == valmd[j]) || (x[k + j * x_dim1] == valmd[j])) { continue; // goto L530; } } } ++npres; if (*ndyst == 1) { /* euclidean */ clk += (x[l + j * x_dim1] - x[k + j * x_dim1]) * (x[l + j * x_dim1] - x[k + j * x_dim1]); } else { /* manhattan */ clk += fabs(x[l + j * x_dim1] - x[k + j * x_dim1]); } /* L530: ; */ } double rpres = (double) npres; if (npres == 0) { /* all missing */ disv[nlk] = -1.f; } else if (*ndyst == 1) { disv[nlk] = sqrt(clk * (pp / rpres)); } else { disv[nlk] = clk * (pp / rpres); } ++nlk; } // for( k ..) } // for( l ..) } } /* cldaisy */ cluster/src/cluster.h0000644000176200001440000001710314724553316014370 0ustar liggesusers/* Declare everything, Fortran & C -- so we can register them */ #include #include /* -> Rconfig.h, but also Boolean.h RS.h */ #ifdef ENABLE_NLS #include #define _(String) dgettext ("cluster", String) #else #define _(String) (String) #endif // These codes must match those in ../R/clara.q <==> 'diss_kind' typedef enum { EUCLIDEAN = 1, MANHATTAN = 2, JACCARD = 3 , ZJACCARD = 4 , SMATCHING = 5 , GOWER = 6 } DISS_KIND; /* --------- ./clara.c ------------------*/ double randm(int *nrun); void cl_clara(int *n, /* = number of objects */ int *jpp,/* = number of variables */ int *kk, /* = number of clusters, 1 <= kk <= n-1 */ double *x, /* Input: the data x[n, jpp] _rowwise_ (transposed) * Output: the first `n' values are the `clustering' * (integers in 1,2,..,kk) */ int *nran, /* = #{random samples} drawn (= `samples' in R)*/ int *nsam, /* = #{objects} drawn from data set (`sampsize' in R) */ double *dys,/* [1:(1 + (nsam * (nsam - 1))/2)] * Output: to contain the distances */ int *mdata, /*= {0,1}; 1: min(x) is missing value (NA); 0: no NA */ double *valmd,/*[j]= missing value code (instead of NA) for x[,j]*/ int *jtmd, /* [j]= {-1,1}; -1: x[,j] has NA; 1: no NAs in x[,j] */ DISS_KIND *diss_kind, // = {EUCLIDEAN, MANHATTAN, ....} int/*logical*/ *rng_R,/*= {0,1}; 0 : use clara's internal weak RNG; * 1 : use R's RNG (and seed) */ int/*logical*/ *pam_like,/* if (1), we do "swap()" as in pam(), otherwise use the code as it was in clara() "forever" upto 2011-04 */ int *correct_d,/* option for dist.computation: if (0), use the "fishy" formula to update distances in the NA-case, if (1), use a dysta2()-compatible formula */ int *nrepr, /* logical (0/1): 1 = "is representative object" */ int *nsel, int *nbest,/* x[nbest[j],] : the j-th obs in the final sample */ int *nr, int *nrx,/* prov. and final "medoids" aka representatives */ double *radus, double *ttd, double *ratt, double *ttbes, double *rdbes, double *rabes, int *mtt, double *obj, double *avsyl, double *ttsyl, double *sylinf, int *jstop, int *trace_lev, double *tmp, /* = double [ 3 * nsam ] */ int *itmp /* = integer[ 6 * nsam ] */ ); void bswap2(int kk, int nsam, double s, const double dys[], Rboolean pam_like, int trace_lev, // result: double *sky, int *nrepr, double *dysma, double *dysmb, double *beter); void selec(int kk, int n, int jpp, DISS_KIND diss_kind, double *zb, int nsam, Rboolean has_NA, int *jtmd, double *valmd, int trace_lev, int *nrepr, int *nsel, double *dys, double *x, int *nr, Rboolean *nafs, double *ttd, double *radus, double *ratt, int *nrnew, int *nsnew, int *npnew, int *ns, int *np, int *new, double *ttnew, double *rdnew, int correct_d); void resul(int kk, int n, int jpp, DISS_KIND diss_kind, Rboolean has_NA, int *jtmd, double *valmd, double *x, int *nrx, int *mtt, int correct_d); void black(int kk, int jpp, int nsam, int *nbest, double *dys, double s, double *x, /* --> Output : */ double *avsyl, double *ttsyl, double *sylinf, int *ncluv, int *nsend, int *nelem, int *negbr, double *syl, double *srank); /* -------- ./dysta.c --- (dysta.f was in pam.f) -------------------- */ int dysta(int *nn, int *jpp, double *x, double *dys, int *ndyst, int *jtmd, double *valmd); /* --------- ./pam.c ------------------*/ #ifdef _UNUSED_C_pam void cl_pam(int *nn, int *jpp, int *kk, double *x, double *dys, int *jdyss, /* jdyss = 0 : compute distances from x * = 1 : distances provided in x */ double *valmd, int *jtmd, int *ndyst, int *nsend, int *nrepr, int *nelem, double *radus, double *damer, double *ttd, double *separ, double *ttsyl, double *obj, int *med, int *ncluv, double *clusinf, double *sylinf, int *nisol, int* optim); #endif SEXP cl_Pam(SEXP k_, SEXP n_, SEXP do_diss_, /* == !diss; if true, compute distances from x (= x_or_diss); otherwise distances provided by x_or_diss */ SEXP x_or_diss,// this "is" if(do_diss) "x[]" (n x p) else "dys[]" SEXP all_stats_, // all_stats == !cluster.only SEXP medoids, // NULL or integer(k) subset {1:n} SEXP do_swap_, SEXP trace_lev_, SEXP keep_diss_, SEXP pam_once_, // the next 3 are only needed if(do_diss) SEXP val_md, SEXP j_md, // "md" := [m]issing [d]ata SEXP dist_kind); // = 1 ("euclidean") or 2 ("manhattan") void bswap(int kk, int nsam, int *nrepr, /* nrepr[]: here is boolean (0/1): 1 = "is representative object" */ Rboolean med_given, Rboolean do_swap, int trace_lev, double *dysma, double *dysmb, double *beter, const double dys[], double s, double *obj, int pamonce); void cstat(int kk, int nn, int *nsend, int *nrepr, Rboolean all_stats, double *radus, double *damer, double *ttd, double *separ, double *s, double *dys, int *ncluv, int *nelem, int *med, int *nisol); void dark(int kk, int nn, const int ncluv[], const double dys[], double s, int *nsend, int *nelem, int *negbr, double *syl, double *srank, double *avsyl, double *ttsyl, double *sylinf); /* --------- ./spannel.c ------------------*/ void cl_sweep(double *, int *, int *, int *, double *); void spannel(int *ncas, /* = number of objects */ int *ndep, /* = number of variables */ double *dat,/* [ncas, 0:ndep] */ double *dstopt, /* = squared distances [1:ncas] */ double *cov,/* matrix [0:ndep, 0:ndep] */ double *varsum, /* [1:ndep] */ double *varss, /* [1:ndep] */ double *prob, /* [1:ncas] */ double *work, /* [0:ndep] */ double *eps, int *maxit, /* = maximal # iterations (and returns #{iter.})*/ int *ierr); void sildist(double *d, /* distance : in matrix or dist format; i.e., of length n^2 or n*(n-1)/2; see 'ismat' */ int *n, /* number of Subjects (attr(d,'Size')) */ int *clustering,/* clustering vector, values from {1..k} */ int *k, /* number of clusters */ double *diC, /* diC */ int *counts, /* counts[k] := #{cluster k} */ double *si, /* (a_i - b_i) / max(ai,bi) */ int *neighbor, /* neighbor */ int *ismat); /* boolean : is 'd' a matrix or 'dist' ? */ void cl_fanny(int *nn, int *jpp, int *kk, double *x, double *dss, int *jdyss, double *valmd, int *jtmd, int *ndyst, int *nsend, int *nelem, int *negbr, double *syl, double *p, double *dp, double *pt, int *nfuzz, double *esp, double *ef, double *dvec, double *ttsyl, double *obj, int *ncluv, double *sylinf, double *r, double *tol, int *maxit); /* ================= Fortran things (remainder) ======================== */ /* -------- ./daisy.c ---------------------------------- */ void cldaisy(int *nn, int *jpp, double *x, double *valmd, double *weights, int *jtmd, int *jdat, int *vtype, int *ndyst, int *mdata, double *disv); /* -------- ./mona.c ---------------------------------- */ void clmona(int *nn, int *pp, int *x, int *jerr, int *nban, int *ner, int *kwan, int *lava, int *jlack); /* -------- ./twins.c ---------------------------------- */ void R_bncoef(int *nn, double *ban, double *cf); double bncoef(int nn, double *ban); void twins(int *nn, int *jpp, double *x, double *dys, double *dys2, int *jdyss, double *valmd, int *jtmd, int *ndyst, int *jalg, int *method, int *kwan, int *ner, double *ban, double *coef, double *alpha, int *merge, int *trace_lev); cluster/src/dysta.c0000644000176200001440000000340414724553316014025 0ustar liggesusers/* Produced by f2c and Martin's f2c-clean,v 1.11 2012/05/04 -- and some pretty editing */ #include /* Dysta() : Compute Distances from X matrix {also for agnes() and diana()}: ----------------------------------------------------------- was part of pam.f (then called both from Fortran & C) "keep in sync" with daisy.c {now both moved to C} ((*no* longer called from ../tests/dysta-ex.R ...)) */ int dysta(int *nn, int *p, double *x, // [nn x p] matrix double *dys,// length 1 + nn*(nn-1)/2 -- with first entry := 0. (FIXME: drop that) int *ndyst, /* ndyst = 1 : euclidean ; "else"(2) : manhattan */ int *jtmd, double *valmd) { /* VARs Parameter adjustments --- all this just so we can use 1-indexing (FIXME?) */ --valmd; --jtmd; int x_dim1 = *nn, x_offset = 1 + x_dim1; x -= x_offset; int nlk = 0, jhalt = 0; dys[nlk] = 0.; /* -----------== is used potentially for d[i,i] == dys[1] == 0 (FIXME) */ double pp = (double) (*p); for (int l = 2; l <= *nn; ++l) { for (int k = 1; k <= l-1; ++k) { double clk = 0.; ++nlk; int npres = 0; for (int j = 1; j <= *p; ++j) { if (jtmd[j] < 0) { /* some x(*,j) are missing (NA) */ if((x[l + j * x_dim1] == valmd[j]) || (x[k + j * x_dim1] == valmd[j])) continue; // next j } ++npres; if (*ndyst == 1) { clk += (x[l + j * x_dim1] - x[k + j * x_dim1]) * (x[l + j * x_dim1] - x[k + j * x_dim1]); } else { clk += fabs(x[l + j * x_dim1] - x[k + j * x_dim1]); } } double rpres = (double) npres; if (npres == 0) { jhalt = 1; dys[nlk] = -1.; } else if(*ndyst == 1) { dys[nlk] = sqrt(clk * (pp / rpres)); } else { dys[nlk] = clk * (pp / rpres); } } } return jhalt; } /* dysta_ */ cluster/src/pam.c0000644000176200001440000007727414724553316013476 0ustar liggesusers/* * PAM := Partitioning Around Medoids * * original Id: pam.f,v 1.16 2003/06/03 13:40:56 maechler translated by * f2c (version 20031025) and run through f2c-clean,v 1.10 2002/03/28 */ #include #include #include #include /* for diagnostics */ #include /* for interrupting */ #include "cluster.h" #include "ind_2.h" // carries out a clustering using the k-medoid approach SEXP cl_Pam(SEXP k_, SEXP n_, SEXP do_diss_, /* == !diss; if true, compute distances from x (= x_or_diss); otherwise distances provided by x_or_diss */ SEXP x_or_diss,// this "is" if(do_diss) "x[]" (n x p) else "dys[]" SEXP all_stats_, // all_stats == !cluster.only SEXP medoids, // NULL or integer(k) subset {1:n} SEXP do_swap_, SEXP trace_lev_, SEXP keep_diss_, SEXP pam_once_, // the next 3 are only needed if(do_diss) SEXP val_md, SEXP j_md, // "md" := [m]issing [d]ata SEXP diss_kind_) // = 1 ("euclidean") or 2 ("manhattan") { const int kk = asInteger(k_), n = asInteger(n_), pam_once = asInteger(pam_once_), trace_lev = asInteger(trace_lev_); const Rboolean all_stats = asLogical(all_stats_) , med_given = (medoids != R_NilValue) // if true, med[] contain initial medoids , do_diss = asLogical(do_diss_) , do_swap = asLogical(do_swap_) , keep_diss = asLogical(keep_diss_) // only if(keep_diss) return dys[] .. , do_syl = all_stats && (1 < kk && kk < n); #ifdef once_we_get_n_from_args int n, p = NA_INTEGER; if (do_diss) { // <-- was 'jdyss != 1' i.e. jdyss == 0 SEXP dims = getAttrib(x_or_diss, R_DimSymbol); n = INTEGER(dims)[0]; p = INTEGER(dims)[1]; } else { n = asInteger(getAttrib(x_or_diss, install("Size"))); } #endif int i, nhalf; // nhalf := #{distances}+1 = length(dys) double s; if (n % 2 == 0) { // avoid overflow of n * (n - 1) nhalf = n / 2 * (n - 1) + 1; } else { nhalf = (n - 1) / 2 * n + 1; } int *nsend = (int*) R_alloc(n, sizeof(int)) , *nelem = (int*) R_alloc(all_stats ? n : 1, sizeof(int)) /* Rboolean */ , *nrepr = (int*) R_alloc(n, sizeof(int)) , *med ; double *radus = (double*) R_alloc( n, sizeof(double)), *damer = (double*) R_alloc( n, sizeof(double)), *separ = (double*) R_alloc(kk, sizeof(double)); int clusinf_dim1 = kk; if(med_given) { if(TYPEOF(medoids) != INTSXP || LENGTH(medoids) != kk) error(_("Invalid 'medoids'")); PROTECT(medoids = duplicate(medoids)); } else { PROTECT(medoids = allocVector(INTSXP, kk)); } med = INTEGER(medoids); SEXP nms, ans = PROTECT(allocVector(VECSXP, keep_diss ? 9 : 9-1)); setAttrib(ans, R_NamesSymbol, nms = allocVector(STRSXP, keep_diss ? 9 : 9-1)); int nprot = 2; // <- ++ for each PROTECT() below SEXP dys_, avsyl_, obj_, clu_, clusinf_, sylinf_, nisol_,ttsyl_; // these are only used if(do_diss) : double *valmd; int *jtmd; int *diss_kind; if (do_diss) { // <-- was 'jdyss != 1' i.e. jdyss == 0 PROTECT(dys_ = allocVector(REALSXP, nhalf)); nprot++; valmd = REAL(val_md); jtmd = INTEGER(j_md); diss_kind = INTEGER(diss_kind_); // = 1 ("euclidean") or 2 ("manhattan") } else { dys_ = x_or_diss; // a pointer to the same thing } // Creating the SEXPs as list components, so they are auto-PROTECTed: SET_STRING_ELT(nms, 0, mkChar("clu")); SET_VECTOR_ELT(ans, 0, clu_ = allocVector(INTSXP, n)); SET_STRING_ELT(nms, 1, mkChar("med")); SET_VECTOR_ELT(ans, 1, medoids); SET_STRING_ELT(nms, 2, mkChar("silinf")); if(do_syl) SET_VECTOR_ELT(ans, 2, sylinf_ = all_stats ? allocMatrix(REALSXP, n, 4) : allocVector(REALSXP, 1)); SET_STRING_ELT(nms, 3, mkChar("obj")); SET_VECTOR_ELT(ans, 3, obj_ = allocVector(REALSXP, 2)); SET_STRING_ELT(nms, 4, mkChar("isol")); // 'isolation' {0,1,2}: L=1, L*=2 - clusters SET_VECTOR_ELT(ans, 4, nisol_ = allocVector(INTSXP, all_stats ? kk : 1)); SET_STRING_ELT(nms, 5, mkChar("clusinf")); SET_VECTOR_ELT(ans, 5, clusinf_ = all_stats ? allocMatrix(REALSXP, kk, 5) : allocVector(REALSXP, 1)); SET_STRING_ELT(nms, 6, mkChar("avsil")); SET_VECTOR_ELT(ans, 6, avsyl_ = allocVector(REALSXP, n)); SET_STRING_ELT(nms, 7, mkChar("ttsil")); if(do_syl) SET_VECTOR_ELT(ans, 7, ttsyl_ = allocVector(REALSXP, 1)); if(keep_diss) { SET_STRING_ELT(nms, 8, mkChar("dys")); SET_VECTOR_ELT(ans, 8, dys_); } int *ncluv = INTEGER(clu_), *nisol = INTEGER(nisol_); double *dys = REAL(dys_), *avsyl = REAL(avsyl_), *obj = REAL(obj_), *clusinf= REAL(clusinf_); if (do_diss) { // <-- was 'jdyss != 1' i.e. jdyss == 0 double *x = REAL(x_or_diss); SEXP dims = getAttrib(x_or_diss, R_DimSymbol); int p = INTEGER(dims)[1]; if(trace_lev) Rprintf("C pam(): computing %d dissimilarities from %d x %d matrix: ", nhalf, n, p); int jhalt = dysta((int*)&n, &p, x, dys, diss_kind, jtmd, valmd); /* --> ./dysta.c */ if (jhalt != 0) { if(trace_lev) Rprintf(" dysta()-error: jhalt=%d\n", jhalt); UNPROTECT(nprot); return ScalarInteger(jhalt); // i.e., integer error code instead of a named list } // else if(trace_lev) Rprintf("[Ok]\n"); } /* s := max( dys[.] ), the largest distance */ for (i = 1, s = 0.; i < nhalf; ++i) /* dys[0] == 0. not used here */ if (s < dys[i]) s = dys[i]; /* FIXME: work with med[] = (i_1, i_2, ..., i_k) * ----- instead nrepr[] = (b_1, ... b_n) b_i in {0,1} */ for (i = 0; i < n; ++i) nrepr[i] = 0; if(med_given) { /* if true, med[] contain initial medoids */ /* for the moment, translate these to nrepr[] 0/1 : * not assuming that the med[] indices are sorted */ for (int k = 0; k < kk; k++) nrepr[med[k] - 1] = 1; } /* Build + Swap [but no build if(med_given); swap only if(do_swap) : */ bswap(kk, n, nrepr, // <- 3 med_given, do_swap, trace_lev,// <- 6 radus, damer, avsyl, // <- 9 dys, s, obj, // <- 12 pam_once); if(trace_lev) Rprintf("end{bswap()}, "); /* Compute Clustering & STATs if(all_stats): */ cstat(kk, n, nsend, nrepr, all_stats, radus, damer, avsyl, separ, &s, dys, ncluv, nelem, med, nisol); if(trace_lev) Rprintf("end{cstat()}\n"); if(all_stats) { for (int k = 0; k < kk; ++k) { clusinf[k]= (double) nrepr[k]; clusinf[k + clusinf_dim1] = radus[k]; clusinf[k + (clusinf_dim1 << 1)] = avsyl[k]; clusinf[k + clusinf_dim1 * 3] = damer[k]; clusinf[k + (clusinf_dim1 << 2)] = separ[k]; } if (do_syl) { // Compute Silhouette info : double *ttsyl = REAL(ttsyl_), *sylinf = REAL(sylinf_); dark(kk, n, ncluv, dys, s, // --> nsend, nelem, nrepr, radus, damer, avsyl, ttsyl, sylinf); } } UNPROTECT(nprot); return ans; } /* cl_Pam */ /* ----------------------------------------------------------- bswap(): the clustering algorithm in 2 parts: I. build, II. swap */ void bswap(int kk, int n, int *nrepr, Rboolean med_given, Rboolean do_swap, int trace_lev, /* nrepr[]: here is boolean (0/1): 1 = "is representative object" */ double *dysma, double *dysmb, double *beter, const double dys[], double s, double *obj, int pamonce) { int i, j, ij, k,h, dig_n; double sky; /* Parameter adjustments */ --nrepr; --beter; --dysma; --dysmb; if(trace_lev) Rprintf("pam()'s bswap(*, s=%g, pamonce=%d): ", s, pamonce); s = s * 1.1 + 1.;// larger than all dys[] (but DBL_MAX is too large) /* IDEA: when n is large compared to k (= kk), * ---- rather use a "sparse" representation: * instead of boolean vector nrepr[] , use ind_repr <- which(nrepr) !! */ for (i = 1; i <= n; ++i) dysma[i] = s; if(med_given) { if(trace_lev) Rprintf("medoids given; "); /* compute dysma[] : dysma[j] = D(j, nearest_representative) */ for (i = 1; i <= n; ++i) { if (nrepr[i] == 1) for (j = 1; j <= n; ++j) { ij = ind_2(i, j); if (dysma[j] > dys[ij]) dysma[j] = dys[ij]; } } } else { // ====== first algorithm: BUILD. ====================== if(trace_lev) Rprintf("build %d medoids:\n", kk); /* find kk representatives aka medoids : */ for (k = 1; k <= kk; ++k) { R_CheckUserInterrupt(); /* compute beter[i] for all non-representatives: * also find ammax := max_{..} and nmax := argmax_i{beter[i]} ... */ int nmax = -1; /* -Wall */ double ammax, cmd; ammax = 0.; for (i = 1; i <= n; ++i) { if (nrepr[i] == 0) { beter[i] = 0.; for (j = 1; j <= n; ++j) { cmd = dysma[j] - dys[ind_2(i, j)]; if (cmd > 0.) beter[i] += cmd; } if (ammax <= beter[i]) { /* does < (instead of <= ) work too? -- NO! */ ammax = beter[i]; nmax = i; } } } nrepr[nmax] = 1;/* = .true. : found new representative */ if (trace_lev >= 2) Rprintf(" new repr. %d\n", nmax); /* update dysma[] : dysma[j] = D(j, nearest_representative) */ for (j = 1; j <= n; ++j) { ij = ind_2(nmax, j); if (dysma[j] > dys[ij]) dysma[j] = dys[ij]; } } /* output of the above loop: nrepr[], dysma[], ... */ } if(trace_lev) /* >= 2 (?) */ { dig_n = 1+(int) log10(n); // = 1 + floor(log10(n)) Rprintf(" after build: medoids are"); for (i = 1; i <= n; ++i) if(nrepr[i] == 1) Rprintf(" %*d", dig_n, i); if(trace_lev >= 3) { Rprintf("\n and min.dist dysma[1:n] are\n"); for (i = 1; i <= n; ++i) { Rprintf(" %6.3g", dysma[i]); if(i % 10 == 0) Rprintf("\n"); } if(n % 10 != 0) Rprintf("\n"); } else Rprintf("\n"); } else dig_n = 1;// -Wall sky = 0.; for (j = 1; j <= n; ++j) sky += dysma[j]; obj[0] = sky / n; if (do_swap && (kk > 1 || med_given)) { double dzsky; int hbest = -1, nbest = -1, kbest= -1; // -Wall int *medoids, *clustmembership, *clustmembershipb; double *fvect; if(pamonce) { // +1 --> use 1-based indices (as R) medoids = (int*) R_alloc(kk+1, sizeof(int)); clustmembership = (int*) R_alloc(n+1, sizeof(int)); fvect = (double*) R_alloc(n+1, sizeof(double)); for (int k = 1, i = 1; i <= n; ++i) { if (nrepr[i]) { medoids[k] = i; k++; } } } else { // -Wall : clustmembership = medoids = (int*) NULL; clustmembershipb = medoids = (int*) NULL; fvect = (double*) NULL; } int *best_h = NULL; double *best_d = NULL; if (pamonce == 4 || pamonce == 5) { // Schubert and Rousseeuw 2019 FastPAM2 best_h = (int*) R_alloc(kk+1, sizeof(int)); best_d = (double*) R_alloc(kk+1, sizeof(double)); } // Improvement part of Schubert and Rousseeuw 2021 FasterPAM double *remove_loss = NULL; if (pamonce >= 3 && pamonce <= 6) { remove_loss = (double*) R_alloc(kk+1, sizeof(double)); clustmembershipb = (int*) R_alloc(n+1, sizeof(int)); } /* ====== second algorithm: SWAP. ====== */ /* Hmm: In the following, we RE-compute dysma[]; * don't need it first time; then only need *update* after swap */ // Used by FasterPAM only (Schubert and Rousseeuw 2021, pamonce = 6) int lastswap = 0; /*-- Loop : */ L60: if(pamonce == 0) { // original algorithm for (j = 1; j <= n; ++j) { /* dysma[j] := D_j d(j, ) [KR p.102, 104] * dysmb[j] := E_j d(j, <2-nd cl.medi>) [p.103] */ dysma[j] = s; dysmb[j] = s; for (i = 1; i <= n; ++i) { if (nrepr[i]) { ij = ind_2(i, j); if (dysma[j] > dys[ij]) { dysmb[j] = dysma[j]; dysma[j] = dys[ij]; } else if (dysmb[j] > dys[ij]) { dysmb[j] = dys[ij]; } } } } } else if (pamonce >= 3 && pamonce <= 6) { // Schubert and Rousseeuw 2019 FastPAM1/2 for (j = 1; j <= n; ++j) { /* dysma[j] := D_j d(j, ) [KR p.102, 104] * dysmb[j] := E_j d(j, <2-nd cl.medi>) [p.103] */ double dysmaj = s, dysmbj = s; for(k = 1; k <= kk; k++) { double dysij = dys[ind_2(medoids[k], j)]; if (dysmaj > dysij) { clustmembershipb[j] = clustmembership[j]; dysmbj = dysmaj; clustmembership[j] = k; // Use medoid k, not i dysmaj = dysij; } else if (dysmbj > dysij) { clustmembershipb[j] = k; dysmbj = dysij; } } dysma[j] = dysmaj; dysmb[j] = dysmbj; } } else { // pamonce == 1 or == 2 : for (j = 1; j <= n; ++j) { /* dysma[j] := D_j d(j, ) [KR p.102, 104] * dysmb[j] := E_j d(j, <2-nd cl.medi>) [p.103] */ dysma[j] = s; dysmb[j] = s; for(k = 1; k <= kk; k++) { i = medoids[k]; ij = ind_2(i, j); if (dysma[j] > dys[ij]) { //store cluster membership clustmembership[j] = i; dysmb[j] = dysma[j]; dysma[j] = dys[ij]; } else if (dysmb[j] > dys[ij]) { dysmb[j] = dys[ij]; } } } } // FasterPAM improvement: do not recompute the nearest, but update it in the end as necessary L60b: dzsky = 1.; /* 1 is arbitrary > 0; only dzsky < 0 matters in the end */ if(pamonce == 0) { // original algorithm for (h = 1; h <= n; ++h) if (!nrepr[h]) { R_CheckUserInterrupt(); for (i = 1; i <= n; ++i) if (nrepr[i]) { double dz = 0.; /* dz := T_{ih} := sum_j C_{jih} [p.104] : */ for (j = 1; j <= n; ++j) { /* if (!nrepr[j]) { */ int hj = ind_2(h, j); ij = ind_2(i, j); if (dys[ij] == dysma[j]) { double small = dysmb[j] > dys[hj] ? dys[hj] : dysmb[j]; dz += (- dysma[j] + small); } else if (dys[hj] < dysma[j]) /* 1c. */ dz += (- dysma[j] + dys[hj]); } if (dzsky > dz) { dzsky = dz; /* dzsky := min_{i,h} T_{i,h} */ hbest = h; nbest = i; } } } } else if (pamonce == 1 || pamonce == 2) { for(k = 1; k <= kk; k++) { R_CheckUserInterrupt(); i=medoids[k]; double removeCost = 0.; //Compute cost for removing the medoid for (j = 1; j <= n; ++j) { if(clustmembership[j] == i) { removeCost+=(dysmb[j]-dysma[j]); fvect[j]=dysmb[j]; } else{ fvect[j]=dysma[j]; } } if (pamonce == 1) { // Now check possible new medoids h for (h = 1; h <= n; ++h) if (!nrepr[h]) { double addGain = removeCost; // Compute gain of adding h as a medoid: for (j = 1; j <= n; ++j) { int hj = ind_2(h, j); if(dys[hj] < fvect[j]) addGain += (dys[hj]-fvect[j]); } if (dzsky > addGain) { dzsky = addGain; /* dzsky := min_{i,h} T_{i,h} */ hbest = h; nbest = i; kbest = k; } } } else { // pamonce == 2 : // Now check possible new medoids h for (h = 1; h <= n; ++h) if (!nrepr[h]) { double addGain = removeCost - fvect[h]; // - fvect[h] since dys[h,h]=0; // Compute gain of adding h as a medoid: int ijbase = (h-2)*(h-1)/2; for (j = 1; j < h; ++j) { int hj = ijbase+j; if(dys[hj] < fvect[j]) addGain += (dys[hj]-fvect[j]); } ijbase += h;// = (h-2)*(h-1)/2 + h for (j = h+1; j <= n; ++j) { ijbase += j-2; if(dys[ijbase] < fvect[j]) addGain += (dys[ijbase]-fvect[j]); } if (dzsky > addGain) { dzsky = addGain; /* dzsky := min_{i,h} T_{i,h} */ hbest = h; nbest = i; kbest = k; } } } } } else if (pamonce >= 3 && pamonce <= 6) { // Schubert and Rousseeuw variants // cost of removing current medoids for(k = 1; k <= kk; k++) remove_loss[k] = 0; for (j = 1; j <= n; ++j) remove_loss[clustmembership[j]] += dysmb[j] - dysma[j]; if (pamonce == 3) { // Schubert and Rousseeuw 2019 FastPAM1 -- improved 2021 version // Now check possible new medoids h for (h = 1; h <= n; ++h) if (!nrepr[h]) { R_CheckUserInterrupt(); for(k = 1; k <= kk; k++) beter[k] = 0; double acc = 0; // Compute gain of substituting h for each other medoid: for (j = 1; j <= n; ++j) { double dist_h = dys[ind_2(h, j)]; // New medoid int memb = clustmembership[j]; // Medoid nr of nearest double distcur = dysma[j]; // Nearest double distsec = dysmb[j]; // Second nearest // New medoid is new best: if (dist_h < distcur) { acc += dist_h - distcur; beter[memb] += distcur - distsec; } else if (dist_h < distsec) { beter[memb] += dist_h - distsec; } } for(k = 1; k <= kk; k++) { double loss = beter[k] + acc + remove_loss[k]; if (loss < dzsky) { dzsky = loss; hbest = h; nbest = medoids[k]; kbest = k; } } } } else if (pamonce == 4) { // Schubert and Rousseeuw 2019 FastPAM2 for(k = 1; k <= kk; k++) { best_d[k] = 1.; // arbitrary > 0 } // Now check possible new medoids h for (h = 1; h <= n; ++h) if (!nrepr[h]) { R_CheckUserInterrupt(); for(k = 1; k <= kk; k++) beter[k] = 0; // Compute gain of substituting h for each other medoid: double acc = 0; for (j = 1; j <= n; ++j) { double dist_h = dys[ind_2(h, j)]; // New medoid int memb = clustmembership[j]; // Medoid nr of nearest double distcur = dysma[j]; // Nearest double distsec = dysmb[j]; // Second nearest // New medoid is new best: if (dist_h < distcur) { acc += dist_h - distcur; beter[memb] += distcur - distsec; } else if (dist_h < distsec) { beter[memb] += dist_h - distsec; } } for(k = 1; k <= kk; k++) { double loss = beter[k] + acc + remove_loss[k]; if (loss < best_d[k]) { best_d[k] = loss; best_h[k] = h; } } } // Pick one best medoid at the end (additional swaps come later). for(k = 1; k <= kk; k++) { if (best_d[k] < dzsky) { dzsky = best_d[k]; kbest = k; } } hbest = best_h[kbest]; nbest = medoids[kbest]; } else if (pamonce == 5) { // Schubert and Rousseeuw 2019 FastPAM2, // with linearized memory access as in Reynolds 2 for(k = 1; k <= kk; k++) { best_d[k] = 1.; // arbitrary > 0 } // Now check possible new medoids h for (h = 1; h <= n; ++h) if (!nrepr[h]) { R_CheckUserInterrupt(); for(k = 1; k <= kk; k++) beter[k] = 0; double acc = -dysma[h]; beter[clustmembership[h]] = dysma[h] - dysmb[h]; // Compute gain of substituting h for each other medoid: int ijbase = (h-2)*(h-1)/2; for (j = 1; j < h; ++j) { double dist_h = dys[ijbase+j]; // New medoid int memb = clustmembership[j]; // Medoid nr of nearest double distcur = dysma[j]; // Nearest double distsec = dysmb[j]; // Second nearest // New medoid is new best: if (dist_h < distcur) { acc += dist_h - distcur; beter[memb] += distcur - distsec; } else if (dist_h < distsec) { beter[memb] += dist_h - distsec; } } ijbase += h;// = (h-2)*(h-1)/2 + h for (j = h+1; j <= n; ++j) { ijbase += j-2; double dist_h = dys[ijbase]; // New medoid int memb = clustmembership[j]; // Medoid nr of nearest double distcur = dysma[j]; // Nearest double distsec = dysmb[j]; // Second nearest // New medoid is new best: if (dist_h < distcur) { acc += dist_h - distcur; beter[memb] += distcur - distsec; } else if (dist_h < distsec) { beter[memb] += dist_h - distsec; } } for(k = 1; k <= kk; k++) { double loss = beter[k] + acc + remove_loss[k]; if (loss < best_d[k]) { best_d[k] = loss; best_h[k] = h; } } } // Pick one best medoid at the end (additional swaps come later). for(k = 1; k <= kk; k++) { if (best_d[k] < dzsky) { dzsky = best_d[k]; kbest = k; } } hbest = best_h[kbest]; nbest = medoids[kbest]; } else { // Schubert and Rousseeuw, 2021, FasterPAM // Check possible new medoids h // Beginning at the last swap performed int h2 = 1; for (h = lastswap + 1; h2 <= n; ++h, ++h2) { if (h == n+1) h = 1; // wrap around if (nrepr[h]) continue; R_CheckUserInterrupt(); for(k = 1; k <= kk; k++) beter[k] = 0; double acc = -dysma[h]; beter[clustmembership[h]] += dysma[h] - dysmb[h]; // Compute gain of substituting h for each other medoid: int ijbase = (h-2)*(h-1)/2; for (j = 1; j < h; ++j) { double dist_h = dys[ijbase+j]; // New medoid int memb = clustmembership[j]; // Medoid nr of nearest double distcur = dysma[j]; // Nearest double distsec = dysmb[j]; // Second nearest // New medoid is new best: if (dist_h < distcur) { acc += dist_h - distcur; beter[memb] += distcur - distsec; } else if (dist_h < distsec) { beter[memb] += dist_h - distsec; } } ijbase += h;// = (h-2)*(h-1)/2 + h for (j = h+1; j <= n; ++j) { ijbase += j-2; double dist_h = dys[ijbase]; // New medoid int memb = clustmembership[j]; // Medoid nr of nearest double distcur = dysma[j]; // Nearest double distsec = dysmb[j]; // Second nearest // New medoid is new best: if (dist_h < distcur) { acc += dist_h - distcur; beter[memb] += distcur - distsec; } else if (dist_h < distsec) { beter[memb] += dist_h - distsec; } } for(k = 1; k <= kk; k++) { double loss = beter[k] + acc + remove_loss[k]; if (loss < dzsky) { dzsky = loss; hbest = h; nbest = medoids[k]; kbest = k; } } // Execute the first swap found. if (dzsky < 0) { break; } } } } else { Rprintf("Invalid pamonce value: %d\n", pamonce); return; } if (dzsky < - 16*DBL_EPSILON * fabs(sky)) { // basically " < 0 ", // but ' < 0 ' gave infinite loop, swapping the identical objects // found an improving swap if(trace_lev >= 2) Rprintf( " swp new %*d <-> %*d old; decreasing diss. %7g by %g\n", dig_n, hbest, dig_n, nbest, sky, dzsky); nrepr[hbest] = 1; nrepr[nbest] = 0; if(pamonce) medoids[kbest]=hbest; if(pamonce == 6) lastswap = hbest; sky += dzsky; if (pamonce == 3 || pamonce == 6) { // FasterPAM improvement, Schubert and Rousseeuw 2021 // Update dysma, dysmb rather than recomputing it double newloss = 0; for (j = 1; j <= n; ++j) { /* dysma[j] := D_j d(j, ) [KR p.102, 104] * dysmb[j] := E_j d(j, <2-nd cl.medi>) [p.103] */ double dnew = dys[ind_2(hbest, j)]; if (clustmembership[j] == kbest) { if (dnew < dysmb[j]) { // Clustmembership already kbest dysma[j] = dnew; } else { double dysmaj = s, dysmbj = s; for(k = 1; k <= kk; k++) { double dysij = dys[ind_2(medoids[k], j)]; if (dysmaj > dysij) { clustmembershipb[j] = clustmembership[j]; dysmbj = dysmaj; //store cluster membership clustmembership[j] = k; // Use medoid k, not i dysmaj = dysij; } else if (dysmbj > dysij) { clustmembershipb[j] = k; // Use medoid k, not i dysmbj = dysij; } } dysma[j] = dysmaj; dysmb[j] = dysmbj; } } else { if (dnew < dysma[j]) { clustmembershipb[j] = clustmembership[j]; // not kbest dysmb[j] = dysma[j]; clustmembership[j] = kbest; // Use medoid k, not i dysma[j] = dnew; } else if (clustmembershipb[j] == kbest) { double dysmaj = s, dysmbj = s; for(k = 1; k <= kk; k++) { double dysij = dys[ind_2(medoids[k], j)]; if (dysmaj > dysij) { clustmembershipb[j] = clustmembership[j]; dysmbj = dysmaj; //store cluster membership clustmembership[j] = k; // Use medoid k, not i dysmaj = dysij; } else if (dysmbj > dysij) { clustmembershipb[j] = k; // Use medoid k, not i dysmbj = dysij; } } dysma[j] = dysmaj; dysmb[j] = dysmbj; } else if (dnew < dysmb[j]) { clustmembershipb[j] = kbest; // Use medoid k, not i dysmb[j] = dnew; } } newloss += dysma[j]; } sky = newloss; // more accurate than accumulating changes goto L60b; } // FastPAM2, Schubert and Rousseeuw 2019 if (pamonce == 4 || pamonce == 5) do { best_d[kbest] = 1; // Deactivate // Find next best: dzsky = 1; for(k = 1; k <= kk; k++) { if (best_d[k] < dzsky) { dzsky = best_d[k]; kbest = k; } } hbest = best_h[kbest]; nbest = medoids[kbest]; if(dzsky >= - 16*DBL_EPSILON * fabs(sky)) break; // else try more : // FIXME: duplicated code from above - update stats. for (j = 1; j <= n; ++j) { /* dysma[j] := D_j d(j, ) [KR p.102, 104] * dysmb[j] := E_j d(j, <2-nd cl.medi>) [p.103] */ dysma[j] = s; dysmb[j] = s; for(k = 1; k <= kk; k++) { i = medoids[k]; ij = ind_2(i, j); if (dysma[j] > dys[ij]) { //store cluster membership clustmembership[j] = k; // Use medoid k, not i dysmb[j] = dysma[j]; dysma[j] = dys[ij]; } else if (dysmb[j] > dys[ij]) { dysmb[j] = dys[ij]; } } } // Recompute dzsky value, again. dzsky = 0; for (j = 1; j <= n; ++j) { /* if (!nrepr[j]) { */ int hj = ind_2(hbest, j); ij = ind_2(nbest, j); if (dys[ij] == dysma[j]) { dzsky += (- dysma[j] + fmin2(dysmb[j], dys[hj]) ); } else if (dys[hj] < dysma[j]) /* 1c. */ dzsky += (- dysma[j] + dys[hj]); } if(dzsky >= - 16*DBL_EPSILON * fabs(sky)) break; // else try more : if(trace_lev >= 2) Rprintf( " fswp new %*d <-> %*d old; decreasing diss. %7g by %g\n", dig_n, hbest, dig_n, nbest, sky, dzsky); nrepr[hbest] = 1; nrepr[nbest] = 0; medoids[kbest]=hbest; sky += dzsky; } while(1); // (pamonce = 4 or 5) goto L60; } } obj[1] = sky / n; } /* bswap */ /* ----------------------------------------------------------- cstat(): Compute STATistics (numerical output) concerning each partition */ void cstat(int kk, int nn, int *nsend, int *nrepr, Rboolean all_stats, double *radus, double *damer, double *avsyl, double *separ, double *s, double *dys, int *ncluv, int *nelem, int *med, int *nisol) { int j, k, ja, jk, nplac, ksmal = -1/* -Wall */; double ss = *s * 1.1 + 1.; /* Parameter adjustments */ --ncluv; --nrepr; --nsend; /* nsend[j] := i, where x[i,] is the medoid to which x[j,] belongs */ for (j = 1; j <= nn; ++j) { if (nrepr[j] == 0) { double dsmal = ss; for (k = 1; k <= nn; ++k) { if (nrepr[k] == 1) { int kj_ = ind_2(k, j); if (dsmal > dys[kj_]) { dsmal = dys[kj_]; ksmal = k; } } } nsend[j] = ksmal; } else { nsend[j] = j; } } /* ncluv[j] := k , the cluster number (k = 1..kk) */ jk = 1; nplac = nsend[1]; for (j = 1; j <= nn; ++j) { ncluv[j] = 0; if (nsend[j] == nplac) ncluv[j] = 1; } for (ja = 2; ja <= nn; ++ja) { nplac = nsend[ja]; if (ncluv[nplac] == 0) { ++jk; for (j = 2; j <= nn; ++j) { if (nsend[j] == nplac) ncluv[j] = jk; } if (jk == kk) break; } } if(all_stats) { /* analysis of the clustering. */ /* int numl; */ --avsyl; // <-> [1]-indexing --damer; --med; --nelem; --nisol; --radus; --separ; for (k = 1; k <= kk; ++k) { int ntt = 0, m = -1/* -Wall */; double ttt = 0.; radus[k] = -1.; R_CheckUserInterrupt(); for (j = 1; j <= nn; ++j) { if (ncluv[j] == k) { double djm; ++ntt; m = nsend[j]; nelem[ntt] = j; djm = dys[ind_2(j, m)]; ttt += djm; if (radus[k] < djm) radus[k] = djm; } } if(ntt == 0) error(_("pam(): Bug in C level cstat(), k=%d: ntt=0"), k); avsyl[k] = ttt / ntt; med[k] = m; } if (kk == 1) { damer[1] = *s; nrepr[1] = nn; nisol[1] = 0; separ[1] = 0.; return; } /* ELSE kk > 1 : */ /* numl = number of L-clusters. */ /* numl = 0; */ for (k = 1; k <= kk; ++k) { /* identification of cluster k: nelem= vector of object indices, nel = number of objects */ int nel = 0; R_CheckUserInterrupt(); for (j = 1; j <= nn; ++j) { if (ncluv[j] == k) { ++nel; nelem[nel] = j; } } nrepr[k] = nel; if (nel == 1) { int nvn = nelem[1]; damer[k] = 0.; separ[k] = ss; for (j = 1; j <= nn; ++j) { if (j != nvn) { int mevj = ind_2(nvn, j); if (separ[k] > dys[mevj]) separ[k] = dys[mevj]; } } /* Is cluster k 1) an L-cluster or 2) an L*-cluster ? */ /* if (separ[k] == 0.) */ /* ++numl; */ } else { /* nel != 1 : */ double dam = -1., sep = ss; Rboolean kand = TRUE; for (ja = 1; ja <= nel; ++ja) { int jb, nvna = nelem[ja]; double aja = -1., ajb = ss; for (jb = 1; jb <= nn; ++jb) { int jndz = ind_2(nvna, jb); if (ncluv[jb] == k) { if (aja < dys[jndz]) aja = dys[jndz]; } else { if (ajb > dys[jndz]) ajb = dys[jndz]; } } if (kand && aja >= ajb) kand = FALSE; if (dam < aja) dam = aja; if (sep > ajb) sep = ajb; } separ[k] = sep; damer[k] = dam; if (kand) { /* ++numl; */ if (dam >= sep) /* L-cluster */ nisol[k] = 1; else/* L*-cluster */ nisol[k] = 2; continue /* k */; } } /* nel = 1 or (!kand) : */ nisol[k] = 0; }/* for(k) */ } /* all_stats */ } /* cstat */ /* ----------------------------------------------------------- Compute Silhouette Information : */ void dark( // input: int kk, int nn, const int ncluv[], const double dys[], double s, // output: int *nsend, int *nelem, int *negbr, double *syl, double *srank, double *avsyl, double *ttsyl, double *sylinf) { int k, nsylr; /* pointers to sylinf[] columns -- sylinf[nn, 4] : */ double *sylinf_2, *sylinf_3, *sylinf_4; sylinf_2 = sylinf + nn; sylinf_3 = sylinf_2 + nn; sylinf_4 = sylinf_3 + nn; /* Parameter adjustments */ --avsyl; --ncluv; nsylr = 0; *ttsyl = 0.; for (k = 1; k <= kk; ++k) { /* nelem[0:(ntt-1)] := indices (1-based) of obs. in cluster k : */ int j,l, ntt = 0; for (j = 1; j <= nn; ++j) { if (ncluv[j] == k) { nelem[ntt] = j; ++ntt; } } for (j = 0; j < ntt; ++j) {/* (j+1)-th obs. in cluster k */ int k_, nj = nelem[j]; double dysb = s * 1.1 + 1.; negbr[j] = -1; /* for all clusters k_ != k : */ for (k_ = 1; k_ <= kk; ++k_) if (k_ != k) { double db = 0.; int nbb = 0; for (l = 1; l <= nn; ++l) if (ncluv[l] == k_) { ++nbb; if (l != nj) db += dys[ind_2(nj, l)]; } db /= nbb; /* now db(k_) := mean( d[j, l]; l in C_{k_} ) */ if (dysb > db) { dysb = db; negbr[j] = k_; } }/* negbr[j] := arg max_{k_} db(k_) */ if (ntt > 1) { double dysa = 0.; for (l = 0; l < ntt; ++l) { int nl = nelem[l]; if (nj != nl) dysa += dys[ind_2(nj, nl)]; } dysa /= ntt - 1; if (dysa > 0.) { if (dysb > 0.) { if (dysb > dysa) syl[j] = 1. - dysa / dysb; else if (dysb < dysa) syl[j] = dysb / dysa - 1.; else /* dysb == dysa: */ syl[j] = 0.; if (syl[j] < -1.) syl[j] = -1.; else if (syl[j] > 1.) syl[j] = 1.; } else { syl[j] = -1.; } } else /* dysa == 0 */ if (dysb > 0.) syl[j] = 1.; else syl[j] = 0.; } else { /* ntt == 1: */ syl[j] = 0.; } } /* for( j ) */ avsyl[k] = 0.; if (ntt == 0) /* this can happen when medoids are user-specified !*/ continue; /* next k */ for (j = 0; j < ntt; ++j) { int lang=-1 /*Wall*/; double symax = -2.; for (l = 0; l < ntt; ++l) { if (symax < syl[l]) { symax = syl[l]; lang = l; } } nsend[j] = lang; srank[j] = symax; /* = syl[lang] */ avsyl[k] += srank[j]; syl[lang] = -3.; } *ttsyl += avsyl[k]; avsyl[k] /= ntt; if (ntt == 1) { sylinf [nsylr] = (double) k; sylinf_2[nsylr] = (double) negbr[0]; sylinf_3[nsylr] = 0.; sylinf_4[nsylr] = (double) nelem[0]; ++nsylr; } else { for (j = 0; j < ntt; ++j) { int lplac = nsend[j]; sylinf [nsylr] = (double) k; sylinf_2[nsylr] = (double) negbr[lplac]; sylinf_3[nsylr] = srank[j]; sylinf_4[nsylr] = (double) nelem[lplac]; ++nsylr; } } } /* for (k) */ *ttsyl /= nn; } /* dark */ cluster/src/mona.c0000644000176200001440000001615514700006373013630 0ustar liggesusers/* MONothetic Analysis --- MONA Program for divisive hierarchical clustering of binary data, using association analysis. */ /* mona.f -- translated by f2c (version 20031025). Source for libf2c is in /netlib/f2c/libf2c.zip, e.g., http://www.netlib.org/f2c/libf2c.zip Further transformed by $Id: f2c-clean,v 1.11 2012/05/04 19:34:33 maechler Exp $ */ #include // #include #include /* for diagnostics */ #include /* for interrupting */ // iabs(j) = |j| static int iabs(int j) { return (j >= 0) ? (j) : -(j); } void clmona(int *nn, // = number of objects int *pp, // = number of variables int *x, /* x[i,j]: binary (0/1/NA) data (obs. i, var.j) where NA = missing values, are all values > 1 ; actually are NA == 2 when called from R's mona() */ // int jerr[1] : verbose(ness) in {0, 1, ..} // Result / Output / Return Values: int *jerr, // error return code in {1,2,3,4,5} int *nban, // [1:nn] int *ner, // [1:nn] int *kwan, // [1:nn] int *lava, // [1:nn] int *jlack)// [1:pp] : jlack[j] := #{NA's in x[,j]} { int verbose = jerr[0]; int j, j0, j1, jnat, jma = -1, jtel = -1, jtelz = -1, lama; /* Parameter adjustments */ --lava; --kwan; --ner; --nban; --jlack; int x_dim1 = *nn, x_offset = 1 + x_dim1; x -= x_offset; #define X(i,j) x[i + j * x_dim1] /* Function Body */ if(*pp < 2) { *jerr = 5; return; // not implemented currently (patches welcome!) } const int nhalf = (*nn + 1) / 2; // jptwe = (*pp + 4) / 5; Rboolean has_NA = FALSE; for (int l = 1; l <= *nn; ++l) { int n_miss = 0; for (j = 1; j <= *pp; ++j) { if (X(l,j) > 1) ++n_miss; } if (n_miss == *pp) { // all variables missing for this object *jerr = 1; return; } if(n_miss) { has_NA = TRUE; break; } } if (has_NA) { // -------------- Missing Values Treatment ----------- int lack = 0; for (j = 1; j <= *pp; ++j) { j0 = 0; j1 = 0; for (int l = 1; l <= *nn; ++l) { if (X(l,j) == 0) ++j0; else if (X(l,j) == 1) ++j1; } jlack[j] = *nn - j0 - j1; if (jlack[j] != 0) { ++lack; } if (jlack[j] >= nhalf) { // at least 50% of the objects have missing values for this variable *jerr = 2; return; } if (j0 == 0 || j1 == 0) { // all non missing values are identical for this variable *jerr = 3; return; } } if (lack == *pp) { /* all variables have missing values */ *jerr = 4; return; } /* ---------- Filling in missing values --------------------- */ for (j = 1; j <= *pp; ++j) if (jlack[j] != 0) { lama = -1; Rboolean syn = TRUE; for (int ja = 1; ja <= *pp; ++ja) if (jlack[ja] == 0) { /* no missing in x[, ja] */ int a = 0, b = 0, c = 0, d = 0; for (int k = 1; k <= *nn; ++k) { if (X(k,j) != 1) { if (X(k,ja) == 0) ++a; else if (X(k,ja) == 1) ++b; } else { // x[...] == 1 if (X(k,ja) == 0) ++c; else if (X(k,ja) == 1) ++d; } } int kal = a * d - b * c, kalf = iabs(kal); if (kalf >= lama) { lama = kalf; jma = ja; if (kal < 0) syn = FALSE; } } for (int k = 1; k <= *nn; ++k) if (X(k,j) > 1) { // missing if (syn) { X(k,j) = X(k,jma); } else { if (X(k,jma) == 1) X(k,j) = 0; if (X(k,jma) == 0) X(k,j) = 1; } } } } /* --- end of treating missing values ---- */ *jerr = 0; // it may have had "verbose" /* initialization --------------------------- */ for (int k = 1; k <= *nn; ++k) { kwan[k] = 0; ner[k] = k; lava[k] = 0; } int npass = 1; // number of passes kwan[1] = *nn; /* algorithm -------------------------------- */ int nclu = 1; int ka = 1; /* --- Loop --- */ L310: R_CheckUserInterrupt(); // (had infinite loop whenever pp == 1 !) int kb = ka + kwan[ka] - 1; if(verbose) Rprintf("Loop npass = %d: (ka,kb) = (%d,%d)\n", npass, ka, kb); lama = -1; jnat = *pp; for (j = 1; j <= *pp; ++j) { if (nclu == 1) { goto L330; // jump *inside* if(.) .. hmm... } j0 = 0; j1 = 0; for (int k = ka; k <= kb; ++k) { int n_k = ner[k]; if (X(n_k,j) == 0) ++j0; else if (X(n_k,j) == 1) ++j1; } if (j1 != 0 && j0 != 0) { L330: --jnat; int a = 0, b = 0, c = 0, d = 0, lams = 0; for (int jb = 1; jb <= *pp; ++jb) { if (jb != j) { // FIXME: if (p == 1) have j == jb == 1 here // then this branch is never used ==> lama = -1 < lams = 0 // but (a,b,c,d) will we remain unitialized // -Wall in Fortran did make us intialize them to 0 a = 0; b = 0; c = 0; d = 0; for (int k = ka; k <= kb; ++k) { int n_k = ner[k]; if (X(n_k,j) == 0) { if (X(n_k,jb) == 0) ++a; else if (X(n_k,jb) == 1) ++b; } else { if (X(n_k,jb) == 0) ++c; else if (X(n_k,jb) == 1) ++d; } } lams += iabs(a * d - b * c); } } if (lama < lams) { lama = lams; jtel = c + d; jtelz = a + b; jma = j; } } } // end -- for(j in 1:p) if(verbose) Rprintf(" for(j ..) -> jma=%d, jtel(.,z) = (%d, %d)", jma, jtel, jtelz); if (jnat < *pp) { // ---- Splitting ------------------------------- int nzf, jtel2, // L375: nel = ner[ka]; if (X(nel,jma) == 1) { nzf = 0; jtel2 = jtel; } else { nzf = 1; jtel2 = jtelz; } int jres = kb - ka + 1 - jtel2, km = ka + jtel2; if(verbose) Rprintf(" --> splitting: ka=%d, ner[ka]=%d => (nzf, jtel2, jres, km) = (%d, %d, %d, %d)\n", ka, nel, nzf, jtel2, jres, km); /*------- inner loop ------------------ */ if(verbose >= 2) Rprintf(" inner loop: for(k in ka:km) use ner[k]: "); int k = ka, n_b = 0; do { // L378: almost for(k=ka; k < km; ++k) (but see 'continue' below) int n_k = ner[k]; if(verbose >= 2) Rprintf(" %d", n_k); if (X(n_k,jma) == nzf) { int c = 0; for (int b = k; b <= kb; ++b) { n_b = ner[b]; if (X(n_b,jma) != nzf) { c = b - 1; break; // goto L382; } } // L382: for (int a = k; a <= c; ++a) { int d = c + k - a; ner[d + 1] = ner[d]; } ner[k] = n_b; continue; // the inner loop _without_ increasing 'k' ! } ++k; } while (k < km); if(verbose >= 2) Rprintf(" -> 'nelbb' = n_b = %d\n", n_b); /*------- end{inner loop} -- */ /* L390: */ ++nclu; nban[km] = npass; kwan[ka] = jtel2; kwan[km] = jres; lava[km] = jma; ka += kwan[ka]; } else { // jnat == *pp if(verbose) Rprintf(" --> _NO_ splitting\n"); kwan[ka] = -kwan[ka]; } if(verbose) Rprintf(" --> nclu = %d, kwan[ka] = %d\n", nclu, kwan[ka]); // L400: if (kb == *nn) { goto L500; } do {// L410: ka += iabs(kwan[ka]); if (ka > *nn) { goto L500; } } while (kwan[ka] < 2); goto L310; //-----------> Loop L500: ++npass; for (ka = 1; ka <= *nn; ++ka) { if (kwan[ka] >= 2) { if(verbose) Rprintf("L500; found kwan[%d] = %d >= 2 ==> Loop again\n", ka, kwan[ka]); goto L310; //-----------> Loop } } return; } /* clmona_ */ cluster/ChangeLog0000644000176200001440000014545613467043541013533 0ustar liggesusers2014-03-27 Martin Maechler * NOTE: All newer changes are summarized in the NEWS file (./inst/NEWS.Rd) and detailed & timestamped in the svn logs. 2014-03-26 Martin Maechler * DESCRIPTION (Version): 1.15.2 * R/*.q updates to make messages translatable; proposed by Lukasz Daniel 2014-03-12 Martin Maechler * DESCRIPTION (Version): 1.15.1 * man/mona.Rd: anyNA2[cbind(, )] <- NA fails in R < 3.0.x 2013-11-06 Martin Maechler * DESCRIPTION (Version): 1.15.0; also using Authors@R * R/agnes.q (agnes): method "gaverage" contributed by Pierre Roudier. 2013-03-26 Martin Maechler * DESCRIPTION (Version): 1.14.5, never released 2013-03-26 Martin Maechler * DESCRIPTION (Version): 1.14.4, released to CRAN, 2013-03-26 * po/R-de.po: trivial update from Detlef, 2012-02-06 Martin Maechler * DESCRIPTION (Version): 1.14.2, released to CRAN today * R/clusGap.R (maxSE): with 5 methods to compute "maximal gap", used also in print() method. 2012-01-21 Martin Maechler * R/clusGap.R (print.clusGap, plot.clusGap): added 2012-01-17 Martin Maechler * R/clusGap.R: new clusGap() for computing the cluster gap statistic. 2011-12-21 Martin Maechler * R/coef.R (coefHier): newly export coefHier(), interfacing to C's bncoef(). * tests/diana-boots.R (dianaBoot): add a "bootstrap", for considerably more tests. * tests/diana-ex.R: reorganized * src/twins.c: newly translated from Fortran, for more future flexibility * src/twins.f: no longer there * R/agnes.q (as.dendrogram.twins): define for 'twins' rather than just 'agnes'. 2011-12-03 Martin Maechler * R/plotpart.q (clusplot.default): xlab, and ylab arguments; new 's.x.2d' argument which allows to specify the plot setup in details. (clas.snijpunt): also check for NAs in x[1:2,m]. Suggestions originally from Peter Ruckdeschel 2011-10-16 Martin Maechler * po/: setup of for translation 2011-09-14 Martin Maechler * inst/CITATION: update according to state-of-the-art. 2011-08-29 Martin Maechler * DESCRIPTION (Version): 1.14.1, released to CRAN, 2011-10-16 * R/silhouette.R (plot.silhouette): col = had ordering bug. * man/silhouette.Rd: added example 2011-06-07 Martin Maechler * DESCRIPTION (Version): 1.14.0, released to CRAN, 2011-06-07 * R/plotpart.q (clusplot.default): use message() and warning() appropriately instead of just cat(). Further, add a 'add = FALSE' argument which allows *adding* ellipses to an existing plot. 2011-06-06 Martin Maechler * R/plotpart.q (clusplot.default): new 'cex' and 'cex.txt', the latter for the "point" labels. 2011-05-20 Martin Maechler * src/pam.c (cl_pam): trace_lev: also trace the computation of dissimilarities (a very expensive part, for large n). * R/pam.q (pam): cluster.only=TRUE: if the *computed* dissimilarities have NA's the necessary error was not signalled. 2011-03-07 Martin Maechler * tests/*.Rout.save: update after R-devel's "scientific()" patch. * DESCRIPTION (Version): 1.13.4, *not* released 2011-02-21 Martin Maechler * DESCRIPTION (Version): 1.13.3, released to CRAN today 2010-12-12 Martin Maechler * R/ellipsoidhull.R, *: use "full argument names" 2010-11-09 Martin Maechler * R/clara.q (clara): enforce sampsize > k {as the help file always said}; allow to disable 'DUP=FALSE' via env variable. 2010-11-08 Martin Maechler * src/clara.c (cl_clara): inserting rand_k into nsel[]: simplified and avoiding (typically inconsequential) out_of_bound array access. 2010-10-21 Martin Maechler * DESCRIPTION (Version): 1.13.2 ; Enhances: MASS; released to CRAN, 2010-11-10 * src/cluster.h, src/daisy.f, src/mona.f: * src/init.c (FortEntries): s/cl_/cl/ for now, as some f77/g77 setups cannot deal with it correctly. 2010-06-24 Martin Maechler * DESCRIPTION (Version): 1.13.1 2010-06-23 Martin Maechler * man/daisy.Rd: add our *generalized* Gower formula (LaTeX), and update the detailled description accordingly. 2010-06-02 Martin Maechler * DESCRIPTION (Version): 1.13.0 * src/daisy.f (cl_daisy): renamed from daisy * src/init.c, src/*.[chf]: renamed others, so we can use * NAMESPACE (useDynLib): .registration = TRUE 2010-05-28 Martin Maechler * R/daisy.q (daisy): using variable weights (for gower). * src/daisy.f: ditto 2010-03-29 Martin Maechler * DESCRIPTION (Version): 1.12.3 * R/plothier.q (bannerplot): do not use formals(pretty) 2009-12-05 Martin Maechler * man/daisy.Rd: fix page number for Gower (1971) reference. 2009-10-05 Martin Maechler * DESCRIPTION (Version): 1.12.1 * man/ellipsoidhull.Rd: fix missing \link ((parts former 'graphics' have long been moved to 'grDevices'. 2009-05-13 Martin Maechler * DESCRIPTION (Version): 1.12.0 -- released to CRAN * R/silhouette.R (silhouette.default, print.summary.*, plot.*): silhouette(x, *) and its methods now also work when x uses integer codes different than 1:k. Previously, this could seg.fault. * tests/silhouette-default.R: test it. 2009-03-12 Martin Maechler * man/daisy.Rd: fix typo/thinko (thanks to Felix Mueller). 2009-01-21 Martin Maechler * R/agnes.q (as.dendrogram.agnes): new utility * NAMESPACE: exported 2009-01-17 Martin Maechler * man/plot.agnes.Rd: link to pltree.twins() directly * R/agnes.q (print.summary.agnes): output 'agnes' instead of `agnes' 2009-01-07 Martin Maechler * DESCRIPTION (Version, Date): 1.11.12 and CRAN-released 2009-01-05 Martin Maechler * man/ellipsoidhull.Rd: fix for more stringent Rd parsing 2008-09-16 Martin Maechler * R/ellipsoidhull.R (print.ellipsoid): and others: replace backquotes ( ` ) by regular quotes. 2008-06-15 Martin Maechler * R/silhouette.R (sortSilhouette): do *not* overwrite the correctly reordered rownames: Fixes very long standing bug which lead to wrong observation labels in silhouette plots. 2008-04-10 Martin Maechler * R/zzz.R (.onUnload): add ..dynam.unload()ing 2008-02-29 Martin Maechler * DESCRIPTION (Date, Version): 1.11.10 and release 2007-12-19 Martin Maechler * src/pam.c (cstat, dark): move variable declarations to local context. (bswap): add a few R_CheckUserInterrupt() calls * R/pam.q (pam): new argument 'do.swap = TRUE'. Setting it to FALSE allows to skip the more expensive "SWAP" phase. * man/pam.Rd: (ditto) 2007-12-18 Martin Maechler * src/ind_2.h (ind_2): for m := max(i,j) > 46342, (m-2)*(m-1) give integer overflow which leads to a seg.fault. Now fixed. * src/pam.c (bswap): slightly improve trace output. * tests/pam.R, tests/pam.Rout.save: corresponding slight adaptions. * man/pam.Rd: "large" and * man/clara.Rd: "small" datasets; pam() works with thousands ... * R/clara.q (clara): error out when users try clara(, ...). 2007-09-28 Martin Maechler * DESCRIPTION (Date, Version): 1.11.9 * man/pam.Rd: in invisible example, do not use partially matched [[. 2007-09-04 Martin Maechler * src/mona.f (mona): dummy initializations for "-Wall" * src/fanny.c (fygur): dummy init 'lang' 2007-08-23 Martin Maechler * src/daisy.f et al: de-tabify the fortran sources 2007-06-05 Martin Maechler * DESCRIPTION (Version): 1.11.7 (mainly for R-devel) 2007-06-02 Martin Maechler * man/plot.diana.Rd, etc: s/dendrogramm/dendrogram/ 2007-05-31 Martin Maechler * man/plantTraits.Rd: add \encoding{latin1} 2007-04-09 Martin Maechler * DESCRIPTION (Version): 1.11.6 - needed for R version >= 2.6.0. * R/daisy.q (daisy): for 2-valued variables only warn about non-specified type when n >= 10. 2007-04-07 Martin Maechler * R/diana.q (diana): don't use as.double(.) and DUP=FALSE ! 2007-03-30 Martin Maechler * man/diana.Rd: merge man/diana.object.Rd into *one* help file * DESCRIPTION (Version): 1.11.5 - for R 2.5.0 2007-03-29 Martin Maechler * R/silhouette.R (silhouette.default): use x$clustering only when x is a list. 2006-12-11 Martin Maechler * DESCRIPTION (Version): 1.11.4 -- ready * tests/to-25x, tests/to-24x: different outputs for R 2.5.0 (unstable) * tests/clara.Rout.save-R25x,..: and R-2.4.x * tests/silhouette-default.R: use [as.integer(rownames(.)), ] since we cannot guarantee rownames there. 2006-12-05 Martin Maechler * src/fanny.c (fuzzy): 14 instead of 15 sign.digits for trace_lev >= 2 printing. * R/clara.q (stop): message for NA-observations: only show first dozen of observation numbers. * tests/clara-NAs.R: test the above * tests/clara-NAs.Rout.save: ditto 2006-12-02 Martin Maechler * DESCRIPTION (Version): 1.11.3 -- released to CRAN * R/daisy.q (daisy): finish metric "gower", and test an example 2006-12-01 Martin Maechler * man/daisy.Rd: more content about Gower; thanks to Gavin Simpson 2006-11-23 Martin Maechler * R/daisy.q (daisy): metric = "gower" -- not yet finished 2006-09-07 Martin Maechler * DESCRIPTION (Version): 1.11.2 released * src/init.c: register dysta3 as C, not Fortran; drop trailing "_" ==> need to adapt these: * src/fanny.c: * src/cluster.h: * tests/dysta-ex.R: * tests/dysta-ex.Rout.save: 2006-08-24 Martin Maechler * DESCRIPTION (Version): 1.11.1 released to CRAN * R/silhouette.R (sortSilhouette): make sure "iOrd" is there also if "Ordered" is TRUE. (fixes plotting w/ col = 'clusterwise'.) 2006-08-23 Martin Maechler * tests/mona.R: update (slightly extend) regression test * tests/mona.Rout.save: consequence * R/mona.q (mona): replace apply(, 2, factor) with safer code, to work correctly in R 2.4.0 and later (thanks to Brian). 2006-06-12 Martin Maechler * R/plotpart.q (clusplot.default): new argument 'sub'; default is unchanged, but you can suppress the subtitle. 2006-05-17 Martin Maechler * src/fanny.c (fygur): a little more cleanup -- for compatibility with dark() in src/pam.c * DESCRIPTION (Version): 1.11.0, to be released to CRAN 2006-05-03 Martin Maechler * DESCRIPTION (Depends): require R >= 2.2.1 -- which should have happened earlier, since registration of Fortran symbols failed before. 2006-04-18 Martin Maechler * man/plantTraits.Rd: new dataset with many variables, including all kinds of factors, provided by Jeanne Vallet. * data/plantTraits.rda: useful for daisy() illustrations 2006-04-12 Martin Maechler * R/fanny.q (fanny): several new options: metric = "SqEuclidean", iniMem.p: initial membership matrix can be specified; cluster.only, keep.diss, keep.data: for saving memory/speed. warning when k.crisp < k. printing of $membership is now in rounded percent * man/fanny.Rd: document the above * tests/fanny-ex.R: much extended 2006-04-11 Martin Maechler * man/chorSub.Rd: new dataset; * data/chorSub.Rd: useful for fanny() illustrations * R/fanny.q (fanny): Dunn's partition coefficient (and its normalization) now always use sum.. u.. ^ 2 (and not "^ memb.exp"). option 'trace.lev' for iteration monitoring * src/fanny.c (fuzzy): (dito) 2006-04-08 Martin Maechler * src/fanny.c: Translated from Fortran (fanny.f); potentially with more options, etc. 2006-03-20 Martin Maechler * DESCRIPTION (Version): 1.10.5 for CRAN * .rsync-exclude: new file useful since I moved my RCS archive to SVN (using 'cvs2svn' and a perl script on 'svn-stat'). 2006-02-27 Martin Maechler * src/sildist.c (sildist): 2nd round (by Romain and me) 2006-02-25 Martin Maechler * R/silhouette.R (silhouette.default): new C version in file * src/sildist.c (sildist): provided by Romain Francois 2006-02-04 Martin Maechler * R/ellipsoidhull.R (print.ellipsoid): also work without 'conv' slot * man/ellipsoidhull.Rd: finally explain 'd2'; and \link to other ellipse implementations. * man/volume.ellipsoid.Rd: + example of 'ellipsoid' construction 2006-01-31 Martin Maechler * man/bannerplot.Rd: (et al.): use \dQuote{} and \sQuote{} 2006-01-27 Martin Maechler * man/pltree.twins.Rd: explain the as.hclust() dispatch; add example, particularly for plot(as.dendrogram(.)). 2006-01-26 Martin Maechler * DESCRIPTION (Version): 1.10.4 -- released to CRAN 2006-01-25 Martin Maechler * R/silhouette.R (silhouette.clara): added (for "full = TRUE" option) 2006-01-07 Martin Maechler * DESCRIPTION (Version): 1.10.3 * src/init.c: registering all (R-callable) C and Fortran routines * src/cluster.h: declare the remaining callable routines 2005-12-30 Martin Maechler * inst/CITATION: first version * R/silhouette.R (plot.silhouette): 'nmax.lab' was not obeyed properly (labels were drawn for large n when the silhouette had rownames). * man/silhouette.Rd: explain clara's silhouette and "full" one. 2005-09-06 Martin Maechler * man/pluton.Rd: \source: new URL @ www.agoras.ua.ac.be * man/clusplot.default.Rd: dito * man/ellipsoidhull.Rd: "" * README: "" 2005-08-31 Martin Maechler * DESCRIPTION (Version): 1.10.2 released to CRAN * src/clara.c (bswap2): minor cosmetic 2005-08-30 Martin Maechler * R/daisy.q (daisy): the case of a *binary*-only matrix (not data frame), used to fail, now works fine, tested in * tests/daisy-ex.R: * src/twins.f: get rid of gfortran warnings * src/mona.f: dito * src/fanny.f: " * src/meet.f: " 2005-08-06 Martin Maechler * tests/clara*: adapt to slightly changed output * src/clara.c (clara), (bswap2): better trace_lev printing; code more in line with 'pam'. 2005-08-05 Martin Maechler * DESCRIPTION (Version): 1.10.2 {not released} * R/clara.q (clara): no longer support deprecated 'keepdata'; also return 'i.med'; new argument 'medoids.x' allowing to save even more memory; do not assign 'data' when keep.data=FALSE. * man/clara.Rd: + 'i.med' + 'medoids.x' - 'keepdata' * man/clara.object.Rd: dito 2005-07-19 Martin Maechler * tests/silhouette-default.R: if(FALSE) library(*, lib="..MM..") 2005-06-30 Martin Maechler * tests/silhouette-default.R (isTRUE): need for R < 2.1.x 2005-06-29 Martin Maechler * DESCRIPTION (Date): * DESCRIPTION (Version): 1.10.1 * R/silhouette.R (plot.silhouette): format() clus.avg.widths more nicely * R/silhouette.R (silhouette.default): don't use max.col() which returns random. * tests/silhouette-default.R: test only 3rd column difference * tests/silhouette-default.Rout: update {for non-random sil*.default()} 2005-06-20 Martin Maechler * tests/silhouette-default.R: added test for equivalence of silhouette.default() and silhouette.partition() * tests/silhouette-default.Rout.save: new output --> The silhouette() results are *still* not always the same (-> fixed) * R/silhouette.R (silhouette.default): if Nj := #{obs. in C_j} = 1 the silhouette width is 0, not 1, as in pam's original code. * man/silhouette.Rd: document the case of 1-obs-clusters. 2005-06-09 Martin Maechler * DESCRIPTION (Version): 1.10.0 2005-06-08 Martin Maechler * R/pam.q (pam): new argument 'trace.lev = 0' * man/pam.object.Rd: pam() also return $medID * src/pam.c (dark): take special care of empty clusters (ntt == 0) * src/pam.c (pam): also work when medoids are not increasing. * R/pam.q (pam): user-supplied 'medoids': even more checks 2005-06-02 Martin Maechler * tests/fanny-ex.R: use new RNG (hence change example); add samples of memb.exp -> 1 * DESCRIPTION (Author): new formulation for better auto-citation() * src/fanny.f (fanny): 'r' ("membership exponent") becomes user-specifiable argument; dito for 'maxit' * R/fanny.q (fanny): new arguments 'memb.exp' ("membership exponent"); 'tol' and 'maxit' * R/fanny.q (.print.fanny): utility to be used in both print.*() methods; nicer, using formatC() and 'digits' explicitly. * man/fanny.Rd: new arguments, see above * man/fanny.object.Rd: mention new '$ objective' result component * man/print.fanny.Rd: now also for [print.]summary.fanny(); mention new explicit 'digits' argument to print methods. 2005-04-04 Martin Maechler * DESCRIPTION (Version): 1.9.8 * R/daisy.q (print.dissimilarity): rewritten, now based on print.hclust(). * R/zzz.R (gettextf): ..etc: define substitutes such as to allow running in R < 2.1.0 * man/ellipsoidhull.Rd: fixed outdated "link[pkg]" * man/clusplot.default.Rd: dito * man/*.Rd : etc 2005-03-22 Martin Maechler * R/clara.q (clara): start to 'rationalize' messages for future translation. * src/cluster.h: define the _(String) macro (for i18n), not yet used. 2005-01-21 Martin Maechler * man/clara.Rd: get rid of iso-latin1 character 2004-12-14 Martin Maechler * man/agnes.Rd: concept{UPGMA ..} 2004-11-27 Martin Maechler * DESCRIPTION (Version): 1.9.7 (not yet CRAN) * R/plothier.q (bannerplot): ouse default 'main' and 'sub' * man/bannerplot.Rd: + example * R/coef.R (coef.hclust): Implement R function for computing the agglomerative/divisive coefficient. * man/coef.hclust.Rd: new; including example * man/predict.ellipsoid.Rd: wrong link 2004-11-26 Martin Maechler * src/twins.f (bncoef): drop unused argument 'ner' 2004-11-20 Martin Maechler * man/clusplot.default.Rd: fix typo 2004-10-28 Martin Maechler * man/predict.ellipsoid.Rd: add nice example 2004-08-19 Martin Maechler * DESCRIPTION (LazyData): yes 2004-08-12 Martin Maechler * DESCRIPTION (Version): 1.9.6 (Depends): added standard packages * R/daisy.q (daisy): scale=TRUE didn't collaborate with NAs (since 2003-11-29). * tests/daisy-ex.R: add an example, testing the above 2004-08-03 Martin Maechler * DESCRIPTION (Version): 1.9.5 --> to CRAN 2004-07-21 Martin Maechler * man/mona.Rd: drop an extraneous "}\n" that Kurt's new tools found * man/twins.object.Rd: dito 2004-07-06 Martin Maechler * DESCRIPTION (Version): 1.9.5 (not yet released) * man/pam.Rd: note on 'medoids' 2004-07-02 Martin Maechler * R/pam.q: new argument 'medoids' * man/pam.Rd: ex.with 'medoids' * src/pam.c (bswap): new argument 'med_given' 2004-06-29 Martin Maechler * src/pam.c (bswap): moved ammax/nmax computation into same loop as beter[]. added many comments. GOAL: Allow initial medoids user-specification. >>> TODO: do the analogous thing in src/clara.c 's bswap2() 2004-06-24 Martin Maechler * DESCRIPTION (Version): 1.9.4 -- fix dysta() using jtmd[] problems (thanks to valgrind and BDR). * R/agnes.q (agnes): initialize 'jtmd' to length p in any case * R/diana.q (diana): ditto * R/fanny.q (fanny): " * R/pam.q (pam): " * R/daisy.q (daisy): pass 'mdata' to Fortran * src/daisy.f (daisy): new "boolean" argument 'mdata' * src/clara.c (clara): pass has_NA to dysta2() and don't use jtmd[] and valmd[] if(!has_NA) * src/cluster.h (dysta2): new arg 'has_NA' 2004-06-18 Martin Maechler * DESCRIPTION (Version): 1.9.3 {only change = below} * src/ind_2.h (ind_2): use __inline__ only for gcc (__GNUC__) 2004-06-11 Martin Maechler * man/clara.Rd: finish \note{} about 'rngR' (thanks to Christian H). 2004-06-01 Martin Maechler * src/ind_2.h: new file for __inline__ definition of ind_2(), #included from these two files: * src/clara.c: * src/pam.c: * tests/agnes-ex.R: test for "weighted" == "flexible"(0.5) 2004-05-28 Martin Maechler * DESCRIPTION (Version): 1.9.2 (not yet released) * R/agnes.q (agnes): New method = "flexible" (and 'par.method = ..') * src/twins.f (averl): implementing "flexible" Lance-Williams formula. * man/agnes.Rd: 2004-05-25 Martin Maechler * R/silhouette.R (silhouette.default): give silhouette 0 (not NaN) when a_i = b_i {thanks to example and suggestions by Witek Wolsky}. 2004-04-26 Martin Maechler * src/pam.c: cosmetic efficiency improvement from Li Long 2004-03-11 Martin Maechler * DESCRIPTION (Version): 1.8.1 for R versions <= 1.8.1 1.9.1 for R versions >= 1.9.0 -- released to CRAN * src/clara.c (clara): fixed second NA-handling bug: the test should be "nunfs+1 != jran" Fixed "rngR = TRUE" bug: accidentally still used internal RNG. Fixed 3rd bug if (lrg_sam) : need jk < n_sam for nsel[jk]. More & nicer printing for 'trace > 0'. * R/clara.q (clara): more useful error msg for too many NAs (jstop=1) 2004-03-10 Martin Maechler * src/clara.c (clara): finally fixed longstanding bug which could cause wrong results and segmentation faults, instead of ending with the following error: * tests/clara-NAs.R: new file w/ former seg.fault * src/cluster.h (ind_2): new function instead of F77_CALL(meet) * src/clara.c (clara): defined here (and used). * src/pam.c (pam): used here 2004-03-09 Martin Maechler * R/clara.q (clara): sampsize = min(n, ) 2004-03-08 Martin Maechler * tests/agnes-ex.R: do not use object.size(), since * tests/diana-ex.R: it's different on 64 bit, e.g. * R/agnes.q (agnes): \ when diss = TRUE, * R/diana.q (diana): \ but 'x' is not a "dissimilarity", * R/fanny.q (fanny): / try as.dist(x) * R/pam.q (pam): / and be consistent in all 4 functions 2004-01-23 Martin Maechler * R/silhouette.R (silhouette.default): do not require cluster codes in 1:k (Murad Nayal ). * man/silhouette.Rd: accordingly; mention 2 <= k <= n-1 2003-12-22 Martin Maechler * DESCRIPTION (Version): 1.8.0 for R versions <= 1.8.1 1.9.0 for R versions >= 1.9.0 2003-12-19 Martin Maechler * NAMESPACE: Finally make a namespaced package 2003-12-01 Martin Maechler * R/pam.q (print.summary.pam): readable indication *no* L/L* clusters. (print.pam): improve as well. * man/pam.Rd: documenting `cluster.only' 2003-11-29 Martin Maechler * R/daisy.q (daisy): better checking & handling if(stand) * R/pam.q (pam): new argument `cluster.only = FALSE'. If true, only return the clustering vector, no other info. * src/pam.c: translated from src/pam.f and "cleaned"; `all_stats' := NOT(cluster_only). * src/cluster.h: new pam.c related headers * src/dysta.f (dysta): new file: part of former src/pam.f * R/pam.q (pam): use .C 2003-11-28 Martin Maechler * R/daisy.q (daisy): fix the new scale 0 code (from 11-17) 2003-11-17 Martin Maechler * DESCRIPTION (Version): 1.7.7 -- (not released) * tests/daisy-ex.R: new test for this: * R/daisy.q (daisy): scale 0 does not give NaN dissimilarities anymore. Use pColl() in messages * R/zzz.R (sQuote): & dQuote() for R version < 1.8 2003-10-25 Martin Maechler * man/fanny.Rd: typo in the text-part of \deqn{} 2003-09-24 Martin Maechler * DESCRIPTION (Date): Sept.24: 20th anniversary w/ Lilo! -- release * man/plot.mona.Rd: yet another codoc 2003-09-23 Martin Maechler * DESCRIPTION (Version): 1.7.6 (for R 1.8.0) * man/daisy.Rd: codoc difference for argument *defaults* * man/ellipsoidhull.Rd: " " " " * man/plot.mona.Rd: " " " " * man/plot.diana.Rd: " " " " use \method{..}{..} (more!) also for these: * man/predict.ellipsoid.Rd * man/silhouette.Rd: * man/plot.agnes.Rd: * man/plot.partition.Rd: * man/ellipsoidhull.Rd: 2003-09-03 Martin Maechler * DESCRIPTION (Date): -> release 2003-08-27 Martin Maechler * man/flower.Rd: use V1-V8 in doc (since can't change the data). 2003-08-19 Martin Maechler * DESCRIPTION (Version): 1.7.5 -- not yet released 2003-08-13 Martin Maechler __ All these are thanks to Luke Tierney's checkUsagePackage() !! __ * R/silhouette.R (plot.silhouette): `clw' (sortSilhouette): `clid' & `k' (summary.silhouette): `n' * R/ellipsoidhull.R (ellipsoidhull): `ina' unneeded * R/plotpart.q (clusplot.default): extraneous if() in "funny case" 2003-07-18 Martin Maechler * DESCRIPTION (Date): updated --> release to CRAN * R/daisy.q (daisy): checking "> 2 levels" for binary vars (gave wrong error when only 1 level; thanks to Duncan.Mackay@flinders.edu.au). Now allow "only 1 level" for binary vars 2003-07-10 Martin Maechler * DESCRIPTION (Date): update; not released, but put up on FTP * R/silhouette.R (sortSilhouette): keep ordering; use it to * R/silhouette.R (plot.silhouette): order colors, allow cluster colors 2003-07-09 Martin Maechler * DESCRIPTION (Version): 1.7.4 -- not yet released * R/daisy.q (daisy): better error message for invalid type components; now also works for * man/daisy.Rd: new example `dfl3' 2003-06-10 Martin Maechler * DESCRIPTION (Version): 1.7.3 * R/silhouette.R (silhouette.default): fix bugs for case "Nj == 1" * tests/silhouette-default.Rout.save: * tests/silhouette-default.R: new test for the above 2003-06-04 Martin Maechler * tests/clara-ex.R and man/clara.Rd: add "drop = FALSE" 2003-06-03 Martin Maechler * man/clara.Rd: the "simulation" example is now correct for any seed. * tests/clara-ex.R: using "correct" ex. above 2003-06-02 Martin Maechler * R/daisy.q (daisy): s/codes/unclass/ * tests/ellipsoid-ex.R: no need for try() anymore; use new RNG * tests/clara.R: * tests/clara-ex.R: better if(...) RNGdefault("1.6") * tests/fanny-ex.R: * tests/mona.R: 2003-05-28 Martin Maechler * DESCRIPTION (Version): 1.7.2 * R/plotpart.q: clusplot.partition(): try to find `x$diss' by looking up x$call. 2003-04-30 Martin Maechler * DESCRIPTION (Version): 1.7.1 * man/pam.object.Rd: add example about assessing #{clusters} via silhouette widths from Ch.Hennig. * R/plotpart.q (plot.partition): new argument `dist' It doesn't try a clusplot if `keep.diss' was FALSE and no `dist' is specified. * R/plotpart.q (clusplot.partition): new `dist' argument * R/pam.q (pam): keep.diss passed wrong `jdyss' to Fortran! 2003-04-08 Martin Maechler * R/plothier.q (pltree.twins): simplified label construction; call plot( ) instead of plot.hclust(). 2003-03-26 Martin Maechler * tests/clara-ex.R: new, because of unclear non-reproducibility * tests/clara.R: not example(clara) and smaller, moved some to above * DESCRIPTION (Version): 1.7.0 (for R 1.7.0) * DESCRIPTION (Depends): at least R 1.4 * R/zzz.R: requiring 1.4 needs much less * R/zzz.R: define colSums() substitute for old R versions * tests/ : updated *.Rout.save files * .Rbuildignore: R/README-Splus is way outdated and irrelevant 2003-03-17 Martin Maechler * R/0aaa.R: Make sure assigning class c("dissimilarity", "dist") (had many cases where only "dissim.." was used!). * R/*.q: assign (dissim.., dist) class 2003-03-11 Martin Maechler * R/clara.q (clara): new argument `rngR' allowing to use R's RNG instead of the primitive builtin randm(). * man/clara.Rd: example showing its use. * src/clara.c (clara): * R/pam.q (pam): new `keep.data' and DUP=FALSE in .Fortran 2003-03-05 Martin Maechler * R/agnes.q (agnes): use DUP = FALSE * R/diana.q (diana): for both "twins()" routines --> 3x less memory! 2003-02-22 Martin Maechler * R/clara.q (clara): do *not* transpose the x[,] matrix anymore * src/clara.c (clara): C code accesses un-transposed x[,] \ --> + 10% speed 2003-02-07 Martin Maechler * R/silhouette.R (silhouette.default): fixed k=2 case; * man/silhouette.Rd: new argument `dmatrix'. 2003-02-06 Martin Maechler * man/plot.partition.Rd: new `main' argument (instead of "...") * R/plotpart.q: passed to plot.silhouette(). 2003-01-27 Martin Maechler * R/agnes.q (agnes): store `method' with object for as.hclust.twins()! \ new logical args `keep.diss' and `keep.data' * R/diana.q (diana): > if (!keep.diss), do not need "dis2" * src/twins.f (twins):/ and don't copy the dist()s here. * man/pltree.twins.Rd: mention new `ylab' argument. * R/plothier.q: __unfinished__ : xlab/ylab depend on "which.plot"! 2002-12-30 Martin Maechler * man/bannerplot.Rd: and * R/plothier.q (bannerplot): new `labels' e.g. passed from plot.agnes(). * man/plot.agnes.Rd: finally added `labels = ' example * tests/clara.R: for() loops were silly; + other ex + comments * src/clara.c: cosmetic * src/fanny.f: and * src/pam.f: cosmetic "syncing" of almost identical parts 2002-12-28 Martin Maechler * tests/clara.Rout.save: * tests/clara.R: add ruspini examples * src/clara.c: finally found & fixed "clara(ruspini, 4)" problem 2002-12-21 Martin Maechler * DESCRIPTION (Version): 1.6-4 {for R 1.6.2} * R/diana.q (diana): since 1.6-1, integer x was not coerced * tests/agnes-ex.R, * tests/diana-ex.R, and *.Rout.save: new test files * src/twins.f: some comments added; gotos removed banag() and bandy() were identical --> renamed to bncoef() 2002-12-17 Martin Maechler * R/agnes.q: agnes(*, method = "no") no longer segfaults * R/silhouette.R (plot.silhouette): adj=1.04 (not "1.05") * R/plothier.q (pltree.twins): new `labels' arg. such that it can be given to plot.agnes() e.g. 2002-12-05 Martin Maechler * DESCRIPTION (Date, Version): 1.6-3 * src/cluster.h: F77_NAME(meet) * src/clara.c: F77_CALL(meet) 2002-10-28 Martin Maechler * src/pam.f (pam): comments, (bswap): variable renaming 2002-10-26 Martin Maechler * DESCRIPTION (Version): 1.6-003 := pre-1.6-3 2002-10-23 Martin Maechler * R/agnes.q (print.summary.agnes): oops: had `clara' there! 2002-10-23 Martin Maechler * Version 1.6-2 ==> released to CRAN 2002-10-21 Martin Maechler * R/daisy.q (daisy): allow "+- Inf" in `x' (gave error from Fortran) 2002-10-19 Martin Maechler * R/silhouette.R (plot.silhouette): also use border = 0 and new default col = "gray". * R/plothier.q (bannerplot): arguments inside = . , border = 0 work with R 1.6.1's barplot() {give "not yet .." otherwise}. * tests/mona.R and mona.Rout.save: new tests * R/mona.q (mona): get rid of 1:nchar() warnings; other cosmetic * src/mona.f (mona): variable renaming; logical cleanup in NA dealing * R/zzz.R (stop): multi-argument version for R versions < 1.6 2002-10-18 Martin Maechler * R CMD check now okay. * man/plot.mona.Rd: update (for bannerplot() usage), same for * man/plot.agnes.Rd and * man/plot.diana.Rd. * R/plothier.q (bannerplot): finally working for all three; argument `xax.pretty = TRUE' (set to FALSE for old behavior). (plot.mona): using bannerplot(); {and is.na(.) <- .} 2002-10-16 Martin Maechler * R/plothier.q (bannerplot): newly standalone function, called from plot.diana(), plot.agnes() -- not yet plot.mona() 2002-10-15 Martin Maechler * DESCRIPTION (Version): 1.6-2 (not yet released) * R/plothier.q (plot.diana, bannerplot): rev(.) x-axis labels --> fixing bug introduced at/before version 1.2-5 * R/plothier.q (plot.agnes, bannerplot) and plot.diana: add "las = 2" to vertical axis(), and add space to right for plot.diana. 2002-09-12 Martin Maechler * DESCRIPTION (Date): -- released locally only 2002-09-11 Martin Maechler * R/clara.q (clara): for the case of k = 1 (and diss=FALSE), * R/pam.q (pam): medoids should stay matrix * src/pam.f (pam): put under RCS; replaced goto by if..else.. * man/pam.Rd: mention silhouette() directly * man/silhouette.Rd: document summary(); + 1ex 2002-09-09 Martin Maechler * DESCRIPTION (Version): 1.6-1 ==> for CRAN and R 1.6.0 2002-09-07 Martin Maechler * R/silhouette.R (silhouette): New class, generic generator, methods; particularly, plot.silhouette() was plot.partition internal. improve documentation about silhouette info; update * R/clara.q: * R/plotpart.q (plot.partition): 2002-09-06 Martin Maechler * man/partition.object.Rd, * man/pam.object.Rd, man/clara.object.Rd, man/fanny.object.Rd, * man/plot.partition.Rd: reorganize documentation on silhouette information, thanks to thoughts from Christian Hennig. 2002-09-04 Martin Maechler * man/agnes.object.Rd: mention as.hclust() properly * src/spannel.c (spannel): bail out also when *last* deter became <= 0 * tests/ellipsoid-ex.R (and *.Rout.save): updated * DESCRIPTION (Version): 1.6-0 * R/zzz.R: dev.interactive(), warnings(),... for old R versions * man/summary.clara.Rd: make example run for R versions < 1.5.0 2002-09-03 Martin Maechler * R/plotpart.q (plot.partition): new `data' argument and smart `which.plots' default for clara(*, keep = FALSE) * R/daisy.q (summary.dissimilarity): fix ``number of dissim'' * R/*.q: 1) use apply(inax,2, any)--- really want colNAs() 2) use better "valmisdat" (missing value). * tests/dysta-ex.R (dysta): new file, explore "dysta" & "dysta3" in Fortran * src/fanny.f: get rid of many gotos 2002-09-02 Martin Maechler * tests/fanny-ex.R: and ...Rout.save : new files * src/twins.f (twins): drop dysta4(), use dysta() from pam.f 2002-08-31 Martin Maechler * DESCRIPTION (Version): 1.5-4 -- have achieved something {want more} * src/clara.c (clara): finally found and fixed the rare segfault bug: jran == 1 was wrong test (when 1st sample was unusable) (randm): faster implementation of primitive RNG * src/spannel.c: new translated from src/spannel.f in order to debug the compiler-dependent outputs in * tests/ellipsoid-ex.Rout.save etc * tests/sweep-ex.R (.C) 2002-08-30 Martin Maechler * src/clara.c (clara): * man/clara.object.Rd: * R/clara.q: new argument `keepdata' and `trace' * R/plotpart.q (clusplot.default): xlim, ylim: believe user 2002-08-27 Martin Maechler * src/clara.c (clara): new file, translated from Fortran; easier to debug the (rare!) seg.fault. "make check fine" * DESCRIPTION (Depends): R >= 1.2 * R/plothier.q (pltree.twins): (drop code for R version < 1.2.0) 2002-08-23 Martin Maechler * DESCRIPTION (Version): 1.5-3 {released only locally} * R/plotpart.q (clusplot.default): xlim, ylim had "<" and ">" reversed * man/clusplot.default.Rd: fix interactive(), add x- and ylim example 2002-08-02 Martin Maechler * src/twins.f (twins) et al: * src/fanny.f (fanny) et al: * src/mona.f (mona): * src/daisy.f (daisy): explicit instead of "implicit" var.declaration * src/spannel.f (spannel) et al: no "implicit none" 2002-07-29 Martin Maechler * DESCRIPTION (Version): 1.5-2 * R/daisy.q (print.summary.dissimilarity): new function and summary.dissimilarity() now returns a classed object. * R/agnes.q (print.summary.agnes), * R/clara.q (print.summary.clara), * R/diana.q (print.summary.diana), * R/fanny.q (print.summary.fanny), * R/pam.q (print.summary.pam): print.summary.*() now only *summarizes* dissimilarities (if at all) 2002-07-27 Martin Maechler * tests/pam.R and tests/pam.Rout.save : new files * man/summary.agnes.Rd: + example * man/summary.clara.Rd: + example * R/clara.q (print.clara): improvements: call, no long clus. vector * R/agnes.q (print.agnes): similar * man/daisy.Rd : added "[mva]" to \link{}s. The same in: * man/clusplot.default.Rd: new `col.clus' argument, new option `labels = 5'. * R/plotpart.q (clusplot.default): cosmetical cleaning; `col.p' is now vectorized for point coloring. The cluster ellipse is now labeled with font=4 and proper color 2002-06-17 Martin Maechler * man/sizeDiss.Rd: fix \value{} * tests/daisy-ex.R: new file (and *.Rout.save) 2002-06-17 Martin Maechler * submit to CRAN -- won't be in R's 1.5.1-recommended * R/daisy.q (daisy): make sure "0","1" factors are valid binary vars several extra checks {incl apply() `bug' * man/diana.object.Rd: show how to use cutree(). 2002-05-22 Martin Maechler * R/daisy.q (daisy): warn if binary variables have non-{0,1} values. * src/pam.f (cstat) et al: eliminated many gotos; +comments * src/meet.f (meet): + comment 2002-05-21 Martin Maechler * DESCRIPTION (Version): 1.5-1 new daisy() behavior for binary variables * src/daisy.f (daisy): add comments; use if..else.. instead of goto * man/dissimilarity.object.Rd: new "Types" attribute in mixed case. * man/daisy.Rd: * R/daisy.q (daisy): fix data.class "integer", allow type = "symm"; return types used in mixed case; correctly modify jtmd[] for binary variables (!) 2002-03-30 Martin Maechler * R/plotpart.q: replace `` == "NA" '' by is.na(.) * R/mona.q (mona): 2002-03-04 Martin Maechler * DESCRIPTION (Version): 1.4-1 * R/zzz.R (.First.lib), * R/plothier.q: replace plclust() by plot[.hclust]() everywhere. 2002-01-29 Martin Maechler * R/pam.q (pam): comment on "valmisdat"; same in * R/fanny.q, R/agnes.q, R/clara.q, R/diana.q * src/pam.f (dysta): comment + white space * src/fanny.f (fanny): lowercase and indent + comments 2002-01-24 Martin Maechler * man/agnes.Rd, diana.Rd, pam.Rd, clara.Rd, mona.Rd, fanny.Rd : Reference and BACKGROUND section only in agnes.Rd; the others refer to agnes. * man/fanny.Rd: clean * R/agnes.q (agnes): \ ``diss = inherits(x, "dist")'' * R/diana.q (diana): > instead of "diss = FALSE" * R/fanny.q (fanny): / as we have changed pam() already in 1.4-0 2002-01-23 Martin Maechler * DESCRIPTION (Version): 1.4-0 * man/ellipsoidhull.Rd: example * tests/ellipsoid-ex.R and *.Rout: finalized * man/pluton.Rd: work around Rdconv \eqn{.}{.} bug. 2002-01-22 Martin Maechler * R/ellipsehull.R (ellipsehull) et al: generalized from 2 to p dimensions. -- points generation: not yet! * tests/ellipsehull.R: new test file * man/clusplot.partition.Rd: clean up * man/clusplot.default.Rd: proper reference to Pison et al * man/clusplot.Rd: clean 2002-01-21 Martin Maechler * R/ellipsehull.R (ellipsehull) and others: new functions * R/plotpart.q (clusplot.default) use new ellipsePoints(); simplification by using "d2" (= dist^2) instead of "dist". 2002-01-19 Martin Maechler * R/plotpart.q (clusplot.default) re-scale cov.wt() result: Finally return the smallest possible ellipses. NOTA BENE ===> (numerical) results are *different* ! 2002-01-18 Martin Maechler * R/plotpart.q (clusplot.default) {spannel}: Finally found why our ellipses are not quite ok : R's cov.wt() differs from S-plus' ! * src/spannel.f (spannel): new argument `maxit' (was 5000). * R/plotpart.q (cusplot.default): cleanup, eliminating internal kleur() & plotje(); and "spannel" arguments; new maxit; lower eps use which.min() and which.max(); ... * R/pam.q (pam): diss has new default = inherits(x, "dist") which is TRUE therefore for dissimilarity or dist objects. 2002-01-12 Martin Maechler * R/agnes.q, R/diana.q : a bit of cleanup in the two twins calling functions. * man/lower.to.upper.tri.inds.Rd, * man/cluster-internal.Rd: new for formerly local functions, now in * R/internal.R (sizeDiss), * R/internal.R (lower.to.upper.tri.inds), and upper.to...: new functions instead of local functions in several places, e.g., * R/diana.q, R/fanny.q, ... * R/plotpart.q (clusplot.default): fix bug PR#1249: cmd() != cmdscale(); use new cmdscale(*, add=TRUE) ---> (slightly) different result sometimes fix long-standing typo in NA case + more cleanup * R/plotpart.q (clusplot.partition): explicit `main' argument with better default. 2001-12-06 Martin Maechler * DESCRIPTION (Version): 1.3-6 * R/plotpart.q: enable `density =' for polygon shading. 2001-11-27 Martin Maechler * R/zzz.R: get rid of .Alias 2001-11-06 Martin Maechler * DESCRIPTION (Version): 1.3-5 * R/plothier.q: Fix menu() bug thanks to Richard Rowe. * R/plotpart.q: ditto * R/agnes.q: properly allow integer matrix input: don't use all(sapply(x, data.class) == "numeric") anymore. * R/clara.q, R/diana.q, R/fanny.q, R/pam.q: ditto 2001-11-05 Martin Maechler * R/pam.q: `call' via match.call() instead of sys.call, and as list component instead of attribute. [R philosophy compatibility] * R/mona.q: ditto * R/fanny.q, R/diana.q, R/clara.q, R/agnes.q, * R/plothier.q, R/plotpart.q: ditto 2001-10-09 Martin Maechler * DESCRIPTION (Version): 1.3-5b (beta) for sending to Robert G * R/plothier.q: plot.diana() must have main=NULL * R/diana.q: minor code cleanup 2001-08-27 Martin Maechler * README.orig: renamed from R/README-splus 2001-08-22 Martin Maechler * DESCRIPTION (Version): New version is 1.3-4 * man/flower.Rd: nicer using \describe{} * man/plot.partition.Rd (and R/plotpart.q): new argument `which.plots' (as in the other plot.* functions). * R/plothier.q: All plot.* methods which produce more than one plot now call par(ask = TRUE) automagically when `needed' (as e.g., in plot.lm()). * man/*.Rd: document all arguments; a bit more cleanup. R (1.4.0) CMD check is now okay. 2001-08-18 Martin Maechler * R/*.q and man/*.Rd: generic/method argument fixes 2001-05-26 Martin Maechler * man/*.Rd: indenting in all dataset examples * man/votes.repub.Rd: usage fix 2001-05-23 Martin Maechler * INDEX: structured logically, rather than alphabetically * tests/clara.R: new test * src/clara.f (clara): added comments * R/clara.q (clara) : comments and cleanup 2001-05-22 Martin Maechler * DESCRIPTION (Version): New version is 1.3-3. * R/agnes.q and all others: `components' not `arguments' in print.*() * src/meet.f (meet): use [if then else] instead of goto * src/clara.f (clara): all declarations explicit; some cleanup 2001-05-21 Martin Maechler * DESCRIPTION (Package): licence changed to GPL (Rousseeuw's e-mail) * R/pam.q: minor code cleanup for Fortran interface * src/pam.f (pam): all declarations explicit * README: integrated former ./README_MM * src/twins.f, many R/*.q and * man/pltree.Rd: replace s/S-plus/S/ in many places 2001-03-21 Martin Maechler * man/print.summary.FOO.Rd: drop these files, move some to FOO.Rd * man/print*.Rd: cleanup, use \method{} 2001-01-04 Martin Maechler * DESCRIPTION (Version): New version is 1.3-2. * man/print*.Rd: Better \title{.}, hence * INDEX * man/*.Rd: Remove \keyword{libcluster}; we have {cluster}. 2001-01-03 Martin Maechler * DESCRIPTION (Version): New version is 1.3-1. 2001-01-02 Martin Maechler * man/*.Rd: fixes for codoc() * src/spannel.f (spannel): improve readability, indent properly, add a few comments * src/clara.f: * src/pam.f: * src/twins.f: * R/*.q : Added PACKAGE = .. to all .Fortran() calls ===== Many codoc() fixes; particularly summary.*(*, ...) * R/plotpart.q: (clusplot.partition): simplified * R/agnes.q: T/F -> TRUE/FALSE and more * R/clara.q: * R/diana.q: * R/fanny.q: * R/mona.q: * R/pam.q: 2000-12-30 Martin Maechler * DESCRIPTION (Version): New version is 1.2-5. 2000-12-24 Kurt Hornik * DESCRIPTION (Version): New version is 1.2-4. (Maintainer): New entry. 2000-12-14 Martin Maechler * src/daisy.f: indented do loops; one if / else. * R/daisy.q: __ daisy() __ - "ordratio" |-> "T", was "O" erronously! - `metric' and `list' argument checking * man/clusplot.default.Rd: updated and cleaned. 2000-12-02 Martin Maechler * R/plothier.q: plot.agnes() & plot.diana() : main=NULL defaults to two different titles for both plots 2000-11-30 Martin Maechler * man/...Rd: - \section{NOTE} becomes \note - fix most T/F to TRUE/FALSE, .. * R/plothier.q: - cleanup (T/F); indenting - plot.mona(): las = 1 for axis; allow main= - plot.diana(): `which.plot' and main= and sub= - plot.agnes(): `which.plot' and main= and sub= - pltree.twins(): allow main= ; rm"plot = TRUE" (warn) --> now depends on R 1.2's plot.hclust() * R/plotpart.q: clusplot.default() -- now works! - *much* clean up - color choice such as to see points - got rid of NaN warning - eliminated "polygon(*,density.) warnings by '##no yet'" 2000-11-29 Martin Maechler * R/daisy.q: add "dist" class (and fix T/F to TRUE/FALSE etc) * R/daisy.q and * man/print.dissimilarity.Rd: add summary.dissimilarity() * man/dissimilarity.object.Rd: cleanup, use \value{.}, doc. "dist" * man/daisy.Rd: cleanup, use \value{.} * man/agnes.Rd: cleanup. * man/*.object.Rd: cleanup, use \value{.} Thu Feb 17 22:56:58 2000 Kurt Hornik * DESCRIPTION (Version): New version is 1.2-3. * src/Makefile: Removed. Tue Dec 28 18:41:09 1999 Kurt Hornik * DESCRIPTION (Version): New version is 1.2-2. * data/00Index: Added entry for `xclara'. * man/xclara.Rd: New file. * data/figure2.R: * data/table4.R: Removed as unused and undocumented. Sun Dec 5 20:14:45 1999 Kurt Hornik * DESCRIPTION (Version): New version is 1.2-1. * R/daisy.q: * src/daisy.f: * PORTING: Rewrite to pass integers rather than character strings to Fortran (changes provided by BDR). Sun Apr 11 04:21:03 1999 Kurt Hornik * DESCRIPTION (Version): New version is 1.2-0. * R/plotpart.q: Replace rep.int() by rep(). * R/zzz.R: Make .First.lib() use plot.hclust() for plclust() which seems to do the job, sort of. * data/animals.R: Replaced by `animals.tab'. * data/ruspini.R: Replaced by `ruspini.tab'. * data/votes.repub.tab: New file. * man/agriculture.Rd: New file. * man/animals.Rd: New file. * man/flower.Rd: New file. * man/ruspini.Rd: New file. * man/votes.repub.Rd: New file. * man/*: Hand-edit all examples to make executable. Fri Nov 27 23:53:11 1998 Kurt Hornik * DESCRIPTION (Version): New version is 1.1-3. * R/mona.q: Barf only if neither a matrix nor a data frame (remember that in S, is.matrix() is TRUE for data frames). * man/*: Converted anew via `Sd2Rd -x' using Sd2Rd 0.3-2. * TODO: Removed. Tue Jun 16 09:23:15 1998 Kurt Hornik * DESCRIPTION (Version): New version is 1.1-2. * DESCRIPTION: * PORTING: * TITLE: * R/zzz.R: * src/Makefile: Change old `clus' to new name `cluster'. Mon Jun 15 11:01:52 1998 Kurt Hornik * ChangeLog: Finally started, current version is 1.1-1. cluster/NAMESPACE0000644000176200001440000000501014277710251013154 0ustar liggesusersuseDynLib(cluster, .registration=TRUE) ## S3 Generics: export(clusplot, pltree, silhouette, volume) ## Normal functions (non-generics, non-methods): ## The original constructors: export(agnes, clara, daisy, diana, fanny, mona, pam) ## and the rest export(bannerplot, ellipsoidhull, ellipsoidPoints, clusGap, maxSE, medoids, lower.to.upper.tri.inds, upper.to.lower.tri.inds, meanabsdev, sizeDiss, sortSilhouette) ## Methods also useful as 'standalone functions': export(predict.ellipsoid) export(coef.hclust, coefHier) importFrom("stats", as.hclust, as.dist, as.dendrogram, cmdscale, coef, cov.wt, dist, mahalanobis, median, na.omit, princomp, runif, setNames, var, weighted.mean) ## For now, we keep *depending* on 'stats' just so that ## S3 methods *.hclust, *.dist etc will work importFrom("graphics", arrows, axis, barplot, boxplot, identify, lines, matplot, mtext, par, plot, points, polygon, rect, segments, text, title) importFrom("grDevices", dev.interactive) importFrom("utils", menu, str) ###---- Methods ---- all documented but not exported ## of own generics S3method(clusplot, default) S3method(clusplot, partition) S3method(pltree, twins) S3method(silhouette, default) S3method(silhouette, clara) S3method(silhouette, partition) S3method(volume, ellipsoid) ## register all the method for generics elsewhere in case namespace is ## loaded but not currently attached. # via matrix method (R "bug": needs a copy *in* cluster, -> R/silhouette.R): S3method(as.data.frame, silhouette, as.data.frame.matrix) ## S3method(as.dendrogram, twins) S3method(coef, hclust) S3method(coef, twins) S3method(plot, agnes) S3method(plot, diana) S3method(plot, mona) S3method(plot, partition) S3method(plot, silhouette) S3method(plot, clusGap) #exported: S3method(predict, ellipsoid) S3method(print, agnes) S3method(print, clara) S3method(print, diana) S3method(print, dissimilarity) S3method(print, ellipsoid) S3method(print, fanny) S3method(print, mona) S3method(print, pam) S3method(print, clusGap) S3method(print, summary.agnes) S3method(print, summary.clara) S3method(print, summary.diana) S3method(print, summary.dissimilarity) S3method(print, summary.fanny) S3method(print, summary.mona) S3method(print, summary.pam) S3method(print, summary.silhouette) S3method(summary, agnes) S3method(summary, clara) S3method(summary, diana) S3method(summary, dissimilarity) S3method(summary, fanny) S3method(summary, mona) S3method(summary, pam) S3method(summary, silhouette) cluster/inst/0000755000176200001440000000000014764134400012713 5ustar liggesuserscluster/inst/CITATION0000644000176200001440000000275414402061503014050 0ustar liggesusers## -*- R -*- PKG <- "cluster" citHeader(paste("To cite the R package ",PKG," in publications use:")) if(!exists("meta") || is.null(meta)) meta <- packageDescription(PKG) stopifnot(meta$Package == PKG) year <- sub(".*(2[[:digit:]]{3})-.*", "\\1", meta$Date) vers <- paste("R package version", meta$Version) url <- paste0("https://CRAN.R-project.org/package=", PKG) bibentry(bibtype = "Manual", title = "cluster: Cluster Analysis Basics and Extensions", author = c( person("Martin", "Maechler", email="maechler@stat.math.ethz.ch", role = c("aut", "cre"), comment = "enhancements, speed improvements, bug fixes, since 2000"), person("Peter", "Rousseeuw", email="rousse@uia.ua.ac.be", role="aut"), person("Anja", "Struyf", email="Anja.Struyf@uia.ua.ac.be", role="aut"), person("Mia", "Hubert", email="Mia.Hubert@uia.ua.ac.be", role="aut"), person("Kurt", "Hornik", role=c("trl","ctb"), comment = "R port; and much initial help file fixing, 1998--2000") ), year = year, url = url, note = paste(vers,"---", "For new features, see the 'NEWS' and the 'Changelog' file in the package source)"), ## FIXME: rather give the URL to the manual on CRAN ??? ## url = "http://stat.ethz.ch/CRAN/src/contrib/........", textVersion = paste0( "Maechler, M., Rousseeuw, P., Struyf, A., Hubert, M., Hornik, K.(", year, "). cluster: Cluster Analysis Basics and Extensions. ", vers, ".") ) cluster/inst/po/0000755000176200001440000000000014764126505013340 5ustar liggesuserscluster/inst/po/de/0000755000176200001440000000000014764126505013730 5ustar liggesuserscluster/inst/po/de/LC_MESSAGES/0000755000176200001440000000000014764126505015515 5ustar liggesuserscluster/inst/po/de/LC_MESSAGES/R-cluster.mo0000644000176200001440000003201414044453203017717 0ustar liggesusersÞ•a$ƒ,8‡97Áù '- 3U ‰ 2ª 9Ý 1 ?I 5‰ ?¿ $ÿ M$ &r ™ )ª Ô Có @7 $x < ;Ú ! 8 8Y J’ -Ý ½ 4ÉVþ>U<”ÑLQ2ž.Ñ+2,;_6›?ÒBTUGªEòK82„>·vö/m,;Ê184T8‰7Â0ú8+-d5’)ÈMò6@0w¨Ç$Û/F`y%–B¼"ÿ&"7I  ¢/¯1ß\5nF¤#ë2:B})”'¾æ!÷v‡> Wx*“G¾&A-<o6¬Kã6/ Of %¶ ]Ü &:!a!*t!"Ÿ!GÂ!@ ")K"Cu"N¹"'#(0#MY#J§#Lò#Ú?$K%_f%AÆ%C&‹L&QØ&/*'"Z')}'1§'JÙ'=$(Ab(M¤(eò(UX)Q®)]*8^*F—*}Þ*:\+)—+@Á+3,6,7Q,B‰,?Ì,1 -A>-=€-@¾-.ÿ-T..5ƒ.<¹..ö.%/)?/!i/‹/¤/Á/Ý/ü/)0OF0+–0/Â0Mò0 @1a17q18©1Xâ1-;2Ji2.´2>ã29"3\3,t3-¡3Ï3&å3=[ S0NYR7^/< H@1IB2, WL5]!;G*%T6A_9+U\Q Z(E O`K4 #V&XJ):aD.3P>?"$-CF8'M%d observation (%s) has *only* NAs --> omit them for clustering!%d observations (%s ...) have *only* NAs --> omit them for clustering!%s has constant columns %s; these are standardized to 0%s has invalid column names%s must be in 1:ncol(x)%s must contain column names or numbers'A' must be p x p cov-matrix defining an ellipsoid'B' has to be a positive integer'col.clus' should have length 4 when color is TRUE'dmatrix' is not a dissimilarity matrix compatible to 'x''full' must be FALSE, TRUE, or a number in [0, 1]'iniMem.p' must be a nonnegative n * k matrix with rowSums == 1'k' (number of clusters) must be in {1,2, .., n/2 -1}'m', a membership matrix, must be nonnegative with rowSums == 1'maxit' must be non-negative integer'medoids' must be NULL or vector of %d distinct indices in {1,2, .., n}, n=%d'memb.exp' must be a finite number > 1'n' must be >= 2'par.method' must be of length 1, 3, or 4'samples' should be at least 1'sampsize' = %d should not be larger than the number of objects, %d'sampsize' should be at least %d = max(2, 1+ number of clusters)'weights' must be of length p (or 1)'x' is a "dist" object, but should be a data matrix or frame'x' is not and cannot be converted to class "dissimilarity"'x' must be numeric n x p matrix'x' must only have integer codes>>>>> funny case in clusplot.default() -- please report!All variables must be binary (e.g., a factor with 2 levels, both present).Cannot keep data when 'x' is a dissimilarity!Distance computations with NAs: using correct instead of pre-2016 wrong formula. Use 'correct.d=FALSE' to get previous results or set 'correct.d=TRUE' explicitly to suppress this warning.Distances must be result of dist or a square matrix.Each of the random samples contains objects between which no distance can be computed.Error in C routine for the spanning ellipsoid, rank problem??FANNY algorithm has not converged in 'maxit' = %d iterationsFor each of the %d samples, at least one object was found which could not be assigned to a cluster (because of missing values).Missing values were displaced by the median of the corresponding variable(s)NA values in the dissimilarity matrix not allowed.NA-values are not allowed in clustering vectorNA-values are not allowed in dist-like 'x'.NA-values in the dissimilarity matrix not allowed.Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'No clustering performed, NA's in dissimilarity matrix.No clustering performed, NA-values in the dissimilarity matrix.No clustering performed, NAs in the computed dissimilarity matrix.No clustering performed, a variable was found with all non missing values identical.No clustering performed, all variables have at least one missing value.No clustering performed, an object was found with all values missing.No clustering performed, found variable with more than half values missing.No valid silhouette information (#{clusters} =? 1)Number of clusters 'k' must be in {1,2, .., n-1}; hence n >= 2Observation %s has *only* NAs --> omit it for clusteringObservations %s have *only* NAs --> omit them for clustering!Set either 'variant' or 'pamonce', but not bothThe clustering vector is of incorrect lengthThe number of cluster should be at least 1 and at most n-1.algorithm possibly not converged in %d iterationsambiguous clustering methodat least one binary variable has more than 2 levels.at least one binary variable has not 2 different levels.at least one binary variable has values not in {0,1,NA}binary variable(s) %s treated as interval scaledclustering 'x' and dissimilarity 'dist' are incompatiblecomputed some negative or all 0 probabilitiesellipsoidPoints() not yet implemented for p >= 3 dim.error from .C(cl_pam, *): invalid medID'sfull silhouette is only available for results of 'clara(*, keep.data = TRUE)'have %d observations, but not more than %d are allowedindex has to be a function or a list of functioninvalid %s; must be named listinvalid 'correct.d'invalid 'jstop' from .C(cl_clara,.):invalid 'silhouette' objectinvalid 'spaceH0':invalid 'twins' objectinvalid clustering methodinvalid partition objectinvalid silhouette structureinvalid type %s for column numbers %smona() needs at least p >= 2 variables (in current implementation)need at least 2 objects to clusterno diss nor data found for clusplot()'no diss nor data found, nor the original argument of %sno points without missing valuesomitting NAsone or more objects contain only missing valuesone or more variables contain only missing valuessetting 'logical' variable %s to type 'asymm'setting 'logical' variables %s to type 'asymm'specified both 'full' and 'subset'; will use 'subset'the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ?the square matrix is not symmetric.when 'medoids.x' is FALSE, 'keep.data' must be toowith mixed variables, metric "gower" is used automaticallyx is not a data matrixx is not a dataframe or a numeric matrix.x is not a numeric dataframe or matrix.x is not numericx must be a matrix or data frame.Project-Id-Version: R-4.1.0 cluster 2.1.2 Report-Msgid-Bugs-To: bugs.r-project.org PO-Revision-Date: 2021-05-04 15:37+0200 Last-Translator: Detlef Steuer Language-Team: R Core Team ausgelassen für Clustering%d Beobachtungen (%s) haben *nur* NAs --> ausgelassen für Clustering%s hat konstante Spalten %s; diese werden standardisiert auf 0%s hat unzulässige Spaltennamen%s muss aus 1:ncol(x) sein%s muss Spaltennamen oder Zahlen enthalten'A' muss eine p x p Kovarianzmatrix sein, die einen Ellipsoid definiert'B' muss eine positive ganze Zahl sein'col.clus' sollte Länge 4 haben, wenn color auf TRUE gesetzt ist'dmatrix' ist keine zu 'x' kompatible Unähnlichkeitsmatrix 'full' muss FALSE, TRUE oder eine Zahl aus [0, 1] sein'iniMem.p' muss eine nicht-negative n x k Matrix mit Zeilensummen == 1 sein'k' (Anzahl Cluster) muss aus {1, 2, ..., n/2 -1} sein'm' ist eine Mitgliedswertmatrix, muss nicht-negativ sein mit Zeilensummen == 1'maxit' muss nicht-negative Zahl sein'medoids' muss NULL oder ein Vektor von %d verschiedenen Indizes aus {1, 2,..., n}, n=%d sein'memb.exp' muss endliche Zahl > 1 sein'n' muss >= 2 sein'par.method' muss Länge 1, 3 oder 4 haben'samples' sollte mindestens 1 sein'sampsize' = %d; sollte nicht größer sein als die Zahl der Objekte %d'sampsize' sollte mindestens %d = max(2, 1+ Anzahl Cluster sein)'weights' muss von Länge p (oder 1) sein'x' ist ein "dist"-Objekt, sollte aber Datenmatrix oder -frame sein'x' ist nicht und kann auch nicht umgewandelt werden in Klasse "dissimilarity"'x' muss numerische n x p - Matrix sein'x' darf nur ganzzahlige Kodes enthalten>>>>> komische Sache in clusplot.default() -- bitte an den Entwickler senden!Alle Variablen müssen binär sein (z.B. Faktor mit 2 vorhandenen Stufen).Kann Datenmatrix 'data' nicht beibehalten wenn 'x' eine 'dissimilarity' ist!Abstandsberechnungen mit NAs: nutze korrekte anstelle der falschen Formel, wie vor 2016. Nutze 'correct.d=FALSE', um die alten, falschen Ergebnisse zu bekommen oder 'correct.d=TRUE', um diese Warnung zu unterdrücken.Distanzen müssen ein Ergebnis von dist oder eine quadratische Matrix sein.Jede der Zufallsstichproben enthält Objekte, zwischen denen kein Abstand berechnet werden kannFehler im C-Kode für den aufspannenden Ellipsoiden, Rangproblem?FANNY Algorithmus ist in 'maxit' = %d Iterationen nicht konvergiertFür jede der %d Stichproben wurde mindestens ein Objekt gefunden, das nicht einem Cluster zugeordnet werden konnte (wegen fehlender Werte)Fehlende Werte wurden durch den Median der korrespondierenden Variable(n) ersetztNAs in der Unähnlichkeitsmatrix nicht erlaubt.NAs im Clustervektor nicht erlaubtNAs nicht erlaubt in dist-ähnlichem 'x'.NAs in der Unähnlichkeitsmatrix nicht zulässig.Benötige entweder Unähnlichkeitsmatrix 'dist' oder diss.matrix 'dmatrix'Keine Clusterung durchgeführt, NAs in Unähnlichkeitsmatrix.Keine Clusterung durchgeführt. NAs in der Unähnlichkeitsmatrix.Keine Clusterung durchgeführt, NAs in der berechneten Unähnlichkeitsmatrix.Keine Clusterung durchgeführt. Variable gefunden, bei der alle nicht fehlenden Werte identisch sind.Keine Clusterung durchgeführt. Alle Variablen haben mindestens einen fehlenden Wert.Keine Clusterung durchgeführt. Objekt gefunden, bei dem alle Werte fehlend sind.Keine Clusterung durchgeführt. Variable gefunden, mit mehr als der Hälfte fehlenden Werten.keine gültige Silhouetteninformation (#{clusters} =? 1)Anzahl der Cluster 'k' muss auch {1, 2, ..., n-1} sein; deshalb n >= 2Beobachtung %s hat *nur* NAs --> ausgelassen für ClusteringBeobachtungen %s haben *nur* NAs --> ausgelassen für ClusteringEntweder 'variant' oder 'pamonce' setzen, aber nicht beideDer Clustervektor hat eine falsche LängeDie Anzahl der Cluster sollte mindestens 1, höchstens n-1 sein.Algorithmus hat nicht in %d Iterationen konvergiertzweideutige Clustermethodemindestens eine binäre Variable hat mehr als 2 Stufen.mindestens eine binäre Variable hat keine 2 verschiedenen Stufen.mindestens eine binäre Variable hat Werte nicht aus {0, 1, NA}Binärvariable %s als intervallskaliert behandeltClusterung 'x' und Unähnlichkeitsmatrix 'dist' sind inkompatibeleinige negative Wahrscheinlichkeiten oder alle zu 0 berechnetellipsoidPoints() noch nicht für Dimensionen p>=3 implementiertFehler aus .C(cl_pam, *): unzulässige medID'sdie volle Silhoutte ist nur verfügbar für Resultate von 'clara(*, keep.data=TRUE)'habe %d Beobachtungen, aber mehr als %d nicht erlaubtindex muss eine Funktion oder eine Liste von Funktionen seinunzulässige %s; muss eine benannte Liste seinunzulässiges 'correct.d'unzulässiger 'jstop' aus .C(cl_clara,.):unzulässiges 'silhouette' Objektunzulässiger 'spaceH0':unzulässiges 'twins'-Objektunzulässige Clustermethodeunzulässiges Partitionsobjektunzulässige Silhouttenstrukturungültiger Typ %s für Spaltennummern %smona() (in der aktuellen Implementierung) benötigt mindestens p >= 2 Variablenbenötige zum Clustern mindestens 2 Objekteweder diss noch data für 'clusplot()' gefundenweder diss noch data gefunden, ebensowenig das ursprüngliche Argument von %skeine Punkte ohne fehlende WerteNAs ausgelasseneines oder mehrere Objekte enthalten nur fehlende Werteeine oder mehrere Variablen enthalten nur fehlende Wertesetze 'logical' Variable %s auf Typ 'asymm'setze 'logical' Variablen %s auf Typ 'asymm''full' und 'subset' angegeben; nutze 'subset'die Mitgliedswerte sind alle sehr nah an 1/k. Evtl. 'memb.exp' reduzieren?Die quadratische Matrix ist nicht symmetrisch.wenn 'medoids.x' FALSE ist, dann muss es auch 'keep.data' seinmit gemischten Variablen wird automatisch "gower" genutztx ist keine Datenmatrixx ist weder Dataframe noch numerische Matrixx ist weder numerischer Dataframe noch Matrixx ist nicht numerischx muss eine Matrix oder Dataframe seincluster/inst/po/de/LC_MESSAGES/cluster.mo0000644000176200001440000000233314005347355017530 0ustar liggesusersÞ•\ œÈ$É9î(H:IƒÍ*æX$jAÑ]èJF‘*°C level clara(): random k=%d > n ** C level dysta2(): nsel[%s= %d] = %d is outside 0..n, n=%dInvalid 'medoids'agnes(method=%d, par.method=*) lead to invalid merge; step %d, D(.,.)=%gclara()'s C level dysta2(nsam=%d, p=%d, nbest=%d, n=%d) gave 'toomany_NA'invalid method (code %d)pam(): Bug in C level cstat(), k=%d: ntt=0Project-Id-Version: cluster 2.0.1 Report-Msgid-Bugs-To: PO-Revision-Date: 2015-02-02 12:30+0100 Last-Translator: Detlef Steuer Language-Team: R Core Language: DE MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=n == 1 ? 0 : 1; C Level clara(): random k=%d > n ** C Level dysta2(): nsel[%s= %d] = %d ist außerhalb von 0..n, n=%dunzulässige 'medoids'agnes(method=%d, par.method=*) führte zu unzulässigem Zusammenfassen; Schritt %d, D(.,.)=%gclara()'s C Level dysta2(nsam=%d, p=%d, nbest=%d, n=%d) ergab 'toomany_NA'unzulässige Methode (Kode %d)pam(): Bug in C Level cstat(), k=%d: ntt=0cluster/inst/po/pl/0000755000176200001440000000000014764126505013753 5ustar liggesuserscluster/inst/po/pl/LC_MESSAGES/0000755000176200001440000000000014764126505015540 5ustar liggesuserscluster/inst/po/pl/LC_MESSAGES/R-cluster.mo0000644000176200001440000002755114005347355017763 0ustar liggesusersÞ•UÄql0‡17¹ñ '%3M 2¢9Õ? 5O ?… $Å Mê &8 _ )p š C¹ @ý $> <c ;  !Ü þ 8 4X V <ä ! L¡ 2î .!+P2|;¯6ë?"BbT¥GúEBKˆ2Ô>vF,½;ê1&X4t8©7â08K-„5²)èM`$¤À×ñ %'"M&p7— Ï ð/ý1-\_F¼#2':Z•)¬'Öþ!ò1ú$B#b#†)ªCÔ+ND9“>ÍD ?Q0‘fÂ,)V-r) DÊ@,PF}VÄ' <C K€ BÌ j!=z!”¸!OM"3"4Ñ"7#3>#7r#9ª#:ä#D$Yd$Z¾$T%Tn%;Ã%Nÿ%ãN&12'@d'<¥'!â'B(EG(D(CÒ(8)KO)M›)-é)P*)h*'’*º*Ú*õ*+!0+&R+.y+;¨+Aä+(&,O,Cf,@ª,‘ë,F}-(Ä-Cí-C1.&u.@œ.9Ý./35/R"!LMU2E (  5+7*<G9-SQ%;84'K#AJ/6&O $0:BHFN=?PD@ 1)C.,>T I3%d observation (%s) has *only* NAs --> omit them for clustering!%d observations (%s ...) have *only* NAs --> omit them for clustering!%s has constant columns %s; these are standardized to 0%s has invalid column names%s must be in 1:ncol(x)%s must contain column names or numbers'A' must be p x p cov-matrix defining an ellipsoid'B' has to be a positive integer'col.clus' should have length 4 when color is TRUE'dmatrix' is not a dissimilarity matrix compatible to 'x''iniMem.p' must be a nonnegative n * k matrix with rowSums == 1'k' (number of clusters) must be in {1,2, .., n/2 -1}'m', a membership matrix, must be nonnegative with rowSums == 1'maxit' must be non-negative integer'medoids' must be NULL or vector of %d distinct indices in {1,2, .., n}, n=%d'memb.exp' must be a finite number > 1'n' must be >= 2'par.method' must be of length 1, 3, or 4'samples' should be at least 1'sampsize' = %d should not be larger than the number of objects, %d'sampsize' should be at least %d = max(2, 1+ number of clusters)'weights' must be of length p (or 1)'x' is a "dist" object, but should be a data matrix or frame'x' is not and cannot be converted to class "dissimilarity"'x' must be numeric n x p matrix'x' must only have integer codes>>>>> funny case in clusplot.default() -- please report!Distances must be result of dist or a square matrix.Each of the random samples contains objects between which no distance can be computed.FANNY algorithm has not converged in 'maxit' = %d iterationsFor each of the %d samples, at least one object was found which could not be assigned to a cluster (because of missing values).Missing values were displaced by the median of the corresponding variable(s)NA values in the dissimilarity matrix not allowed.NA-values are not allowed in clustering vectorNA-values are not allowed in dist-like 'x'.NA-values in the dissimilarity matrix not allowed.Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'No clustering performed, NA's in dissimilarity matrix.No clustering performed, NA-values in the dissimilarity matrix.No clustering performed, NAs in the computed dissimilarity matrix.No clustering performed, a variable was found with all non missing values identical.No clustering performed, all variables have at least one missing value.No clustering performed, an object was found with all values missing.No clustering performed, found variable with more than half values missing.No valid silhouette information (#{clusters} =? 1)Number of clusters 'k' must be in {1,2, .., n-1}; hence n >= 2Observation %s has *only* NAs --> omit it for clusteringObservations %s have *only* NAs --> omit them for clustering!The clustering vector is of incorrect lengthThe number of cluster should be at least 1 and at most n-1.algorithm possibly not converged in %d iterationsambiguous clustering methodat least one binary variable has more than 2 levels.at least one binary variable has not 2 different levels.at least one binary variable has values not in {0,1,NA}binary variable(s) %s treated as interval scaledclustering 'x' and dissimilarity 'dist' are incompatiblecomputed some negative or all 0 probabilitiesellipsoidPoints() not yet implemented for p >= 3 dim.error from .C(cl_pam, *): invalid medID'sfull silhouette is only available for results of 'clara(*, keep.data = TRUE)'invalid %s; must be named listinvalid 'jstop' from .C(cl_clara,.):invalid 'silhouette' objectinvalid 'twins' objectinvalid clustering methodinvalid partition objectinvalid silhouette structureinvalid type %s for column numbers %sneed at least 2 objects to clusterno diss nor data found for clusplot()'no diss nor data found, nor the original argument of %sno points without missing valuesomitting NAsone or more objects contain only missing valuesone or more variables contain only missing valuessetting 'logical' variable %s to type 'asymm'setting 'logical' variables %s to type 'asymm'the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ?the square matrix is not symmetric.when 'medoids.x' is FALSE, 'keep.data' must be toowith mixed variables, metric "gower" is used automaticallyx is not a data matrixx is not a dataframe or a numeric matrix.x is not a numeric dataframe or matrix.x is not numericx must be a matrix or data frame.Project-Id-Version: cluster 1.15.1 Report-Msgid-Bugs-To: bugs.r-project.org PO-Revision-Date: 2014-03-27 17:34+0100 Last-Translator: Åukasz Daniel Language-Team: Åukasz Daniel Language: pl_PL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2); X-Poedit-SourceCharset: iso-8859-1 X-Generator: Poedit 1.5.4 %d obserwacja (%s) posiada *tylko* wartoÅ›ci NA --> pomijanie jej w grupowaniu%d obserwacje (%s ...) posiadajÄ… *tylko* wartoÅ›ci NA --> pomijanie ich w grupowaniu%d obserwacji (%s ...) posiadajÄ… *tylko* wartoÅ›ci NA --> pomijanie ich w grupowaniu%s posiada staÅ‚e kolumny %s; zostaÅ‚y one ustandaryzowane do zera%s posiada niepoprawne nazwy kolumn%s musi być w przedziale 1:ncol(x)%s musi zawierać nazwy kolumn lub liczby'A' musi być macierzÄ… kowariancji p x p okreÅ›lajÄ…cÄ… elipsoidÄ™'B' musi być dodatniÄ… liczbÄ… caÅ‚kowitÄ…argument 'col.clus' powinien mieć dÅ‚ugość 4, gdy 'color' ma wartość TRUE'dmatrix' nie jest macierzÄ… różnic kompatybilnÄ… z 'x''iniMem.p' musi być nieujemnÄ… maceirzÄ… n x k z rowSums == 1'k' (liczba grup) musi mieÅ›cić siÄ™ w przedziale {1,2, .., n/2 -1}macierz przynależnoÅ›ci 'm' musi być nieujemna z rowSums == 1'maxit' musi być nieujemnÄ… liczbÄ… caÅ‚kowitÄ…argument 'medoids' musi być wartoÅ›ciÄ… NULL lub wektorem %d różnych indeksów w {1,2, .., n}, n=%d'memb.exp' musi być skoÅ„czonÄ… liczbÄ… > 1argument 'n' musi być >= 2'par.method' musi być dÅ‚ugoÅ›ci 1, 3, lub 4'samples' powinno wynosić przynajmniej 1'sampsize' = %d nie powinien być wiÄ™kszy niż liczba obiektów, %d'sampsize' powinien być co najmniej %d = max(2, 1+ liczba grup)'weights' musi być o dÅ‚ugoÅ›ci 'p' (lub 1)'x' jest obiektem klasy "dist", ale powinien być macierzÄ… lub ramkÄ…argument 'x' nie jest i nie może być przeksztaÅ‚cony na obiekt klasy "dissimilarity"'x' musi być liczbowÄ… macierzÄ… n x p'x' musi posiadać tylko kody bÄ™dÄ…ce liczbami caÅ‚kowitymi>>>>> zabawny przypadek w 'clusplot.default()' -- proszÄ™ zgÅ‚osić raport!OdlegÅ‚oÅ›ci muszÄ… być wynikiem 'dist' lub macierzy kwadratowej.Każda z losowych próbek zawiera obiekty pomiÄ™dzy którymi żadna odlegÅ‚ość nie może być obliczona.algorytm FANNY nie uzbieżniÅ‚ siÄ™ w 'maxit' = %d iteracjachDla każdej z %d próbek, co najmniej jeden obiekt zostaÅ‚ znaleziony, który nie mógÅ‚ być przypisany do grupy (z uwagi na brakujÄ…ce wartoÅ›ci).BrakujÄ…ce wartoÅ›ci zostaÅ‚y zastÄ…pione przez medianÄ™ odpowiednich zmiennychwartoÅ›ci NA w macierzy różnic nie sÄ… dozwolone.wartoÅ›ci NA sÄ… niedozwolone w wektorze grupujÄ…cymwartoÅ›ci NA nie sÄ… dozwolone w 'x' typu odlegÅ‚oÅ›ci.wartoÅ›ci NA w macierzy różnic nie sÄ… dozwolone.Potrzeba albo różnic 'dist' lub diss.matrix 'dmatrix'Nie wykonano grupowania, wartoÅ›ci NA w macierzy różnicNie wykonano grupowania, wartoÅ›ci NA w macierzy różnic.Nie wykonano grupowania, wyliczono wartoÅ›ci NA w macierzy różnic.Nie wykonano grupowania, znaleziono zmiennÄ… z identycznymi niebrakujÄ…cymi wartoÅ›ciami.Nie wykonano grupowania, wszystkie zmienne majÄ… co najmniej jednÄ… brakujÄ…cÄ… wartość.Nie wykonano grupowania, znaleziono obiekt któremu brakowaÅ‚o wszystkich wartoÅ›ci.Nie wykonano grupowania, znaleziono obiekt któremu brakowaÅ‚o wszystkich wartoÅ›ci.Brak poprawnej informacji o sylwetce (czy liczba grup =? 1)Liczba grup 'k' musi zawierać siÄ™ w zbiorze {1,2, .., n-1}; tak wiÄ™c n >= 2Obserwacja %s posiada *tylko* wartoÅ›ci NA --> pomijanie jej w grupowaniuObserwacje %s posiadajÄ… *tylko* wartoÅ›ci NA --> pomijanie ich w grupowaniuObserwacje %s posiadajÄ… *tylko* wartoÅ›ci NA --> pomijanie ich w grupowaniuWektor grupujÄ…cy posiada niepoprawnÄ… dÅ‚ugośćLiczba grup powinna wynosić conajmniej 1 oraz co najwyżej n-1.algorytm prawdopodobnie nie uzbieżniÅ‚ siÄ™ w %d iteracjachniejednoznaczna metoda grupowaniaprzynajmniej jedna zmienna binarna posiada wiÄ™cej niż 2 poziomy.przynajmniej jedna zmienna binarna nie posiada 2 różnych poziomów.przynajmniej jedna zmienna binarna posiada wartoÅ›ci poza {0, 1, NA}zmienne binarne %s traktowane jako interwaÅ‚ zostaÅ‚y przeskalowanegrupowane 'x' oraz różnice 'dist' nie sÄ… kompatybilneniektóre wyliczone prawdopodobieÅ„stwa sÄ… ujemne lub wszystkie sÄ… zerami'ellipsoidPoints()' nie zostaÅ‚a jeszcze zaimplementowana dla p >= 3 wymiary.błąd w '.C(cl_pam, *)': niepoprawne 'medID'peÅ‚na sylwetka jest dostÄ™pna jedynie dla wyników 'clara(*, keep.data = TRUE)'niepoprawne %s; musi być nazwanÄ… listÄ…niepoprawny 'jstop' z '.C(cl_clara,.)':niepoprawny obiekt 'silhouette'niepoprawny obiekt 'twins'niepoprawna metoda grupowanianiepoprawny obiekt podziaÅ‚uniepoprana struktura 'silhouette'niepoprawny typ %s dla liczb kolumn %spotrzeba co najmniej 2 obiektów do grupowanianie znaleziono różnic ani danych dla funkcji 'clusplot()'nie znaleziono różnic ani danych, ani oryginalnego argumentu %sbrak punktów bez brakujÄ…cych wartoÅ›cipomijanie wartoÅ›ci NAjeden lub wiÄ™cej obiektów zawierajÄ… jedynie wartoÅ›ci brakujÄ…cejeden lub wiÄ™cej zmiennych zawiera jedynie wartoÅ›ci brakujÄ…ceustawianie zmiennej 'logical' %s na tym 'asymm'ustawianie zmiennych 'logical' %s na tym 'asymm'ustawianie zmiennych 'logical' %s na tym 'asymm'przynależnoÅ›ci sÄ… bardzo bliskie 1/k. Może zmniejszyć 'memb.exp'?macierz kwadratowa nie jest symetryczna.kiedy 'medoids.x' jest FALSE, 'keep.data' musi być również FALSEz mieszanymi zmiennymi, metryka 'gower' jest używana automatycznieargument 'x' nie jest macierzÄ… danychargument 'x' nie jest ramkÄ… danych ani też macierzÄ… liczbowÄ…argument 'x' nie jest ramkÄ… liczbowÄ… ani też macierzÄ…argument 'x' nie jest liczbÄ…argument 'x' musi być macierzÄ… lub ramkÄ… danych.cluster/inst/po/fr/0000755000176200001440000000000014764126505013747 5ustar liggesuserscluster/inst/po/fr/LC_MESSAGES/0000755000176200001440000000000014764126505015534 5ustar liggesuserscluster/inst/po/fr/LC_MESSAGES/R-cluster.mo0000644000176200001440000003342514036313671017752 0ustar liggesusersÞ•a$ƒ,8‡97Áù '- 3U ‰ 2ª 9Ý 1 ?I 5‰ ?¿ $ÿ M$ &r ™ )ª Ô Có @7 $x < ;Ú ! 8 8Y J’ -Ý ½ 4ÉVþ>U<”ÑLQ2ž.Ñ+2,;_6›?ÒBTUGªEòK82„>·vö/m,;Ê184T8‰7Â0ú8+-d5’)ÈMò6@0w¨Ç$Û/F`y%–B¼"ÿ&"7I  ¢/¯1ß\5nF¤#ë2:B})”'¾æ!÷G•a@÷$8$]4‚I· >"EaJ§Gò4: Ko )» cå (I!r!-†! ´!CÕ!B")\"K†"QÒ"+$#'P#Xx#mÑ#M?$$I–%pà%XQ&Bª&…í&cs'R×'O*(Hz(VÃ(Y)Kt)XÀ)Y*es*`Ù*R:+e+<ó+E0,v,O-3W-7‹-BÃ-.;&.9b.Eœ.Râ.K5/L/:Î// 0`90;š07Ö0+1:1,P1}1š1°1!È1"ê1" 2102Mb2E°25ö2H,3#u3™3@¯3Dð3w54D­4Uò4)H5=r5R°5#6J'6Jr6½6@Ô6=[ S0NYR7^/< H@1IB2, WL5]!;G*%T6A_9+U\Q Z(E O`K4 #V&XJ):aD.3P>?"$-CF8'M%d observation (%s) has *only* NAs --> omit them for clustering!%d observations (%s ...) have *only* NAs --> omit them for clustering!%s has constant columns %s; these are standardized to 0%s has invalid column names%s must be in 1:ncol(x)%s must contain column names or numbers'A' must be p x p cov-matrix defining an ellipsoid'B' has to be a positive integer'col.clus' should have length 4 when color is TRUE'dmatrix' is not a dissimilarity matrix compatible to 'x''full' must be FALSE, TRUE, or a number in [0, 1]'iniMem.p' must be a nonnegative n * k matrix with rowSums == 1'k' (number of clusters) must be in {1,2, .., n/2 -1}'m', a membership matrix, must be nonnegative with rowSums == 1'maxit' must be non-negative integer'medoids' must be NULL or vector of %d distinct indices in {1,2, .., n}, n=%d'memb.exp' must be a finite number > 1'n' must be >= 2'par.method' must be of length 1, 3, or 4'samples' should be at least 1'sampsize' = %d should not be larger than the number of objects, %d'sampsize' should be at least %d = max(2, 1+ number of clusters)'weights' must be of length p (or 1)'x' is a "dist" object, but should be a data matrix or frame'x' is not and cannot be converted to class "dissimilarity"'x' must be numeric n x p matrix'x' must only have integer codes>>>>> funny case in clusplot.default() -- please report!All variables must be binary (e.g., a factor with 2 levels, both present).Cannot keep data when 'x' is a dissimilarity!Distance computations with NAs: using correct instead of pre-2016 wrong formula. Use 'correct.d=FALSE' to get previous results or set 'correct.d=TRUE' explicitly to suppress this warning.Distances must be result of dist or a square matrix.Each of the random samples contains objects between which no distance can be computed.Error in C routine for the spanning ellipsoid, rank problem??FANNY algorithm has not converged in 'maxit' = %d iterationsFor each of the %d samples, at least one object was found which could not be assigned to a cluster (because of missing values).Missing values were displaced by the median of the corresponding variable(s)NA values in the dissimilarity matrix not allowed.NA-values are not allowed in clustering vectorNA-values are not allowed in dist-like 'x'.NA-values in the dissimilarity matrix not allowed.Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'No clustering performed, NA's in dissimilarity matrix.No clustering performed, NA-values in the dissimilarity matrix.No clustering performed, NAs in the computed dissimilarity matrix.No clustering performed, a variable was found with all non missing values identical.No clustering performed, all variables have at least one missing value.No clustering performed, an object was found with all values missing.No clustering performed, found variable with more than half values missing.No valid silhouette information (#{clusters} =? 1)Number of clusters 'k' must be in {1,2, .., n-1}; hence n >= 2Observation %s has *only* NAs --> omit it for clusteringObservations %s have *only* NAs --> omit them for clustering!Set either 'variant' or 'pamonce', but not bothThe clustering vector is of incorrect lengthThe number of cluster should be at least 1 and at most n-1.algorithm possibly not converged in %d iterationsambiguous clustering methodat least one binary variable has more than 2 levels.at least one binary variable has not 2 different levels.at least one binary variable has values not in {0,1,NA}binary variable(s) %s treated as interval scaledclustering 'x' and dissimilarity 'dist' are incompatiblecomputed some negative or all 0 probabilitiesellipsoidPoints() not yet implemented for p >= 3 dim.error from .C(cl_pam, *): invalid medID'sfull silhouette is only available for results of 'clara(*, keep.data = TRUE)'have %d observations, but not more than %d are allowedindex has to be a function or a list of functioninvalid %s; must be named listinvalid 'correct.d'invalid 'jstop' from .C(cl_clara,.):invalid 'silhouette' objectinvalid 'spaceH0':invalid 'twins' objectinvalid clustering methodinvalid partition objectinvalid silhouette structureinvalid type %s for column numbers %smona() needs at least p >= 2 variables (in current implementation)need at least 2 objects to clusterno diss nor data found for clusplot()'no diss nor data found, nor the original argument of %sno points without missing valuesomitting NAsone or more objects contain only missing valuesone or more variables contain only missing valuessetting 'logical' variable %s to type 'asymm'setting 'logical' variables %s to type 'asymm'specified both 'full' and 'subset'; will use 'subset'the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ?the square matrix is not symmetric.when 'medoids.x' is FALSE, 'keep.data' must be toowith mixed variables, metric "gower" is used automaticallyx is not a data matrixx is not a dataframe or a numeric matrix.x is not a numeric dataframe or matrix.x is not numericx must be a matrix or data frame.Project-Id-Version: cluster 1.14.5 PO-Revision-Date: 2021-04-12 18:49+0200 Last-Translator: Philippe Grosjean Language-Team: none Language: fr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Generator: Poedit 2.4.2 Plural-Forms: nplurals=2; plural=(n > 1); %d observation (%s) n'a *que* des NAs --> ignorée pour le regroupement!%d observations (%s) n'ont *que* des NAs --> ignorées pour le regroupement!%s a des colonnes constantes %s ; elles sont standardisées à 0%s a des noms de colonnes incorrects%s doit être compris dans 1:ncol(x)%s doit contenir des noms de colonnes ou des nombres'A doit être une matrice de covariance p x p définissant un ellipsoïde'B' doit être un entier positif'col.clus' doit avoir une longueur de 4 lorsque color est TRUE'dmatrix' n'est pas une matrice de dissimilarité compatible avec 'x''full' doit être parmi FALSE, TRUE, ou un nombre de l’intervalle [0, 1]'iniMem.p' doit être une matrice n * k non négative avec rowSums == 1'k' (nombre de groupes) doit être {1,2,…, n/2 -1}'m', une matrice d'appartenance, doit être non négative avec rowSums == 1'maxit' doit être un entier non négatif'medoids' doit être NULL ou un vecteur de %d valeurs d'indices distincts dans {1, 2, …, n}, n=%d'memb.exp' doit être un nombre fini > 1'n' doit être >= 2'par.method' doit être de longueur 1, 3 ou 4'samples' doit valoir au moins 1'sampsize' = %d ne peut être plus grand que le nombre d'objets, %d'sampsize' doit être au minimum %d = max(2, 1+ nombre de groupes)'weights' doit être de longueur p (ou 1)'x' est un objet "dist", mais il faut une matrice ou un tableau de données'x' n'est pas et ne peux pas être converti en un objet de classe "dissimilarity"'x' doit être une matrice numérique n x p'x' ne doit avoir que des codes entiers>>>>> cas pathologique dans clusplot.default() -- veuillez envoyer un rapport de bogue !Toutes les variables doivent être booléennes (c'est-à-dire, des variables facteur à 2 niveaux présents).Impossible de conserver les données lorsque 'x' est un objet dissimilarity !Calcul de distances avec NAs : utilisation de la formule corrigée à la place de celle d’avant 2016 qui était erronnée. Utilisez 'correct.d=FALSE' pour obtenir les résultats d'avant, ou indiquez 'correct.d=TRUE' de manière explicite pour éliminer cet avis.Les distances doivent résulter d'un objet dist ou d'une matrice carrée.Chacun des échantillons aléatoires contient des objets entre lesquels aucune distance ne peut être calculée.Erreur dans la routine C pour obtenir l'ellipsoïde de dispersion, problème de rang ??L’algorithme FANNY n'a pas convergé en 'maxit' = %d itérationsDans chacun des %d échantillons, au moins un objet ne peut être assigné à un groupe (parce qu'il contient des valeurs manquantes)Les valeurs manquantes ont été remplacées par la médiane de la ou des variables correspondantesLes valeurs manquantes (NA) ne sont pas admises dans la matrice de dissimilarité.Les valeurs manquantes NA ne sont pas autorisées dans le vecteur d'agrégationLes valeurs manquantes NA ne sont pas autorisées dans 'x' de type dist.Les valeurs manquantes (NA) ne sont pas autorisées dans la matrice de dissimilarité.Il faut soit un objet 'dist' de dissimilarité ou une matrice de dissimilarité 'dmatrix'Aucune agrégation n'est réalisée, NAs dans la matrice de dissimilarité.Aucune agrégation n'est réalisée, présence de NAs dans la matrice de dissimilarité.Aucune agrégation n'a été effectuée, NAs dans la matrice de dissimilarité calculée.Aucune agrégation n'a été effectuée, une variable a toutes ses valeurs non manquantes identiques.Aucune agrégation n'a été effectuée, toutes les variables ont au moins une valeur manquante.Aucune agrégation n'a été effectuée, un objet a toutes ses valeurs manquantes.Aucune agrégation n'a été effectuée, une variable a plus de la moitié de ses valeurs manquantes.Aucune valeur de silhouette n'est correcte (#{groupes} =? 1)Le nombre de groupes 'k' doit être dans {1,2, …, n-1} ; où n >= 2L'observation %s n'a *que* des NAs --> ignorée pour le regroupementLes observations %s n'ont *que* des NAs --> ignorées pour le regroupement!Spécifiez soit 'variant’, soit 'pamonce’, mais pas les deux en même tempsLe vecteur d'agrégation est de longueur incorrecteLe nombre de groupes doit être entre 1 et n-1 compris.l'algorithme n'a vraisemblablement pas convergé en %d itérationsméthode d'agrégation ambigüeune des variables binaires au moins a plus de deux niveaux.une des variables binaires au moins n'a pas deux niveaux.une des variables binaires au moins a des valeurs autres que {0,1,NA}la ou les variables binaires %s sont traitées comme des intervalles standardisésl'agrégation 'x' et la matrice de dissimilarité 'dist' sont incompatiblesdes probabilités négatives ou toutes égales à zéro ont été calculéesellipsoidPoints() pas encore implémenté pour p >= 3 dim.erreur depuis .C(cl_pam, *) : medIDs incorrectsla silhouette complète n'est disponible que pour les résultats de 'clara(*, keep.data = TRUE)'il y a %d observations, mais pas plus de %d sont acceptéesindex doit être une fonction ou une liste de fonctions%s incorrect ; doit être une liste nommée'correct.d' incorrect'jstop' incorrect obtenu de .C(cl_clara,.) :objet 'silhouette' incorrect'spaceH0' incorrect :objet 'twins' incorrectméthode d'agrégation incorrecteobjet de partitionnement incorrectstructure de silhouette incorrectetype invalide %s pour les numéros de colonnes %smona() a besoin d'au moins p >= 2 variables (dans l'implémentation actuelle)au moins deux objets sont nécessaires pour effectuer une agrégationpas de diss ni de données trouvées pour clusplot()'pas de diss ni de données trouvées, ni même l'argument original de %saucun point sans valeurs manquantesvaleurs NAs ignoréesun ou plusieurs objets ne contiennent que des valeurs manquantesune ou plusieurs variables ne contiennent que des valeurs manquantesla variable 'logical' %s est transformée en type 'asymm'les variables 'logical' %s sont transformées en type 'asymm''full' et 'subset' tous deux spécifiés ; utilisation de 'subset’les appartenances sont toutes très proches de 1/k. Essayez en diminuant 'memb.exp' ?la matrice carrée n'est pas symétrique.lorsque 'medoids.x' est FALSE, 'keep.data' doit l'être aussiavec des variables mélangées, la métrique "gower" est utilisée automatiquementx n'est pas une matrice de donnéesx n'est pas un tableau de données (data frame) ni une matrice numérique.x n'est pas un tableau de données (data frame) ou une matrice numérique.x n'est pas numériquex doit être une matrice ou un tableau de données (data frame).cluster/inst/po/fr/LC_MESSAGES/cluster.mo0000644000176200001440000000242114036313671017543 0ustar liggesusersÞ•\ œÈ$É9î(H:IƒÍ*æv&ˆJ¯úVNo¾4ÜC level clara(): random k=%d > n ** C level dysta2(): nsel[%s= %d] = %d is outside 0..n, n=%dInvalid 'medoids'agnes(method=%d, par.method=*) lead to invalid merge; step %d, D(.,.)=%gclara()'s C level dysta2(nsam=%d, p=%d, nbest=%d, n=%d) gave 'toomany_NA'invalid method (code %d)pam(): Bug in C level cstat(), k=%d: ntt=0Project-Id-Version: cluster 2.0.1 Report-Msgid-Bugs-To: PO-Revision-Date: 2021-02-11 10:56+0100 Last-Translator: Philippe Grosjean Language-Team: R Core Language: fr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Generator: Poedit 2.4.2 Plural-Forms: nplurals=2; plural=(n > 1); Code C de clara(): random k=%d > n ** Code C de dysta2(): nsel[%s= %d] = %d est en dehors de la plage 0..n, n=%dLes 'medoids' sont incorrectsagnes(method=%d, par.method=*) conduit à une fusion incorrecte ; étape %d, D(.,.)=%gcode C de clara(), dysta2(nsam=%d, p=%d, nbest=%d, n=%d) a donné 'toomany_NA'méthode incorrecte (code %d)pam() : Bogue dans le code C de cstat(), k=%d: ntt=0cluster/inst/po/it/0000755000176200001440000000000014764126505013754 5ustar liggesuserscluster/inst/po/it/LC_MESSAGES/0000755000176200001440000000000014764126505015541 5ustar liggesuserscluster/inst/po/it/LC_MESSAGES/R-cluster.mo0000644000176200001440000003177014035543433017760 0ustar liggesusersÞ•a$ƒ,8‡97Áù '- 3U ‰ 2ª 9Ý 1 ?I 5‰ ?¿ $ÿ M$ &r ™ )ª Ô Có @7 $x < ;Ú ! 8 8Y J’ -Ý ½ 4ÉVþ>U<”ÑLQ2ž.Ñ+2,;_6›?ÒBTUGªEòK82„>·vö/m,;Ê184T8‰7Â0ú8+-d5’)ÈMò6@0w¨Ç$Û/F`y%–B¼"ÿ&"7I  ¢/¯1ß\5nF¤#ë2:B})”'¾æ!÷~€˜9Sq*ŒJ·!9$B^A¡Eã:) Jd )¯ RÙ *,!W!-k!"™!I¼!C")J"Ht"C½")#'+#DS#Y˜#Dò#á7$F%[`%H¼%?&ˆE&UÎ&>$'8c'0œ'>Í'< (CI(C(CÑ(a)Jw)BÂ)X*<^*E›*zá*.\+3‹+?¿+4ÿ+4,2Q,9„,;¾,<ú,?7-0w-@¨-)é-U.5i.8Ÿ.,Ø./%/B/b/x/“/³/Ñ/-ñ/F0/f0*–0?Á0"1$10712h1y›162GL2&”2<»2Kø2D3.^3.3¼3)Î3=[ S0NYR7^/< H@1IB2, WL5]!;G*%T6A_9+U\Q Z(E O`K4 #V&XJ):aD.3P>?"$-CF8'M%d observation (%s) has *only* NAs --> omit them for clustering!%d observations (%s ...) have *only* NAs --> omit them for clustering!%s has constant columns %s; these are standardized to 0%s has invalid column names%s must be in 1:ncol(x)%s must contain column names or numbers'A' must be p x p cov-matrix defining an ellipsoid'B' has to be a positive integer'col.clus' should have length 4 when color is TRUE'dmatrix' is not a dissimilarity matrix compatible to 'x''full' must be FALSE, TRUE, or a number in [0, 1]'iniMem.p' must be a nonnegative n * k matrix with rowSums == 1'k' (number of clusters) must be in {1,2, .., n/2 -1}'m', a membership matrix, must be nonnegative with rowSums == 1'maxit' must be non-negative integer'medoids' must be NULL or vector of %d distinct indices in {1,2, .., n}, n=%d'memb.exp' must be a finite number > 1'n' must be >= 2'par.method' must be of length 1, 3, or 4'samples' should be at least 1'sampsize' = %d should not be larger than the number of objects, %d'sampsize' should be at least %d = max(2, 1+ number of clusters)'weights' must be of length p (or 1)'x' is a "dist" object, but should be a data matrix or frame'x' is not and cannot be converted to class "dissimilarity"'x' must be numeric n x p matrix'x' must only have integer codes>>>>> funny case in clusplot.default() -- please report!All variables must be binary (e.g., a factor with 2 levels, both present).Cannot keep data when 'x' is a dissimilarity!Distance computations with NAs: using correct instead of pre-2016 wrong formula. Use 'correct.d=FALSE' to get previous results or set 'correct.d=TRUE' explicitly to suppress this warning.Distances must be result of dist or a square matrix.Each of the random samples contains objects between which no distance can be computed.Error in C routine for the spanning ellipsoid, rank problem??FANNY algorithm has not converged in 'maxit' = %d iterationsFor each of the %d samples, at least one object was found which could not be assigned to a cluster (because of missing values).Missing values were displaced by the median of the corresponding variable(s)NA values in the dissimilarity matrix not allowed.NA-values are not allowed in clustering vectorNA-values are not allowed in dist-like 'x'.NA-values in the dissimilarity matrix not allowed.Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'No clustering performed, NA's in dissimilarity matrix.No clustering performed, NA-values in the dissimilarity matrix.No clustering performed, NAs in the computed dissimilarity matrix.No clustering performed, a variable was found with all non missing values identical.No clustering performed, all variables have at least one missing value.No clustering performed, an object was found with all values missing.No clustering performed, found variable with more than half values missing.No valid silhouette information (#{clusters} =? 1)Number of clusters 'k' must be in {1,2, .., n-1}; hence n >= 2Observation %s has *only* NAs --> omit it for clusteringObservations %s have *only* NAs --> omit them for clustering!Set either 'variant' or 'pamonce', but not bothThe clustering vector is of incorrect lengthThe number of cluster should be at least 1 and at most n-1.algorithm possibly not converged in %d iterationsambiguous clustering methodat least one binary variable has more than 2 levels.at least one binary variable has not 2 different levels.at least one binary variable has values not in {0,1,NA}binary variable(s) %s treated as interval scaledclustering 'x' and dissimilarity 'dist' are incompatiblecomputed some negative or all 0 probabilitiesellipsoidPoints() not yet implemented for p >= 3 dim.error from .C(cl_pam, *): invalid medID'sfull silhouette is only available for results of 'clara(*, keep.data = TRUE)'have %d observations, but not more than %d are allowedindex has to be a function or a list of functioninvalid %s; must be named listinvalid 'correct.d'invalid 'jstop' from .C(cl_clara,.):invalid 'silhouette' objectinvalid 'spaceH0':invalid 'twins' objectinvalid clustering methodinvalid partition objectinvalid silhouette structureinvalid type %s for column numbers %smona() needs at least p >= 2 variables (in current implementation)need at least 2 objects to clusterno diss nor data found for clusplot()'no diss nor data found, nor the original argument of %sno points without missing valuesomitting NAsone or more objects contain only missing valuesone or more variables contain only missing valuessetting 'logical' variable %s to type 'asymm'setting 'logical' variables %s to type 'asymm'specified both 'full' and 'subset'; will use 'subset'the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ?the square matrix is not symmetric.when 'medoids.x' is FALSE, 'keep.data' must be toowith mixed variables, metric "gower" is used automaticallyx is not a data matrixx is not a dataframe or a numeric matrix.x is not a numeric dataframe or matrix.x is not numericx must be a matrix or data frame.Project-Id-Version: R-cluster 2.0.8 Report-Msgid-Bugs-To: bugs.r-project.org PO-Revision-Date: Last-Translator: Daniele Medri Language-Team: Italian https://github.com/dmedri/R-italian-lang Language: it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); X-Generator: Poedit 2.2.1 %d osservazione (%s) ha *solo* NA --> omettetela dall'analisi!%d osservazioni (%s) hanno *solo* NA --> omettetele dall'analisi!%s ha colonne costanti %s; queste sono standardizzate a 0%s ha nomi colonna non validi%s dev'essere in 1:ncol(x)%s deve contenere numeri o nomi di colonna'A' dev'essere una matrice di covarianza p x p che definisce un ellissoide'B' dev'essere un intero positivo'col.clus' dev'essere di lunghezza 4 quando color è TRUE'dmatrix' non è una matrice di dissomiglianza compatibile con 'x''full' dev'essere FALSE, TRUE, o un numero nell'intervallo [0, 1]'iniMem.p' dev'essere una matrice non-negativa n * k con rowSums == 1'k' (il numero di cluster) dev'essere in {1,2, .., n/2 -1}'m', una matrice di appartenenza, dev'essere non negativa con rowSums == 1'maxit' dev'essere un intero non negativo'medoids' dev'essere NULL o un vettore di %d indici distinti in {1,2, .., n}, n=%d'memb.exp' dev'essere un numero finito > 1'n' dev'essere >= 2'par.method' dev'essere di lunghezza 1, 3 o 4'samples' dovrebbe essere almeno 1'sampsize' = %d non dovrebbe essere più grande del numero di oggetti, %d'sampsize' dovrebbe essere almeno %d = max(2, 1+ numero di cluster)'weights' dev'essere di lunghezza p (o 1)'x' è un oggetto "dist", ma dovrebbe essere un data frame o una matrice'x' non è e non può essere convertito alla classe "dissimilarity"'x' dev'essere una matrice numerica n x p'x' deve avere unicamente codici interi>>>>> caso insolito in clusplot.default() -- per piacere, riportalo!Tutte le variabili devono essere binarie (es. un fattore a 2 livelli, entrambi presenti).Non è possibile conservare i dati quando 'x' è una dissomiglianza!Calcoli della distanza con NA: si utilizza la formula corretta anziché quella errata pre-2016. Si utilizzi 'correct.d = FALSE' per ottenere i risultati precedenti o si imposti 'correct.d = TRUE' per sopprimere questo avviso.Le distanze devono essere il risultato di una matrice dist o quadrata.Ognuno dei campioni casuali contiene oggetti tra i quali non si possono calcolare distanze.Errore nella routine C per l'ellissoide di spanning, problema di rango?L'algoritmo FANNY senza convergenza con 'maxit' = %d iterazioniPer ognuno dei %d campioni, è stato trovato almeno un oggetto che non può essere assegnato ad un cluster (a causa di valori mancanti).I valori mancanti sono stati sostituiti con la mediana delle variabili corrispondentiI valori NA non sono ammessi in una matrice di dissimilarità.I valori NA non sono ammessi in un vettore di clusteringI valori NA non sono ammessi in dist-simile 'x'.I valori NA non sono ammessi in una matrice di dissimilarità.Necessaria una differenza "dist" o una diss.matrix "dmatrix"Nessun cluster generato, valori NA nella matrice di dissomiglianza.Nessun cluster generato, valori NA nella matrice di dissomiglianza.Nessun cluster generato, valori NA nella matrice di dissomiglianza.Nessun cluster generato, una variabile è stata trovata con tutti i valori non-mancanti identici.Clustering interrotto, tutte le variabili hanno almeno un valore mancante.Nessun cluster generato, un oggetto aveva tutti i valori mancanti.Nessun cluster generato, trovata una variabile con più della metà dei valori mancanti.Nessuna informazione valida di silhouette (#{clusters} =? 1)Il numero di cluster 'k' dev'essere in {1,2, .., n-1}; perciò n >= 2L'osservazione %s ha *solo* NA --> omettetela dall'analisiLe osservazioni %s hanno *solo* NA --> omettetele dall'analisi!Imposta "variant" o "pamonce", ma non entrambiIl vettore di clustering è di lunghezza incorrettaIl numerod i cluster dovrebbe essere almeno 1 e al massimo n-1.l'algoritmo potrebbe non convergere in %d iterazionimetodo di clustering ambiguoalmeno una variabile binaria ha più di 2 livelli.almeno una variabile binaria non ha 2 livelli differenti.almeno una variabile binaria ha valori esterni a {0, 1, NA}variabili binarie %s trattate come intervallo ridimensionatoil clustering 'x' e le dissimilarità 'dist' sono incompatibilicalcolate alcune probabilità negative o tutte 0ellipsoidPoints() non ancora implementato per p >= 3 dimensioni.errore in .C(cl_pam, *): medID non validola silhouette piena è disponibile solo per risultati di 'clara(*, keep.data = TRUE)'hanno %d osservazioni, ma non più di %d sono ammessel'indice dev'essere una funzione o una lista di funzioni%s non valido; dev'essere una lista nominata'correct.d' non valido'jstop' non valido da .C(cl_clara,.):oggetto 'silhouette' non valido'spaceH0' non valido:oggetto 'twins' non validometodo di clustering non validooggetto partizione non validostruttura silhouette non validatipo %s non valido per i numeri di colonna %smona() richiede almeno p >= 2 variabili (nell'attuale implementazione)richiede almeno 2 oggetti per l'analisi clusternessun diss o dato trovato per clusplot()'nessun diss o dato trovato, neppure l'argomento originale di %snessun punto senza valori mancantisi omettono gli NAuno o più oggetti contiene solo valori mancantiuna o più variabili contiene solo valori mancanticonfigurazione della variabile 'logical' %s nel tipo 'asymm'configurazione delle variabili 'logical' %s nel tipo 'asymm'specificati 'full' e 'subset'; si utilizzerà 'subset'le appartenenze sono tutte molto vicine a 1/k. Decrementare 'memb.exp'?la matrice quadrata non è simmetrica.quando 'medoids.x' è FALSE, lo dev'essere anche 'keep.data'con variabili miste, la metrica "gower" è utilizzata in maniera automaticax non è una matrice datix non è un data frame o una matrice numerica.x non è un data frame o una matrice numerica.x non è numericox dev'essere una matrice o un data frame.cluster/inst/po/it/LC_MESSAGES/cluster.mo0000644000176200001440000000237714005347355017564 0ustar liggesusersÞ•\ œÈ$É9î(H:IƒÍ*æj1|M®üKT]².ÐC level clara(): random k=%d > n ** C level dysta2(): nsel[%s= %d] = %d is outside 0..n, n=%dInvalid 'medoids'agnes(method=%d, par.method=*) lead to invalid merge; step %d, D(.,.)=%gclara()'s C level dysta2(nsam=%d, p=%d, nbest=%d, n=%d) gave 'toomany_NA'invalid method (code %d)pam(): Bug in C level cstat(), k=%d: ntt=0Project-Id-Version: cluster 2.0.8 Report-Msgid-Bugs-To: PO-Revision-Date: Last-Translator: Daniele Medri Language-Team: Italian https://github.com/dmedri/R-italian-lang Language: it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); X-Generator: Poedit 2.2.1 Funzione clara() a livello C: random k=%d > n ** Funzione dysta2() a livello C: nsel[%s= %d] = %d è al di fuori di 0..n, n=%d'medoids' non validoagnes(method=%d, par.method=*) porta ad una unione non valida %d, D(.,.)=%gclara() a livello C: dysta2(nsam=%d, p=%d, nbest=%d, n=%d) ha riportato 'toomany_NA'metodo non valido (codice %d)pam(): Bug a livello C di cstat(), k=%d: ntt=0cluster/inst/po/en@quot/0000755000176200001440000000000014764126505014753 5ustar liggesuserscluster/inst/po/en@quot/LC_MESSAGES/0000755000176200001440000000000014764126505016540 5ustar liggesuserscluster/inst/po/en@quot/LC_MESSAGES/R-cluster.mo0000644000176200001440000003072614217436352020762 0ustar liggesusersÞ•a$ƒ,8‡97Áù '- 3U ‰ 2ª 9Ý 1 ?I 5‰ ?¿ $ÿ M$ &r ™ )ª Ô Có @7 $x < ;Ú ! 8 8Y J’ -Ý ½ 4ÉVþ>U<”ÑLQ2ž.Ñ+2,;_6›?ÒBTUGªEòK82„>·vö/m,;Ê184T8‰7Â0ú8+-d5’)ÈMò6@0w¨Ç$Û/F`y%–B¼"ÿ&"7I  ¢/¯1ß\5nF¤#ë2:B})”'¾æ!÷‡.7¶î '"7J$‚6§AÞ5 CV9šCÔ( QA *“ ¾ -Ó "!G$!Dl!(±!@Ú!?"%["$"8¦"Jß"1*#Å\#4"$VW$>®$@í$.%L®%2û%..&/]&2&CÀ&6'?;'B{'T¾'G(E[(K¡(2í(B )vc)7Ú),*;?*1{*­*4É*8þ*77+0o+@ +-á+5,)E,Qo,6Á,0ø,)-H-(`-‰-©-À-Û-õ-.%+.BQ."”.&·.7Þ. / 7//D/1t/l¦/A0JU0# 0:Ä0:ÿ0:1)Q1'{1£1!´1=[ S0NYR7^/< H@1IB2, WL5]!;G*%T6A_9+U\Q Z(E O`K4 #V&XJ):aD.3P>?"$-CF8'M%d observation (%s) has *only* NAs --> omit them for clustering!%d observations (%s ...) have *only* NAs --> omit them for clustering!%s has constant columns %s; these are standardized to 0%s has invalid column names%s must be in 1:ncol(x)%s must contain column names or numbers'A' must be p x p cov-matrix defining an ellipsoid'B' has to be a positive integer'col.clus' should have length 4 when color is TRUE'dmatrix' is not a dissimilarity matrix compatible to 'x''full' must be FALSE, TRUE, or a number in [0, 1]'iniMem.p' must be a nonnegative n * k matrix with rowSums == 1'k' (number of clusters) must be in {1,2, .., n/2 -1}'m', a membership matrix, must be nonnegative with rowSums == 1'maxit' must be non-negative integer'medoids' must be NULL or vector of %d distinct indices in {1,2, .., n}, n=%d'memb.exp' must be a finite number > 1'n' must be >= 2'par.method' must be of length 1, 3, or 4'samples' should be at least 1'sampsize' = %d should not be larger than the number of objects, %d'sampsize' should be at least %d = max(2, 1+ number of clusters)'weights' must be of length p (or 1)'x' is a "dist" object, but should be a data matrix or frame'x' is not and cannot be converted to class "dissimilarity"'x' must be numeric n x p matrix'x' must only have integer codes>>>>> funny case in clusplot.default() -- please report!All variables must be binary (e.g., a factor with 2 levels, both present).Cannot keep data when 'x' is a dissimilarity!Distance computations with NAs: using correct instead of pre-2016 wrong formula. Use 'correct.d=FALSE' to get previous results or set 'correct.d=TRUE' explicitly to suppress this warning.Distances must be result of dist or a square matrix.Each of the random samples contains objects between which no distance can be computed.Error in C routine for the spanning ellipsoid, rank problem??FANNY algorithm has not converged in 'maxit' = %d iterationsFor each of the %d samples, at least one object was found which could not be assigned to a cluster (because of missing values).Missing values were displaced by the median of the corresponding variable(s)NA values in the dissimilarity matrix not allowed.NA-values are not allowed in clustering vectorNA-values are not allowed in dist-like 'x'.NA-values in the dissimilarity matrix not allowed.Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'No clustering performed, NA's in dissimilarity matrix.No clustering performed, NA-values in the dissimilarity matrix.No clustering performed, NAs in the computed dissimilarity matrix.No clustering performed, a variable was found with all non missing values identical.No clustering performed, all variables have at least one missing value.No clustering performed, an object was found with all values missing.No clustering performed, found variable with more than half values missing.No valid silhouette information (#{clusters} =? 1)Number of clusters 'k' must be in {1,2, .., n-1}; hence n >= 2Observation %s has *only* NAs --> omit it for clusteringObservations %s have *only* NAs --> omit them for clustering!Set either 'variant' or 'pamonce', but not bothThe clustering vector is of incorrect lengthThe number of cluster should be at least 1 and at most n-1.algorithm possibly not converged in %d iterationsambiguous clustering methodat least one binary variable has more than 2 levels.at least one binary variable has not 2 different levels.at least one binary variable has values not in {0,1,NA}binary variable(s) %s treated as interval scaledclustering 'x' and dissimilarity 'dist' are incompatiblecomputed some negative or all 0 probabilitiesellipsoidPoints() not yet implemented for p >= 3 dim.error from .C(cl_pam, *): invalid medID'sfull silhouette is only available for results of 'clara(*, keep.data = TRUE)'have %d observations, but not more than %d are allowedindex has to be a function or a list of functioninvalid %s; must be named listinvalid 'correct.d'invalid 'jstop' from .C(cl_clara,.):invalid 'silhouette' objectinvalid 'spaceH0':invalid 'twins' objectinvalid clustering methodinvalid partition objectinvalid silhouette structureinvalid type %s for column numbers %smona() needs at least p >= 2 variables (in current implementation)need at least 2 objects to clusterno diss nor data found for clusplot()'no diss nor data found, nor the original argument of %sno points without missing valuesomitting NAsone or more objects contain only missing valuesone or more variables contain only missing valuessetting 'logical' variable %s to type 'asymm'setting 'logical' variables %s to type 'asymm'specified both 'full' and 'subset'; will use 'subset'the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ?the square matrix is not symmetric.when 'medoids.x' is FALSE, 'keep.data' must be toowith mixed variables, metric "gower" is used automaticallyx is not a data matrixx is not a dataframe or a numeric matrix.x is not a numeric dataframe or matrix.x is not numericx must be a matrix or data frame.Project-Id-Version: cluster 2.1.3 PO-Revision-Date: 2021-08-19 20:27 Last-Translator: Automatically generated Language-Team: none MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Language: en Plural-Forms: nplurals=2; plural=(n != 1); %d observation (%s) has *only* NAs --> omit them for clustering!%d observations (%s ...) have *only* NAs --> omit them for clustering!%s has constant columns %s; these are standardized to 0%s has invalid column names%s must be in 1:ncol(x)%s must contain column names or numbers‘A’ must be p x p cov-matrix defining an ellipsoid‘B’ has to be a positive integer‘col.clus’ should have length 4 when color is TRUE‘dmatrix’ is not a dissimilarity matrix compatible to ‘x’‘full’ must be FALSE, TRUE, or a number in [0, 1]‘iniMem.p’ must be a nonnegative n * k matrix with rowSums == 1‘k’ (number of clusters) must be in {1,2, .., n/2 -1}‘m’, a membership matrix, must be nonnegative with rowSums == 1‘maxit’ must be non-negative integer‘medoids’ must be NULL or vector of %d distinct indices in {1,2, .., n}, n=%d‘memb.exp’ must be a finite number > 1‘n’ must be >= 2‘par.method’ must be of length 1, 3, or 4‘samples’ should be at least 1‘sampsize’ = %d should not be larger than the number of objects, %d‘sampsize’ should be at least %d = max(2, 1+ number of clusters)‘weights’ must be of length p (or 1)‘x’ is a "dist" object, but should be a data matrix or frame‘x’ is not and cannot be converted to class "dissimilarity"‘x’ must be numeric n x p matrix‘x’ must only have integer codes>>>>> funny case in clusplot.default() -- please report!All variables must be binary (e.g., a factor with 2 levels, both present).Cannot keep data when ‘x’ is a dissimilarity!Distance computations with NAs: using correct instead of pre-2016 wrong formula. Use ‘correct.d=FALSE’ to get previous results or set ‘correct.d=TRUE’ explicitly to suppress this warning.Distances must be result of dist or a square matrix.Each of the random samples contains objects between which no distance can be computed.Error in C routine for the spanning ellipsoid, rank problem??FANNY algorithm has not converged in ‘maxit’ = %d iterationsFor each of the %d samples, at least one object was found which could not be assigned to a cluster (because of missing values).Missing values were displaced by the median of the corresponding variable(s)NA values in the dissimilarity matrix not allowed.NA-values are not allowed in clustering vectorNA-values are not allowed in dist-like ‘x’.NA-values in the dissimilarity matrix not allowed.Need either a dissimilarity ‘dist’ or diss.matrix ‘dmatrix’No clustering performed, NA's in dissimilarity matrix.No clustering performed, NA-values in the dissimilarity matrix.No clustering performed, NAs in the computed dissimilarity matrix.No clustering performed, a variable was found with all non missing values identical.No clustering performed, all variables have at least one missing value.No clustering performed, an object was found with all values missing.No clustering performed, found variable with more than half values missing.No valid silhouette information (#{clusters} =? 1)Number of clusters ‘k’ must be in {1,2, .., n-1}; hence n >= 2Observation %s has *only* NAs --> omit it for clusteringObservations %s have *only* NAs --> omit them for clustering!Set either ‘variant’ or ‘pamonce’, but not bothThe clustering vector is of incorrect lengthThe number of cluster should be at least 1 and at most n-1.algorithm possibly not converged in %d iterationsambiguous clustering methodat least one binary variable has more than 2 levels.at least one binary variable has not 2 different levels.at least one binary variable has values not in {0,1,NA}binary variable(s) %s treated as interval scaledclustering ‘x’ and dissimilarity ‘dist’ are incompatiblecomputed some negative or all 0 probabilitiesellipsoidPoints() not yet implemented for p >= 3 dim.error from .C(cl_pam, *): invalid medID'sfull silhouette is only available for results of ‘clara(*, keep.data = TRUE)’have %d observations, but not more than %d are allowedindex has to be a function or a list of functioninvalid %s; must be named listinvalid ‘correct.d’invalid ‘jstop’ from .C(cl_clara,.):invalid ‘silhouette’ objectinvalid ‘spaceH0’:invalid ‘twins’ objectinvalid clustering methodinvalid partition objectinvalid silhouette structureinvalid type %s for column numbers %smona() needs at least p >= 2 variables (in current implementation)need at least 2 objects to clusterno diss nor data found for clusplot()'no diss nor data found, nor the original argument of %sno points without missing valuesomitting NAsone or more objects contain only missing valuesone or more variables contain only missing valuessetting ‘logical’ variable %s to type ‘asymm’setting ‘logical’ variables %s to type ‘asymm’specified both ‘full’ and ‘subset’; will use ‘subset’the memberships are all very close to 1/k. Maybe decrease ‘memb.exp’ ?the square matrix is not symmetric.when ‘medoids.x’ is FALSE, ‘keep.data’ must be toowith mixed variables, metric "gower" is used automaticallyx is not a data matrixx is not a dataframe or a numeric matrix.x is not a numeric dataframe or matrix.x is not numericx must be a matrix or data frame.cluster/inst/po/en@quot/LC_MESSAGES/cluster.mo0000644000176200001440000000222214217436352020551 0ustar liggesusersÞ•\ œÈ$É9î(H:IƒÍ*æ0$B9g¡H·MN*gC level clara(): random k=%d > n ** C level dysta2(): nsel[%s= %d] = %d is outside 0..n, n=%dInvalid 'medoids'agnes(method=%d, par.method=*) lead to invalid merge; step %d, D(.,.)=%gclara()'s C level dysta2(nsam=%d, p=%d, nbest=%d, n=%d) gave 'toomany_NA'invalid method (code %d)pam(): Bug in C level cstat(), k=%d: ntt=0Project-Id-Version: cluster 2.1.3 Report-Msgid-Bugs-To: PO-Revision-Date: 2021-08-19 20:27+0200 Last-Translator: Automatically generated Language-Team: none Language: en MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=2; plural=(n != 1); C level clara(): random k=%d > n ** C level dysta2(): nsel[%s= %d] = %d is outside 0..n, n=%dInvalid ‘medoids’agnes(method=%d, par.method=*) lead to invalid merge; step %d, D(.,.)=%gclara()‘s C level dysta2(nsam=%d, p=%d, nbest=%d, n=%d) gave ’toomany_NA'invalid method (code %d)pam(): Bug in C level cstat(), k=%d: ntt=0cluster/inst/po/lt/0000755000176200001440000000000014764126505013757 5ustar liggesuserscluster/inst/po/lt/LC_MESSAGES/0000755000176200001440000000000014764126505015544 5ustar liggesuserscluster/inst/po/lt/LC_MESSAGES/R-cluster.mo0000644000176200001440000003210614044453203017750 0ustar liggesusersÞ•a$ƒ,8‡97Áù '- 3U ‰ 2ª 9Ý 1 ?I 5‰ ?¿ $ÿ M$ &r ™ )ª Ô Có @7 $x < ;Ú ! 8 8Y J’ -Ý ½ 4ÉVþ>U<”ÑLQ2ž.Ñ+2,;_6›?ÒBTUGªEòK82„>·vö/m,;Ê184T8‰7Â0ú8+-d5’)ÈMò6@0w¨Ç$Û/F`y%–B¼"ÿ&"7I  ¢/¯1ß\5nF¤#ë2:B})”'¾æ!÷§ËÁ:*Èó3 F?"†2©4Ü3 AE 7‡ C¿ 3!>7!-v!¤!)¸!+â!D"?S"%“"I¹"B#(F#&o#>–#JÕ#1 $çR$=:%ix%Hâ%6+&‚b&Så&/9'0i'*š'/Å'6õ'2,(=_(B(_à(S@)R”)^ç);F*@‚*¸Ã*0|+'­+JÕ+. , O,=p,>®,:í,K(-3t-8¨-2á-..GC.7‹.5Ã.1ù.+/)C/!m//¦/Ã/á/0,0CJ0#Ž0+²09Þ0'1@1:Q1=Œ1œÊ18g2H 2&é2:3CK330¨3.Ù34+4=[ S0NYR7^/< H@1IB2, WL5]!;G*%T6A_9+U\Q Z(E O`K4 #V&XJ):aD.3P>?"$-CF8'M%d observation (%s) has *only* NAs --> omit them for clustering!%d observations (%s ...) have *only* NAs --> omit them for clustering!%s has constant columns %s; these are standardized to 0%s has invalid column names%s must be in 1:ncol(x)%s must contain column names or numbers'A' must be p x p cov-matrix defining an ellipsoid'B' has to be a positive integer'col.clus' should have length 4 when color is TRUE'dmatrix' is not a dissimilarity matrix compatible to 'x''full' must be FALSE, TRUE, or a number in [0, 1]'iniMem.p' must be a nonnegative n * k matrix with rowSums == 1'k' (number of clusters) must be in {1,2, .., n/2 -1}'m', a membership matrix, must be nonnegative with rowSums == 1'maxit' must be non-negative integer'medoids' must be NULL or vector of %d distinct indices in {1,2, .., n}, n=%d'memb.exp' must be a finite number > 1'n' must be >= 2'par.method' must be of length 1, 3, or 4'samples' should be at least 1'sampsize' = %d should not be larger than the number of objects, %d'sampsize' should be at least %d = max(2, 1+ number of clusters)'weights' must be of length p (or 1)'x' is a "dist" object, but should be a data matrix or frame'x' is not and cannot be converted to class "dissimilarity"'x' must be numeric n x p matrix'x' must only have integer codes>>>>> funny case in clusplot.default() -- please report!All variables must be binary (e.g., a factor with 2 levels, both present).Cannot keep data when 'x' is a dissimilarity!Distance computations with NAs: using correct instead of pre-2016 wrong formula. Use 'correct.d=FALSE' to get previous results or set 'correct.d=TRUE' explicitly to suppress this warning.Distances must be result of dist or a square matrix.Each of the random samples contains objects between which no distance can be computed.Error in C routine for the spanning ellipsoid, rank problem??FANNY algorithm has not converged in 'maxit' = %d iterationsFor each of the %d samples, at least one object was found which could not be assigned to a cluster (because of missing values).Missing values were displaced by the median of the corresponding variable(s)NA values in the dissimilarity matrix not allowed.NA-values are not allowed in clustering vectorNA-values are not allowed in dist-like 'x'.NA-values in the dissimilarity matrix not allowed.Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'No clustering performed, NA's in dissimilarity matrix.No clustering performed, NA-values in the dissimilarity matrix.No clustering performed, NAs in the computed dissimilarity matrix.No clustering performed, a variable was found with all non missing values identical.No clustering performed, all variables have at least one missing value.No clustering performed, an object was found with all values missing.No clustering performed, found variable with more than half values missing.No valid silhouette information (#{clusters} =? 1)Number of clusters 'k' must be in {1,2, .., n-1}; hence n >= 2Observation %s has *only* NAs --> omit it for clusteringObservations %s have *only* NAs --> omit them for clustering!Set either 'variant' or 'pamonce', but not bothThe clustering vector is of incorrect lengthThe number of cluster should be at least 1 and at most n-1.algorithm possibly not converged in %d iterationsambiguous clustering methodat least one binary variable has more than 2 levels.at least one binary variable has not 2 different levels.at least one binary variable has values not in {0,1,NA}binary variable(s) %s treated as interval scaledclustering 'x' and dissimilarity 'dist' are incompatiblecomputed some negative or all 0 probabilitiesellipsoidPoints() not yet implemented for p >= 3 dim.error from .C(cl_pam, *): invalid medID'sfull silhouette is only available for results of 'clara(*, keep.data = TRUE)'have %d observations, but not more than %d are allowedindex has to be a function or a list of functioninvalid %s; must be named listinvalid 'correct.d'invalid 'jstop' from .C(cl_clara,.):invalid 'silhouette' objectinvalid 'spaceH0':invalid 'twins' objectinvalid clustering methodinvalid partition objectinvalid silhouette structureinvalid type %s for column numbers %smona() needs at least p >= 2 variables (in current implementation)need at least 2 objects to clusterno diss nor data found for clusplot()'no diss nor data found, nor the original argument of %sno points without missing valuesomitting NAsone or more objects contain only missing valuesone or more variables contain only missing valuessetting 'logical' variable %s to type 'asymm'setting 'logical' variables %s to type 'asymm'specified both 'full' and 'subset'; will use 'subset'the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ?the square matrix is not symmetric.when 'medoids.x' is FALSE, 'keep.data' must be toowith mixed variables, metric "gower" is used automaticallyx is not a data matrixx is not a dataframe or a numeric matrix.x is not a numeric dataframe or matrix.x is not numericx must be a matrix or data frame.Project-Id-Version: cluster 2.1.1 PO-Revision-Date: 2021-05-05 10:17+0200 Last-Translator: GabrielÄ— StupurienÄ— Language-Team: none Language: LT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Generator: Poedit 2.4.2 Plural-Forms: nplurals=3; plural=(n%10==1 && (n%100<11 || n%100>19) ? 0 : n%10>=2 && n%10<=9 && (n%100<11 || n%100>19) ? 1 : 2); %d stebÄ—jimas (%s) turi * tik * NA -- > praleisti juos grupavimui!%d stebÄ—jimai (%s) turi * tik * NA -- > praleisti juos grupavimui!%d stebÄ—jimų (%s) turi * tik * NA -- > praleisti juos grupavimui!%s turi pastovius stulpelius %s; jie standartizuojami į 0%s turi neleistinus stulpelių pavadinimus%s turi bÅ«ti 1:ncol(x)%s turi bÅ«ti stulpelių pavadinimai arba skaiÄiai'A' turi bÅ«ti [p x p] kovariacijos matrica, apibrėžianti elipsoidÄ…'B' turi bÅ«ti teigiamas skaiÄius'col.clus' turi bÅ«ti ilgis 4, kai spalva yra TRUE'dmatrix' nÄ—ra skirtumų matrica, suderinama su 'x''full' turi bÅ«ti FALSE, TRUE arba skaiÄius [0, 1]'iniMem.p' turi bÅ«ti ne neigiama [n * k] matrica su rowSums == 1'k' (klasterių skaiÄius) turi bÅ«ti {1,2, .., n/2 -1}'m', priklausomybių matrica, turi bÅ«ti neneigiama su rowSums == 1'maxit' turi bÅ«ti ne neigiamas sveikasis skaiÄius'medoids' turi bÅ«ti NULL arba %d indeksai { 1,2, .., n}, n=%d'memb.exp' turi bÅ«ti baigtinis skaiÄius > 1'n' turi bÅ«ti >= 2'par.method' turi bÅ«ti 1, 3 arba 4 ilgio'samples' turÄ—tų bÅ«ti ne mažesni kaip 1'sampsize' = %d neturÄ—tų bÅ«ti didesnis už objektų skaiÄių, %d'sampsize' turi bÅ«ti bent %d = max(2, 1+ klasterių skaiÄius)'weights' ilgis turi bÅ«ti p (arba 1)'x' yra "dist" objektas, bet turÄ—tų bÅ«ti duomenų matrica arba sistema'x' nÄ—ra ir negali bÅ«ti konvertuojamas į klasÄ™ "dissimilarity"'x' turi bÅ«ti skaitinÄ— [n x p] matrica'x' turi turÄ—ti tik sveikuosius kodus>>>>> keistas atvejis clusplot.default() - praÅ¡ome praneÅ¡ti!Visi kintamieji turi bÅ«ti dvejetainiai (pvz., koeficientas su 2 lygiais).Negalima saugoti duomenų, kai 'x' yra skirtumas!Atstumo skaiÄiavimai su NA: naudojant teisingÄ…, o ne iki 2016 m. neteisingÄ… formulÄ™. Naudokite 'correct.d=FALSE', kad gautumÄ—te ankstesnius rezultatus, arba aiÅ¡kiai nustatykite 'correct.d=TRUE', kad slÄ—pti šį įspÄ—jimÄ….Atstumai turi bÅ«ti dist rezultatas arba kvadratinÄ— matrica.Kiekviename atsitiktinių pavyzdžių sudÄ—tyje yra objektų, tarp kurių negalima apskaiÄiuoti atstumo.AprÄ—pianÄio elipsoido, esanÄio C programoje klaida, rango problema??FANNY algoritmas nekonvergavo 'maxit' = %d iteracijoseKiekvienam iÅ¡ %d pavyzdžių buvo rastas bent vienas objektas, kurio nepavyko priskirti klasteriui (dÄ—l trÅ«kstamų reikÅ¡mių).TrÅ«kstamos reikÅ¡mÄ—s buvo perkeltos iÅ¡ atitinkamo (-ų) kintamojo (-ų) medianosNA reikÅ¡mÄ—s skirtumo matricoje neleidžiamos.NA reikÅ¡mÄ—s neleidžiamos grupavimo vektoriujeNA reikÅ¡mÄ—s neleidžiamos dist kaip 'x'.NA reikÅ¡mÄ—s skirtumo matricoje neleidžiamos.Reikia arba skirtumo 'dist' arba diss.matrix 'dmatrix'Nebuvo atliktas grupavimas, NA skirtumo matricoje.Nebuvo atliktas grupavimas, NA reikÅ¡mÄ—s skirtumo matricoje.Nebuvo atliktas grupavimas, NA apskaiÄiuotoje skirtumo matricoje.Grupavimas neatliktas, rastas kintamasis su visomis identiÅ¡komis netrÅ«kstamomis reikÅ¡mÄ—mis.Grupavimas nebuvo atliktas, visi kintamieji turi bent vienÄ… trÅ«kstamÄ… reikÅ¡mÄ™.Grupavimas nebuvo atliktas, rastas objektas su visomis trÅ«kstamomis reikÅ¡mÄ—mis.Nebuvo atliktas grupavimas, rastas kintamasis, kuriame trÅ«ksta daugiau nei pusÄ—s reikÅ¡mių.NÄ—ra galiojanÄios silueto informacijos (#{clusters} =? 1)Klasterių skaiÄius 'k' turi bÅ«ti {1,2, .., n-1}; taigi n >= 2StebÄ—jimas %s turi * tik * NA -- > praleisti jį grupavimuiStebÄ—jimai %s turi * tik * NA -- > praleisti jį grupavimui!StebÄ—jimų %s turi * tik * NA -- > praleisti jį grupavimui!Nustatykite 'variant' arba 'pamonce', bet ne abuGrupavimo vektorius yra netinkamo ilgioKlasterio skaiÄius turi bÅ«ti ne mažesnis kaip 1 ir ne daugiau kaip n-1.algoritmas galbÅ«t nekonvergavo %d iteracijoseneaiÅ¡kus klasterizavimo metodasbent vienas dvejetainis kintamasis turi daugiau nei 2 lygius.bent vienas dvejetainis kintamasis neturi 2 skirtingų lygių.bent vieno dvejetainio kintamojo reikÅ¡mÄ—s nÄ—ra {0,1,NA}dvejetainis kintamasis (-ieji) %s traktuojamas (-i) kaip intervalo mastelisgrupavimas 'x' ir skirtumas 'dist' yra nesuderinamiapskaiÄiavo kai kurias neigiamas arba visas 0 tikimybesellipsoidPoints() dar neįgyvendintas p > = 3 dim.klaida iÅ¡ . C(cl_pam, *): negaliojantis medIDvisas siluetas prieinamas tik 'clara(*, keep.data = TRUE)' rezultatams.turi %d pastabų, taÄiau leidžiama ne daugiau kaip %dindeksas turi bÅ«ti funkcija arba funkcijų sÄ…raÅ¡asnegaliojantys %s; turi bÅ«ti įvardytas sÄ…raÅ¡asneleistinas 'correct.d'negaliojantis 'jstop' iÅ¡ .C(cl_clara,.):neleistinas 'silhouette' objektasneleistinas 'spaceH0':neleistinas 'twins' objektasneleistinas grupavimo metodasneleistinas skaidinio objektasnetinkama silueto struktÅ«raneleistinas tipas %s stulpelių numeriams %smona() reikia bent p > = 2 kintamųjų (dabartiniame įgyvendinime)reikia bent 2 objektų į klasterįnerasta jokių diss ir clusplot()' duomenųnerasta nei diss, nei duomenų, nei pradinio %s argumentonÄ—ra taÅ¡kų be trÅ«kstamų reikÅ¡miųpraleidžiami NAviename ar daugiau objektų yra tik trÅ«kstamos reikÅ¡mÄ—sviename ar daugiau kintamųjų yra tik trÅ«kstamos reikÅ¡mÄ—s'logical' kintamojo %s nustatymas į tipÄ… 'asymm''logical' kintamųjų %s nustatymas į tipÄ… 'asymm''logical' kintamųjų %s nustatymas į tipÄ… 'asymm'nurodyti abu 'full' ir 'subset'; bus naudojamas 'subset'visos priklausomybÄ—s yra labai artimos 1/k. Gal sumažinti 'memb.exp' ?kvadratinÄ— matrica nÄ—ra simetriÅ¡ka.kai 'medoids.x' yra FALSE, 'keep.data' turi bÅ«ti taip patsu miÅ¡riais kintamaisiais, metrika "gower" naudojama automatiÅ¡kaix nÄ—ra duomenų matricax nÄ—ra duomenų sistema arba skaitinÄ— matrica.x nÄ—ra skaitinÄ— duomenų sistema ar matrica.x nÄ—ra skaitinisx turi bÅ«ti matrica arba duomenų sistema.cluster/inst/po/lt/LC_MESSAGES/cluster.mo0000644000176200001440000000246714044453203017560 0ustar liggesusersÞ•\ œÈ$É9î(H:IƒÍ*æ¾*Ð6û2WHH é.C level clara(): random k=%d > n ** C level dysta2(): nsel[%s= %d] = %d is outside 0..n, n=%dInvalid 'medoids'agnes(method=%d, par.method=*) lead to invalid merge; step %d, D(.,.)=%gclara()'s C level dysta2(nsam=%d, p=%d, nbest=%d, n=%d) gave 'toomany_NA'invalid method (code %d)pam(): Bug in C level cstat(), k=%d: ntt=0Project-Id-Version: cluster 2.1.1 Report-Msgid-Bugs-To: PO-Revision-Date: 2021-02-12 11:04+0200 Last-Translator: GabrielÄ— StupurienÄ— Language-Team: none Language: LT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Generator: Poedit 2.4.2 Plural-Forms: nplurals=3; plural=(n%10==1 && (n%100<11 || n%100>19) ? 0 : n%10>=2 && n%10<=9 && (n%100<11 || n%100>19) ? 1 : 2); C lygio clara(): atsitiktinis k=%d > n ** C lygio dysta2(): nsel[%s= %d] = %d yra už 0..n, n=%dNeleistinas 'medoids'agnes(method=%d, par.method=*) sukelia neleistinÄ… suliejimÄ…; žingsnis %d, D(.,.) =%gclara() C lygio dysta2(nsam=%d, p=%d, nbest=%d, n=%d) davÄ— 'toomany_NA'neleistinas metodas (kodas %d)pam(): Klaida C lygio cstat(), k = %d: ntt = 0cluster/inst/po/ko/0000755000176200001440000000000014764126505013751 5ustar liggesuserscluster/inst/po/ko/LC_MESSAGES/0000755000176200001440000000000014764126505015536 5ustar liggesuserscluster/inst/po/ko/LC_MESSAGES/R-cluster.mo0000644000176200001440000003274314005347355017760 0ustar liggesusersÞ•UÄql0‡17¹ñ '%3M 2¢9Õ? 5O ?… $Å Mê &8 _ )p š C¹ @ý $> <c ;  !Ü þ 8 4X V <ä ! L¡ 2î .!+P2|;¯6ë?"BbT¥GúEBKˆ2Ô>vF,½;ê1&X4t8©7â08K-„5²)èM`$¤À×ñ %'"M&p7— Ï ð/ý1-\_F¼#2':Z•)¬'Öþ!?1uqwç;_4›CÐu2ŠM½y ‘…Tsl=à‚P¡7òF*4qF¦NíA< k~ rê H]!G¦!wî!df"qË"Y=#Ÿ—#K7$Oƒ$IÓ$%%UC%W™%vñ%…h&î&wn'æ'`h(mÉ(>7)iv)jà)GK*_“*Qó*6E+z|+}÷+ju,[à,2<-Io-P¹-\ .eg.Í.\O/1¬/)Þ/G0.P0/0D¯0Cô0D81j}1Jè132]J2]¨2B3yI35Ã3Qù3hK43´4Jè4A35(u5Dž5R"!LMU2E (  5+7*<G9-SQ%;84'K#AJ/6&O $0:BHFN=?PD@ 1)C.,>T I3%d observation (%s) has *only* NAs --> omit them for clustering!%d observations (%s ...) have *only* NAs --> omit them for clustering!%s has constant columns %s; these are standardized to 0%s has invalid column names%s must be in 1:ncol(x)%s must contain column names or numbers'A' must be p x p cov-matrix defining an ellipsoid'B' has to be a positive integer'col.clus' should have length 4 when color is TRUE'dmatrix' is not a dissimilarity matrix compatible to 'x''iniMem.p' must be a nonnegative n * k matrix with rowSums == 1'k' (number of clusters) must be in {1,2, .., n/2 -1}'m', a membership matrix, must be nonnegative with rowSums == 1'maxit' must be non-negative integer'medoids' must be NULL or vector of %d distinct indices in {1,2, .., n}, n=%d'memb.exp' must be a finite number > 1'n' must be >= 2'par.method' must be of length 1, 3, or 4'samples' should be at least 1'sampsize' = %d should not be larger than the number of objects, %d'sampsize' should be at least %d = max(2, 1+ number of clusters)'weights' must be of length p (or 1)'x' is a "dist" object, but should be a data matrix or frame'x' is not and cannot be converted to class "dissimilarity"'x' must be numeric n x p matrix'x' must only have integer codes>>>>> funny case in clusplot.default() -- please report!Distances must be result of dist or a square matrix.Each of the random samples contains objects between which no distance can be computed.FANNY algorithm has not converged in 'maxit' = %d iterationsFor each of the %d samples, at least one object was found which could not be assigned to a cluster (because of missing values).Missing values were displaced by the median of the corresponding variable(s)NA values in the dissimilarity matrix not allowed.NA-values are not allowed in clustering vectorNA-values are not allowed in dist-like 'x'.NA-values in the dissimilarity matrix not allowed.Need either a dissimilarity 'dist' or diss.matrix 'dmatrix'No clustering performed, NA's in dissimilarity matrix.No clustering performed, NA-values in the dissimilarity matrix.No clustering performed, NAs in the computed dissimilarity matrix.No clustering performed, a variable was found with all non missing values identical.No clustering performed, all variables have at least one missing value.No clustering performed, an object was found with all values missing.No clustering performed, found variable with more than half values missing.No valid silhouette information (#{clusters} =? 1)Number of clusters 'k' must be in {1,2, .., n-1}; hence n >= 2Observation %s has *only* NAs --> omit it for clusteringObservations %s have *only* NAs --> omit them for clustering!The clustering vector is of incorrect lengthThe number of cluster should be at least 1 and at most n-1.algorithm possibly not converged in %d iterationsambiguous clustering methodat least one binary variable has more than 2 levels.at least one binary variable has not 2 different levels.at least one binary variable has values not in {0,1,NA}binary variable(s) %s treated as interval scaledclustering 'x' and dissimilarity 'dist' are incompatiblecomputed some negative or all 0 probabilitiesellipsoidPoints() not yet implemented for p >= 3 dim.error from .C(cl_pam, *): invalid medID'sfull silhouette is only available for results of 'clara(*, keep.data = TRUE)'invalid %s; must be named listinvalid 'jstop' from .C(cl_clara,.):invalid 'silhouette' objectinvalid 'twins' objectinvalid clustering methodinvalid partition objectinvalid silhouette structureinvalid type %s for column numbers %sneed at least 2 objects to clusterno diss nor data found for clusplot()'no diss nor data found, nor the original argument of %sno points without missing valuesomitting NAsone or more objects contain only missing valuesone or more variables contain only missing valuessetting 'logical' variable %s to type 'asymm'setting 'logical' variables %s to type 'asymm'the memberships are all very close to 1/k. Maybe decrease 'memb.exp' ?the square matrix is not symmetric.when 'medoids.x' is FALSE, 'keep.data' must be toowith mixed variables, metric "gower" is used automaticallyx is not a data matrixx is not a dataframe or a numeric matrix.x is not a numeric dataframe or matrix.x is not numericx must be a matrix or data frame.Project-Id-Version: cluster 1.15.2 PO-Revision-Date: 2015-02-06 21:56-0600 Last-Translator:Chel Hee Lee Language-Team: Chel Hee Lee Language: ko MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=1; plural=0; %dê°œì˜ ê´€ì¸¡ê°’ë“¤ì´ (%s) *오로지* NAë§Œì„ ê°€ì§‘ë‹ˆë‹¤ --> 군집화를 위하여 ì´ë“¤ì„ 제거합니다!%1$s는 ìƒìˆ˜(constant)ê°’ì„ ê°€ì§€ëŠ” ì—´ %2$s를 가집니다. ì´ë“¤ì€ 0으로 표준화(standardized)ë©ë‹ˆë‹¤.%s는 올바른 ì—´ì´ë¦„ì„ ê°€ì§€ê³  있지 않습니다.%s는 반드시 1:ncol(x)ë‚´ì— ìžˆì–´ì•¼ 합니다.%s는 반드시 ì—´ ì´ë¦„ ë˜ëŠ” 번호를 í¬í•¨í•´ì•¼ 합니다.'A'는 반드시 타ì›(ellipsoid)를 ì •ì˜í•˜ëŠ” í¬ê¸°ê°€ p x pì¸ ê³µë¶„ì‚°í–‰ë ¬(cov-matrix)ì´ì–´ì•¼ 합니다.'B'는 반드시 ì–‘ì˜ ì •ìˆ˜ì´ì–´ì•¼ 합니다.colorê°€ TRUEì¼ ë•Œ, 'col.clus'ì˜ ê¸¸ì´ëŠ” 반드시 4ì´ì–´ì•¼ 합니다.'dmatrix'는 'x'ì— ë¶€í•©í•˜ëŠ” (ë˜ëŠ” 사용할 수 있는) 비유사성 행렬(dissimilarity matrix)ì´ ì•„ë‹™ë‹ˆë‹¤.'iniMem.p'는 반드시 í¬ê¸°ê°€ n * k ì¸ ë¹„ìŒìˆ˜ 행렬(nonnegative matrix)ì´ì–´ì•¼ 하며, ì´ í–‰ë ¬ì˜ rowSums == 1 ì´ì–´ì•¼ 합니다.'k' (êµ°ì§‘ì˜ ê°œìˆ˜)는 반드시 {1,2, .., n/2 -1} ë‚´ì— ì¡´ìž¬í•´ì•¼ 합니다.멤버쉽 행렬(membership matrix) 'm'ì€ ë°˜ë“œì‹œ ìŒìˆ˜ë¥¼ 가지지 않으며 rowSums == 1ì´ì–´ì•¼ 합니다.'maxit'ì€ ë°˜ë“œì‹œ ìŒì´ 아닌 정수ì´ì–´ì•¼ 합니다.'medoids'는 반드시 NULL ë˜ëŠ” {1,2, .., n}으로부터 %1$dê°œì˜ êµ¬ë¶„ë˜ëŠ” ì¸ë±ìŠ¤ë¥¼ 가진 벡터입니다 (n=%2$d). 'memb.exp'는 반드시 1보다 í° ìœ í•œí•œ(finite) 숫ìžì´ì–´ì•¼ 합니다.'n'는 반드시 2보다 í¬ê±°ë‚˜ 같아야 합니다.'par.method'ì˜ ê¸¸ì´ëŠ” 반드시 1, 3, ë˜ëŠ” 4ì´ì–´ì•¼ 합니다.'samples'는 ì ì–´ë„ 1 ì´ìƒ ì´ì–´ì•¼ 합니다.'sampsize' = %1$d는 ê°ì²´ì˜ 개수 %2$d보다 í´ ìˆ˜ 없습니다.'sampsize'는 최소 %d = max(2, 1 + êµ°ì§‘ì˜ ê°œìˆ˜)ê°€ ë˜ì–´ì•¼ 합니다.'weights'ì˜ ê¸¸ì´ëŠ” 반드시 p (ë˜ëŠ” 1)ì´ì–´ì•¼ 합니다.'x'는 í´ëž˜ìФ "dist"를 가지는 ê°ì²´ì´ì§€ë§Œ, ë°ì´í„° 행렬 ë˜ëŠ” 프레임ì´ì–´ì•¼ 합니다.'x'는 "dissimilarity"ì´ë¼ëŠ” í´ëž˜ìŠ¤ê°€ 아니거나 í´ëž˜ìФ "dissimilarity"로 전환할 수 없습니다.'x'는 반드시 í¬ê¸°ê°€ n x pì¸ ìˆ˜ì¹˜í˜• 행렬ì´ì–´ì•¼ 합니다.'x'는 오로지 정수형 코드(codes)ë§Œì„ ê°€ì§ˆ 수 있습니다.>>>>> clusplot.default()ì—서 예ìƒì¹˜ 못한 경우가 ë°œìƒí–ˆìŠµë‹ˆë‹¤ -- ë³´ê³ í•´ 주시길 ë¶€íƒë“œë¦½ë‹ˆë‹¤!거리(distances)는 반드시 dist ë˜ëŠ” 정방행렬(square matrix)ì˜ ê²°ê³¼ì´ì–´ì•¼ 합니다.ê°ê°ì˜ 무작위 í‘œë³¸ì€ ì„œë¡œê°„ì˜ ê±°ë¦¬ë¥¼ 계산할 수 없는 ê°ì²´ë“¤ì„ í¬í•¨í•˜ê³  있습니다.FANNY ì•Œê³ ë¦¬ì¦˜ì€ 'maxit' = %dë²ˆì˜ ë°˜ë³µìˆ˜í–‰ì—ë„ ìˆ˜ë ´í•˜ì§€ 않았습니다.%dê°œì˜ í‘œë³¸ ê°ê°ì— 대해서 결측값으로 ì¸í•˜ì—¬ ì–´ëŠ êµ°ì§‘ì—ë„ ë°°ì •í•  수 없는 ê°ì²´ë¥¼ ì ì–´ë„ 하나 ì´ìƒ 발견하였습니다.ê²°ì¸¡ê°’ë“¤ì€ ëŒ€ì‘변수(들)ì˜ ì¤‘ì•™ê°’ìœ¼ë¡œ 대체ë˜ì—ˆìŠµë‹ˆë‹¤.비유사성 행렬(dissimilarity matrix)는 NA ê°’ì„ ê°€ì§ˆ 수 없습니다.군집벡터(clustering vector)ì—서는 NAê°€ 허용ë˜ì§€ 않습니다.'x'는 NA를 가질 수 없습니다.NAì˜ ê°’ì€ ë¹„ìœ ì‚¬ì„± 행렬(dissimilarity matrix)ì— ì‚¬ìš©ë  ìˆ˜ 없습니다.dissimilarity 'dist' ë˜ëŠ” diss.matrix 'dmatrix' 둘 ì¤‘ì— í•˜ë‚˜ê°€ 필요합니다.비유사성 행렬(dissimilarity matrix)ì— NAê°€ 있기 때문ì—, êµ°ì§‘í™” ê³¼ì •ì´ ì‹¤í–‰ë˜ì§€ 않았습니다.비유사성 행렬(dissimilarity matrix)ì—서 NA ê°’ì´ ë°œê²¬ë˜ì—ˆê¸° ë•Œë¬¸ì— êµ°ì§‘í™” ê³¼ì •ì´ ì‹¤í–‰ë˜ì§€ 않았습니다.ê³„ì‚°ëœ ë¹„ìœ ì‚¬ì„± 행렬(dissimilarity matrix) ë‚´ì— NAê°€ 존재하여 êµ°ì§‘í™” ê³¼ì •ì´ ìˆ˜í–‰ë˜ì§€ 않았습니다.결측ë˜ì§€ ì•Šì€ ëª¨ë“  ê°’ë“¤ì´ ë™ì¼í•œ 변수가 발견ë˜ì–´ êµ°ì§‘í™” ê³¼ì •ì´ ìˆ˜í–‰ë˜ì§€ 않았습니다.모든 ë³€ìˆ˜ë“¤ì´ ì ì–´ë„ 하나 ì´ìƒì˜ ê²°ì¸¡ê°’ì„ ê°€ì§€ê¸° ë•Œë¬¸ì— êµ°ì§‘í™” ê³¼ì •ì´ ìˆ˜í–‰ë˜ì§€ 않았습니다.모든 ê°’ì´ ê²°ì¸¡ëœ ê°ì²´ê°€ 발견ë˜ì–´ êµ°ì§‘í™” ê³¼ì •ì´ ìˆ˜í–‰ë˜ì§€ 않았습니다.절반 ì´ìƒì˜ ê°’ë“¤ì´ ê²°ì¸¡ëœ ë³€ìˆ˜ê°€ 발견ë˜ì–´ êµ°ì§‘í™” ê³¼ì •ì´ ìˆ˜í–‰ë˜ì§€ 않았습니다.유효한 silhouette ì •ë³´ê°€ 없습니다 (#{clusters} =? 1)êµ°ì§‘(clusters)ì˜ ê°œìˆ˜ 'k'는 반드시 {1,2, .., n-1}ë‚´ì— ì¡´ìž¬í•´ì•¼ 하므로 n >= 2 입니다.관측값 %s는 *오로지* NAë§Œì„ ê°€ì§‘ë‹ˆë‹¤ --> 군집화를 위하여 ì´ê²ƒë“¤ì„ 제거합니다!군집벡터(clustering vector)ì˜ ê¸¸ì´ê°€ 올바르지 않습니다.êµ°ì§‘(cluster)ì˜ ê°œìˆ˜ëŠ” ì ì–´ë„ 1 ì´ìƒì´ë©° 최대 n-1 ì´ë‚´ì— 있어야 합니다.ì•Œê³ ë¦¬ì¦˜ì˜ %dë²ˆì˜ ë°˜ë³µìˆ˜í–‰ì—ë„ ìˆ˜ë ´í•˜ì§€ ì•Šì„ ìˆ˜ 있습니다.불분명한 군집방법(clustering method)입니다.ì ì–´ë„ 하나 ì´ìƒì˜ ì´í•­ë³€ìˆ˜(binary variable)ê°€ ë‘ ê°€ì§€ ì´ìƒì˜ 수준(levels)ì„ ê°€ì§€ê³  있습니다.ì ì–´ë„ 하나 ì´ìƒì˜ ì´í•­ë³€ìˆ˜(binary variable)ì´ ì„œë¡œ 다른 ë‘ ê°€ì§€ ìˆ˜ì¤€ì„ ê°€ì§€ê³  있지 않습니다.ì ì–´ë„ 하나 ì´ìƒì˜ ì´í•­ë³€ìˆ˜(binary variable)ì´ {0,1,NA} ì™¸ì˜ ê°’ì„ ê°€ì§€ê³  있습니다.ì´í•­ë³€ìˆ˜(binary variable) %s는 구간척ë„(interval scale)로서 다루어집니다. 'x'와 'dist'ê°€ 서로 부합하지 않습니다.í™•ë¥ ê°’ì´ ëª¨ë‘ 0ì´ê±°ë‚˜ ì¼ë¶€ê°€ ìŒìˆ˜ë¡œ ì‚°ì¶œë˜ì—ˆìŠµë‹ˆë‹¤.ellipsoidPoints()는 p >= 3 ì¸ê²½ìš°ì—는 ì•„ì§ êµ¬í˜„ë˜ì§€ 않았습니다..C(cl_pam, *)으로부터 ì—러가 ë°œìƒí–ˆìŠµë‹ˆë‹¤: medIDê°€ 올바르지 않습니다.full silhouette는 'clara(*, keep.data = TRUE)'ì˜ ê²°ê³¼ë§Œì— ì˜¤ë¡œì§€ 사용할 수 있습니다.사용할 수 있는 %sê°€ 아닙니다. 반드시 êµ¬ì„±ìš”ì†Œì— ì´ë¦„ì´ ë¶€ì—¬ëœ ë¦¬ìŠ¤íŠ¸(named list)ì´ì—¬ì•¼ 합니다..C(cl_clara,.)으로부터 얻어진 'jstop'는 다ìŒê³¼ ê°™ì€ ì´ìœ ë¡œ ì´ìƒí•©ë‹ˆë‹¤: 'silhouette' ê°ì²´ê°€ 올바르지 않습니다.올바른 'twins' ê°ì²´ê°€ 아닙니다.군집방법(clustering method)ì˜ ì´ë¦„ì´ ì˜¬ë°”ë¥´ì§€ 않습니다.partition ê°ì²´ê°€ 유효하지 않습니다.silhouette 구조가 올바르지 않습니다.행번호 %2$sì— ìž˜ëª»ëœ ìœ í˜•(type) %1$sì´ ì£¼ì–´ì¡ŒìŠµë‹ˆë‹¤.êµ°ì§‘(cluster)는 ì ì–´ë„ 2ê°œì˜ ê°ì²´ë¥¼ 필요로 합니다.clusplot()ì— ì‚¬ìš©ë  diss와 data ëª¨ë‘ ì°¾ì„ ìˆ˜ 없습니다.diss와 data ëª¨ë‘ ì°¾ì„ ìˆ˜ ì—†ì„ ë¿ë§Œ ì•„ë‹ˆë¼ ì›ëž˜ì˜ ì¸ìž %s ë˜í•œ ì°¾ì„ ìˆ˜ 없습니다.ê²°ì¸¡ê°’ë“¤ì„ ì œì™¸í•˜ë©´ 사용가능한 í¬ì¸íŠ¸ë“¤ì´ ì—†ìŠµë‹ˆë‹¤.NA를 삭제합니다.하나 ë˜ëŠ” ê·¸ ì´ìƒì˜ ê°ì²´ë“¤ì´ 오로지 ê²°ì¸¡ê°’ë§Œì„ í¬í•¨í•˜ê³  있습니다.하나 ë˜ëŠ” ê·¸ ì´ìƒì˜ ë³€ìˆ˜ë“¤ì´ ì˜¤ë¡œì§€ ê²°ì¸¡ê°’ë§Œì„ í¬í•¨í•˜ê³  있습니다.'logical' 변수 %s를 유형(type) 'asymm'으로 설정합니다.멤버쉽(membership) 전부가 1/kì— ë§¤ìš° ê°€ê¹ìŠµë‹ˆë‹¤. ì•„ë§ˆë„ 'memb.exp'를 줄여보는 ê²ƒì€ ì–´ë–¨ê¹Œìš”?대칭(symmetric)ì ì¸ ì •ë°©í–‰ë ¬ì´ ì•„ë‹™ë‹ˆë‹¤.'medoids.x'ê°€ FALSEì¸ ê²½ìš°ì—는 'keep.data' 역시 FALSEì´ì–´ì•¼ 합니다.혼합형 변수(mixed variables)를 ì´ìš©í•  때는 metricì€ ìžë™ìœ¼ë¡œ "gower"ê°€ 사용ë©ë‹ˆë‹¤.x는 ë°ì´í„° 행렬(data matrix)ì´ ì•„ë‹™ë‹ˆë‹¤.x는 ë°ì´í„° í”„ë ˆìž„ì´ ì•„ë‹ˆê±°ë‚˜ 수치형 í–‰ë ¬ì´ ì•„ë‹™ë‹ˆë‹¤.x는 수치형 ë°ì´í„° 프레임 ë˜ëŠ” í–‰ë ¬ì´ ì•„ë‹™ë‹ˆë‹¤.x는 수치형(numeric)ì´ ì•„ë‹™ë‹ˆë‹¤.x는 반드시 행렬 ë˜ëŠ” ë°ì´í„° 프레임ì´ì–´ì•¼ 합니다.cluster/inst/po/ko/LC_MESSAGES/cluster.mo0000644000176200001440000000176314005347355017557 0ustar liggesusersÞ•L |¨$©9ÎIR*kV–$í9IL1–*ÈC level clara(): random k=%d > n ** C level dysta2(): nsel[%s= %d] = %d is outside 0..n, n=%dclara()'s C level dysta2(nsam=%d, p=%d, nbest=%d, n=%d) gave 'toomany_NA'invalid method (code %d)pam(): Bug in C level cstat(), k=%d: ntt=0Project-Id-Version: cluster 1.15.2 Report-Msgid-Bugs-To: PO-Revision-Date: 2015-02-06 21:56-0600 Last-Translator:Chel Hee Lee Language-Team: Chel Hee Lee Language: ko MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plural-Forms: nplurals=1; plural=0; C level clara(): random k=%d > n ** C level dysta2(): nsel[%s= %d] = %d is outside 0..n, n=%dclara()'s C level dysta2(nsam=%d, p=%d, nbest=%d, n=%d) gave 'toomany_NA'메소드가 올바르지 않습니다 (code %d).pam(): Bug in C level cstat(), k=%d: ntt=0cluster/inst/test-tools.R0000644000176200001440000000070514220271153015147 0ustar liggesusers#### Will be sourced by several R scripts in ../tests/ ### ------- General test "tools" (from the Matrix package): ### ==> 'Suggests: Matrix' in ../DESCRIPTION loadNamespace("Matrix", lib.loc = .Library)# needed (e.g. for MM's setup) source(system.file("test-tools-1.R", package = "Matrix", lib.loc = .Library), keep.source = FALSE) if(doExtras <- cluster:::doExtras())## from ../R/0aaa.R cat("doExtras <- cluster:::doExtras() : TRUE\n") cluster/inst/NEWS.Rd0000644000176200001440000004706214764134406013775 0ustar liggesusers% Check from R: % news(db = tools:::.build_news_db_from_package_NEWS_Rd("~/R/Pkgs/cluster/inst/NEWS.Rd"))! \name{NEWS} \title{News for \R Package \pkg{cluster}}% MM: look into ../svn-log-from.all \encoding{UTF-8} %% NB: The date (yyyy-mm-dd) is the "Packaged:" date in ../DESCRIPTION %% NB 2: do not release within 1 year before we have bug fix or new feature. \section{Changes in version 2.1.8.1 (2025-03-11, svn r8502)}{ \subsection{Misc}{ \itemize{ \item use complete argument names in most cases to satisfy lovers of \code{options(warnPartialMatch* = TRUE)}. \item using \code{\(.)} would need R >= 4.1.0. } } } \section{Changes in version 2.1.8 (2024-12-10, svn r8468)}{ \subsection{Bug Fixes}{ \itemize{ \item C codes underlying \code{agnes()} and \code{daisy()} under \command{UBSAN} and \command{LTO} no longer show pointer expression overflow (of a length 0 vector \code{a} with \code{a--} call). } } } \section{Changes in version 2.1.7 (2024-12-06, svn r8466)}{ \subsection{Misc}{ \itemize{ \item \file{man/pam.Rd} \code{set.seed()} for \emph{data}, hence reproducible example. \item \file{src/daisy.c} and \file{src/dysta.c} produced from their Fortran *.f versions by \command{f2c}, my perl script \command{f2c-clean} and manual pretty editing. C function \code{dysta()} now returns the \code{jhalt} "flag"; it is no longer callable from \R, nor is \code{dysta3()} which is 'static' now, in \file{src/fanny.c}. \bold{Goal}: Use \code{.Call()} instead of \code{.C()} and hence allow long vectors for the length \eqn{n(n-1)/2} distance vectors. \item \file{fanny-ex.R} tests: use IGNORE_RDIFF_BEGIN .. and some explicit cheks to become less platform dependent. } } } \section{Changes in version 2.1.6 (2023-11-30, svn r8311)}{ \subsection{Bug Fixes}{ \itemize{ \item \code{clara(*, metric="gower")} is too buggy, and hence \bold{removed} for now, see below (2.1.5). } } \subsection{Misc}{ \itemize{ \item tweak \file{tests/fanny-ex.\{R,Rout.save\}} for less "diffs". } } } \section{Changes in version 2.1.5 (2023-11-27, svn r8301)}{ \subsection{New Features}{ \itemize{ \item \code{pam()} and \code{clara()} also accept a \code{\link{logical}} matrix as input. \item \code{clara()} gets new \code{metric = "gower"} donated by Kasper Fischer-Rasmussen. --- was removed in 2.1.6 because of valgrind-detected memory leaks (and problems/bugs found earlier in R experiments). } } \subsection{Misc}{ \itemize{ \item renamed internal function \code{silhouette.default.R} to \code{silhouetteR}. \item \file{CITATION} switched from old \code{citEntry()} to \code{bibentry()}. \item \code{clara(*, trace = )} prints slightly better info. \item \file{DESCRIPTION} gets \kbd{Enhances: } for packages cross-referenced in \file{man/*.Rd}. } } } \section{Changes in version 2.1.4 (2022-08-19, svn r8119)}{ \subsection{New Features}{ \itemize{ \item New \code{medoids()} to compute \code{pam}-consistent medoids, given a clustering (and data). } } \subsection{Bug Fixes}{ \itemize{ \item \code{help(dissimilarity.object)} % ../man/dissimilarity.object.Rd now correctly describes the meaning of a \code{method = "gower"} result type \code{"T"}. Also, \code{help(daisy)} now extensively documents the different options for \code{type = *}, notably \code{"ordratio"} and \code{"logratio"}. \item \code{pam(x, diss=TRUE)} uses \code{inherits(x, "dissimilarity")} instead of semi-deprecated \code{data.class(x) == "dissimilarity")} to check. \item Using \code{deparse1()} from \R version 4.0.0 and newer (even when \pkg{cluster} is installed into an older versions of R), e.g., in plot default titles. } } } \section{Changes in version 2.1.3 (2022-03-28, svn r8062)}{ \subsection{New Features}{ \itemize{ \item \code{as.data.frame()} now works; suggested by Jonathan Marshall (@Massey, NZ). } } \subsection{Translations}{ \itemize{ \item Updated German translations (Detlef Steuer) } } \subsection{Tweaks}{ \itemize{ \item use explicit cast, quieting \code{-Wconversion}. } } } \section{Changes in version 2.1.2 (2021-04-16, svn r7959)}{% CRAN published 2021-04-17; R 4.1.0 \subsection{New Features}{ \itemize{ \item Updated the Italian translations (by Daniele Medri), the French (by Philippe Grosjean) and the German (by Detlef Steuer). New Lithuanian translations by Gabriele Stupuriene & Rimantas Zakauskas. } } } \section{Changes in version 2.1.1 (2021-02-11, svn r7925)}{ \subsection{New Features}{ \itemize{ \item Added Italian translations from Daniele Medri, and updated the French ones from Philippe Grosjean. \item \code{clara()} gains a \code{cluster.only} argument, entirely \dQuote{in parallel} to \code{pam()}. \item the \code{silhouette()} method for \code{clara} now allows \code{full} to be a number in [0,1] instead of just a logical and it gains gains new optional argument \code{subset} to specify the indices of observations for which silhouette values shold be computed. \item Faster \code{pam()} - \sQuote{fasterPAM} from Erich Schubert. New optional arguments \code{medoids = "random"}, \code{nstart}, and \code{variant}, notably \code{variant = "faster"}. } } } \section{Changes in version 2.1.0 (2019-06-14, svn r7675)}{ \subsection{Bug Fixes}{ \itemize{ \item \code{volume(obj)} is now correct also for ellipsoids of dimension \eqn{d > 2}. \item \command{--enable-lto} compilation revealed missing \code{weights} argument in \file{src/cluster.h}'s declaration of \code{cldaisy()}. } } \subsection{Tweaks}{ \itemize{ \item Replaced many \dQuote{old style} \verb{`'} quotations. } } } \section{Changes in version 2.0.9 (2019-05-01, svn r7663)}{ \subsection{Tweaks}{ \itemize{ \item \file{src/mona.c} now uses correct \emph{void} \code{F77_NAME} and source cleaned. } } } \section{Changes in version 2.0.8 (2019-04-02, svn r7643)}{ \subsection{New Features}{ \itemize{ \item \code{pam()} gets new \code{pamonce} options, for values 3, 4, or 5, choosing versions of \command{fastpam}, contributed by Erich Schubert, Univ. Dortmund. \item update \file{tests/*} to work with R >= 3.6.0 (sample.kind) } } \subsection{Bug Fixes}{ \itemize{ \item correct thinko in \code{?clusGap}, the help page. } } } \section{Changes in version 2.0.7 (2018-03-29, svn r7509)}{ \subsection{New Features}{ \itemize{ \item \code{clara()} gets new option \code{metric = "jaccard"}, contributed by Kamil Kozlowski and Kamil Jadszko. %% FIXME: Also add for pam() !! \item \code{pam()} and \code{clara()} use \code{match.arg(metric)} and hence \code{metric} can be abbreviated (and invalid strings give an error instead of being interpreted as \code{"euclidean"}). } } \subsection{Bug Fixes}{ \itemize{ \item The bug fix of \code{clara(*, correct.d = TRUE)} (from version 2.0.4) for the NA-data case now also applies to the internal C function \code{selec()}. } } } \section{Changes in version 2.0.6 (2017-03-10, svn r7332)}{ \subsection{New Features}{ \itemize{ \item \code{mona()} now C- instead of Fortran-based (having used f2c etc) and now has a \code{trace.lev} option which allows progress reporting \dQuote{remembers} if the original data had missing values. } } \subsection{Bug Fixes}{ \itemize{ \item \code{mona(<1-column>)} no longer loops infinitely but signals an error. } } } \section{Changes in version 2.0.5 (2016-10-07, svn r7278)}{ \subsection{New Features}{ \itemize{ \item \code{clusGap()} gets a new option \code{scaleH0}, and \code{scaleH0 = "original"} is an alternative to the default PCA rotation.%% still see ../TODO-MM ! \item \code{clusGap()} now also stores its \code{call} and uses that for \code{print()}ing and (by default in the \code{main} title) for \code{plot()}ing \code{"clusGap"} objects. \item __ MOSTLY NOT IMPLEMENTED yet __ %%% TODO !!! \code{diana()} gets new optional argument \code{stop.at.k}. When a positive integer, the DIANA algorithm will stop early, as much desirable for large \eqn{n}. } } \subsection{Bug Fixes}{ \itemize{ \item \code{daisy()} gets 3+1 new options \code{warn*} which allow to suppress three different kind of warnings, as these are undesirable in some cases. With thanks to Kirill Müller for the convincing context. \item \code{pam()} now signals an error when there are more than 65536 observational units (whereas it could segfault previously), thanks to a patch from Mikko Korpela, Helsinki. } } } \section{Changes in version 2.0.4 (2016-04-16, svn r7186)}{ \subsection{New Features}{ \itemize{ \item \code{clusGap()} gets a new option \code{d.power = 1} allowing to choose the basic weight statistic as it was originally proposed, namely \emph{squared} distances by setting \code{d.power = 2}. %% ~/R/MM/Pkg-ex/cluster/Gonzalez-on-clusGap.R <-- } } \subsection{Bug Fixes}{ \itemize{ \item fix small glitch in silhouette's help page. \item Finally fixed a bug (in the original Fortran code from Rousseeuw!) in clara's distance computation when there are \code{NA}s in the data. As the fix is not backward compatible, a warning is produced (for the time being) if there \emph{are} \code{NA}s and the user does not explicitly use \code{clara(*, correct.d = TRUE)}. } } } \section{Changes in version 2.0.3 (2015-07-20, svn r6985)}{ \subsection{New Features}{ \itemize{ \item This new \file{NEWS.Rd} file -- going to replace \file{ChangeLog} eventually. } } \subsection{Bug Fixes}{ \itemize{ \item import all we need (but not more) from the "base" pkgs (stats, graphics, ...). } } } \section{Changes in version 2.0.2 (2015-06-18, svn r6955)}{ \subsection{New Features}{ \itemize{ \item using new \code{anyNA()} where appropriate. \item New Korean translations, thanks to Chel Hee Lee. \item \code{plotpart()}: \code{cmdscale()} tweaks. } } \subsection{Bug Fixes}{ \itemize{ \item valgrind detected missing allocation (\code{nisol["1"]} for k=1). \item typo R/daisy.q (R bug %once we require R >= 3.2.0: \PR{16430} \Sexpr[results=rd]{tools:::Rd_expr_PR(16430)}). } } } \section{Changes in version 2.0.1 (2015-01-31, svn r6877)}{ \subsection{Bug Fixes}{ \itemize{ \item Fix \code{silhouette( obj )} for \code{obj <- pam(x, k = 1)}. } } } \section{Changes in version 2.0.0 (2015-01-29, svn r6874)}{ \subsection{New Features}{ \itemize{ \item \code{pam()} now using \code{.Call()} instead of \code{.C()} is potentially considerably more efficient. \item \code{agnes()} has improved \code{trace} behaviour; also, some invalid \code{par.method = *} settings now give an early and understandable error message. \item \code{lower.to.upper.tri.inds()} (etc) now returns \code{integer}. } } \subsection{Bug Fixes}{ \itemize{ \item \code{.C(..)} and \code{.Fortran(..)}: no longer using \code{DUP=FALSE} as that has become deprecated. } } } \section{Changes in version 1.15.3 (2014-09-04, svn r6804)}{ \subsection{New Features}{ \itemize{ \item \code{agnes()} and \code{diana()} finally get, respectively work with a \code{trace.lev} option. \item \code{plot.(agnes|diana)()} now deals well with long \code{call}s, by using multiple title lines. \item Message translations now also for C level error messages. } } \subsection{Bug Fixes}{ \itemize{ \item \code{agnes(*, method="flexible", par.method = c(a1, a2, b, c))}, i.e., \code{length(alpha) == 4}, finally works \emph{correctly}. } } } \section{Changes in version 1.15.2 (2014-03-31, svn r6724)}{ \subsection{New Features}{ \itemize{ \item Rewrote parts of the R level messages so they are more easily translatable, thanks to proposals by Lukasz Daniel. \item French translations from Philippe Grosjean. } } } \section{Changes in version 1.15.1 (2014-03-13, svn r6676)}{ \subsection{Bug Fixes}{ \itemize{ \item \code{mona} example not working in \R < 3.0.x. } } } \section{Changes in version 1.15.0 (2014-03-11, svn r6672)}{ \subsection{New Features}{ \itemize{ \item \code{agnes(*, method = "gaverage")} contributed by Pierre Roudier. \item documentation improvements; \item better translatable messages and translation updates. } } } %% ============================== FIXME =========================== %% ~~~~~~~~~ %% use ../ChangeLog %% ~~~~~~~~~ %% and then %% %% use ../svn-log-from.all %% ~~~~~~~~~~~~~~~~ %% and ../../cluster_Archive.lst {~= CRAN src/contrib/Archive/cluster/ : %% \section{Changes in version 1.14.4 (2013-03-26, svn r6469)}{ \subsection{Tweaks}{ \itemize{ \item 2 de translations; update \file{mona.Rout.save} } } } \section{Changes in version 1.14.3 (2012-10-14, svn r6318)}{ \subsection{New Features}{ \itemize{ \item Polnish translations from Lukasz Daniel. } } \subsection{Misc}{ \itemize{ \item Tweaks for translations. \item Improve \code{clusGap()} examples. } } } \section{Changes in version 1.14.2 (2012-02-06, svn r6069)}{ \subsection{New Features}{ \itemize{ \item New \code{clusGap()} to compute the \dQuote{cluster Gap} goodness-of-fit statistic. \item Export \code{coefHier()} \item \code{as.dendrogram()} now for \code{"twins"}, not just \code{"agnes"}. } } } \section{Changes in version 1.14.1 (2011-10-16, svn r5928)}{ \subsection{New Features}{ \itemize{ \item First translations (into German, thanks to Detlef Steuer). \item better \code{citation("cluster")} } } \subsection{Bug Fixes}{ \itemize{ \item \code{plot.silhouette(..., col = )} had ordering bug. } } } \section{Changes in version 1.14.0 (2011-06-07, svn r5842)}{ \subsection{New Features}{ \itemize{ \item Make \code{clara()} more \code{pam()}-like; provide \code{pamLike = *} option. \item \code{clusplot.default()} re-factored; use new \code{mkCheckX()}; new args \code{add = FALSE}, \code{cex}, \code{cex.txt}. } } \subsection{Bug Fixes}{ \itemize{ \item \code{agnes( )}: correct error now. } } } %% -> /sfs/w/ftp/CRAN/src/contrib/Archive/cluster/ %% 214765 Feb 21 2011 cluster_1.13.3.tar.gz %% 213663 Nov 10 2010 cluster_1.13.2.tar.gz %% 214083 Jun 25 2010 cluster_1.13.1.tar.gz %% 214677 Apr 2 2010 cluster_1.12.3.tar.gz %% 214577 Oct 6 2009 cluster_1.12.1.tar.gz %% 215041 May 13 2009 cluster_1.12.0.tar.gz %% 211085 Mar 31 2009 cluster_1.11.13.tar.gz %% 321990 Jan 7 2009 cluster_1.11.12.tar.gz %% 245055 Jun 16 2008 cluster_1.11.11.tar.gz %% 243446 Feb 29 2008 cluster_1.11.10.tar.gz %% 216573 Oct 2 2007 cluster_1.11.9.tar.gz %% 215257 Sep 4 2007 cluster_1.11.8.tar.gz %% 216815 Jun 5 2007 cluster_1.11.7.tar.gz %% 216729 Apr 27 2007 cluster_1.11.6.tar.gz %% 211615 Mar 31 2007 cluster_1.11.5.tar.gz %% 211634 Dec 12 2006 cluster_1.11.4.tar.gz %% 203692 Dec 2 2006 cluster_1.11.3.tar.gz %% 210927 Sep 7 2006 cluster_1.11.2.tar.gz %% 210091 Aug 25 2006 cluster_1.11.1.tar.gz %% 210215 May 18 2006 cluster_1.11.0.tar.gz %% 195962 Mar 21 2006 cluster_1.10.5.tar.gz %% 197577 Jan 26 2006 cluster_1.10.4.tar.gz %% 197853 Jan 26 2006 cluster_1.10.3.tar.gz %% 190839 Aug 31 2005 cluster_1.10.2.tar.gz %% 190975 Jul 3 2005 cluster_1.10.1.tar.gz %% 189042 Jun 13 2005 cluster_1.10.0.tar.gz %% 179723 Apr 4 2005 cluster_1.9.8.tar.gz %% 176832 Jan 24 2005 cluster_1.9.7.tar.gz %% 174742 Aug 24 2004 cluster_1.9.6.tar.gz %% 174218 Aug 4 2004 cluster_1.9.5.tar.gz %% 175565 Jun 26 2004 cluster_1.9.4.tar.gz %% 173097 Jun 18 2004 cluster_1.9.3.tar.gz %% 173251 Jun 13 2004 cluster_1.9.2.tar.gz %% 169773 Apr 12 2004 cluster_1.9.1.tar.gz %% 170071 Mar 14 2004 cluster_1.8.1.tar.gz %% 165322 Jan 22 2004 cluster_1.8.0.tar.gz %% 161548 Sep 24 2003 cluster_1.7.6.tar.gz %% 161359 Sep 3 2003 cluster_1.7.5.tar.gz %% 161257 Jul 18 2003 cluster_1.7.4.tar.gz %% 160252 Jun 11 2003 cluster_1.7.3.tar.gz %% 158265 Jun 4 2003 cluster_1.7.2.tar.gz %% 157386 May 1 2003 cluster_1.7.1.tar.gz %% 155161 Mar 26 2003 cluster_1.7.0.tar.gz %% 154089 Dec 31 2002 cluster_1.6-4.tar.gz %% 154987 Dec 5 2002 cluster_1.6-3.tar.gz %% 154261 Oct 23 2002 cluster_1.6-2.tar.gz %% 147063 Sep 10 2002 cluster_1.6-1.tar.gz %% 131808 Jul 30 2002 cluster_1.5-2.tar.gz %% 116292 Jun 19 2002 cluster_1.5-1.tar.gz %% 113972 Mar 31 2002 cluster_1.4-2.tar.gz %% 113889 Mar 7 2002 cluster_1.4-1.tar.gz %% 116698 Jan 24 2002 cluster_1.4-0.tar.gz %% 105552 Dec 19 2001 cluster_1.3-6.tar.gz %% 105390 Nov 7 2001 cluster_1.3-5.tar.gz %% 105275 Aug 24 2001 cluster_1.3-4.tar.gz %% 103626 Jun 8 2001 cluster_1.3-3.tar.gz %% 99698 Jan 4 2001 cluster_1.3-2.tar.gz %% 91608 Feb 18 2000 cluster_1.2-3.tar.gz %% 91736 Dec 29 1999 cluster_1.2-2.tar.gz %% 93048 Dec 5 1999 cluster_1.2-1.tar.gz %% ============================== FIXME =========================== \section{Version 1.2-1 -- 1.13-3}{ \subsection{Many historical releases}{ \itemize{ \item 60 more CRAN releases of the package \pkg{cluster} from Dec 1999 to Feb 2011, see also the \file{ChangeLog} file and \command{svn log}. } } } % How can I add vertical space ? % \preformatted{} is not allowed, nor is \cr \section{Version 1.2-0 (1999-04-11)}{ \subsection{First CRAN release of the \pkg{cluster} package, by Kurt Hornik}{ \itemize{ \item Martin Maechler had its own version independently. \item Both closely modeled after \code{clus} the tarball off JSS. }} \subsection{R Functions -- Fortran Files}{ \itemize{ \item \code{agnes()} -- \file{twins.f} for the \dQuote{twins} \code{agnes} and \code{diana}. \item \code{clara()} -- \code{clara.f} \item \code{daisy()} -- \file{daisy.f} (and \file{meet.f}) \item \code{diana()} -- (twins.f) \item \code{fanny()} -- \file{fanny.f} \item \code{mona()} -- \file{mona.f} \item \code{pam()} -- \file{pam.f} } } \subsection{Data Sets}{ \itemize{ \item agriculture \item animals \item flower \item ruspini \item votes.repub } } \subsection{Further Features}{ \itemize{ \item all Examples in \file{man/*.Rd} hand edited to become executable. \item \code{summary()}, \code{print()} (and \code{print.summary.**()} methods) for the six basic \R functions above. } } } \section{Version 1.1-2 (1998-06-16)}{ \subsection{Renamed previous \pkg{clus} to \pkg{cluster}}{ \itemize{ \item . } } } \section{Version 1.1-1 (1998-06-15)}{ \subsection{New Features}{ \itemize{ \item started \file{ChangeLog} } } } cluster/build/0000755000176200001440000000000014764135157013047 5ustar liggesuserscluster/build/partial.rdb0000644000176200001440000000010114764135157015164 0ustar liggesusers‹‹àb```b`ae``b1…À€…‰‘…“5/17µ˜A"Éðž/ÕÛ7cluster/man/0000755000176200001440000000000014764134022012511 5ustar liggesuserscluster/man/silhouette.Rd0000644000176200001440000002173414402061503015164 0ustar liggesusers\name{silhouette} \alias{silhouette} \alias{silhouette.clara} \alias{silhouette.default} \alias{silhouette.partition} \alias{sortSilhouette} \alias{summary.silhouette} \alias{print.summary.silhouette} \alias{plot.silhouette} \title{Compute or Extract Silhouette Information from Clustering} \description{ Compute silhouette information according to a given clustering in \eqn{k} clusters. } \usage{ silhouette(x, \dots) \method{silhouette}{default} (x, dist, dmatrix, \dots) \method{silhouette}{partition}(x, \dots) \method{silhouette}{clara}(x, full = FALSE, subset = NULL, \dots) sortSilhouette(object, \dots) \method{summary}{silhouette}(object, FUN = mean, \dots) \method{plot}{silhouette}(x, nmax.lab = 40, max.strlen = 5, main = NULL, sub = NULL, xlab = expression("Silhouette width "* s[i]), col = "gray", do.col.sort = length(col) > 1, border = 0, cex.names = par("cex.axis"), do.n.k = TRUE, do.clus.stat = TRUE, \dots) } \arguments{ \item{x}{an object of appropriate class; for the \code{default} method an integer vector with \eqn{k} different integer cluster codes or a list with such an \code{x$clustering} component. Note that silhouette statistics are only defined if \eqn{2 \le k \le n-1}{2 <= k <= n-1}.} \item{dist}{a dissimilarity object inheriting from class \code{\link{dist}} or coercible to one. If not specified, \code{dmatrix} must be.} \item{dmatrix}{a symmetric dissimilarity matrix (\eqn{n \times n}{n x n}), specified instead of \code{dist}, which can be more efficient.} \item{full}{logical or number in \eqn{[0,1]} specifying if a \emph{full} silhouette should be computed for \code{\link{clara}} object. When a number, say \eqn{f}, for a random \code{\link{sample.int}(n, size = f*n)} of the data the silhouette values are computed. This requires \eqn{O((f*n)^2)} memory, since the full dissimilarity of the (sub)sample (see \code{\link{daisy}}) is needed internally.} \item{subset}{a subset from \code{1:n}, specified instead of \code{full} to specify the indices of the observations to be used for the silhouette computations.} \item{object}{an object of class \code{silhouette}.} \item{\dots}{further arguments passed to and from methods.} \item{FUN}{function used to summarize silhouette widths.} \item{nmax.lab}{integer indicating the number of labels which is considered too large for single-name labeling the silhouette plot.} \item{max.strlen}{positive integer giving the length to which strings are truncated in silhouette plot labeling.} \item{main, sub, xlab}{arguments to \code{\link{title}}; have a sensible non-NULL default here.} \item{col, border, cex.names}{arguments passed \code{\link{barplot}()}; note that the default used to be \code{col = heat.colors(n), border = par("fg")} instead.\cr \code{col} can also be a color vector of length \eqn{k} for clusterwise coloring, see also \code{do.col.sort}: } \item{do.col.sort}{logical indicating if the colors \code{col} should be sorted \dQuote{along} the silhouette; this is useful for casewise or clusterwise coloring.} \item{do.n.k}{logical indicating if \eqn{n} and \eqn{k} \dQuote{title text} should be written.} \item{do.clus.stat}{logical indicating if cluster size and averages should be written right to the silhouettes.} } \details{ For each observation i, the \emph{silhouette width} \eqn{s(i)} is defined as follows: \cr Put a(i) = average dissimilarity between i and all other points of the cluster to which i belongs (if i is the \emph{only} observation in its cluster, \eqn{s(i) := 0} without further calculations). For all \emph{other} clusters C, put \eqn{d(i,C)} = average dissimilarity of i to all observations of C. The smallest of these \eqn{d(i,C)} is \eqn{b(i) := \min_C d(i,C)}, and can be seen as the dissimilarity between i and its \dQuote{neighbor} cluster, i.e., the nearest one to which it does \emph{not} belong. Finally, \deqn{s(i) := \frac{b(i) - a(i) }{max(a(i), b(i))}.}{% s(i) := ( b(i) - a(i) ) / max( a(i), b(i) ).} \code{silhouette.default()} is now based on C code donated by Romain Francois (the R version being still available as \code{cluster:::silhouetteR}). Observations with a large \eqn{s(i)} (almost 1) are very well clustered, a small \eqn{s(i)} (around 0) means that the observation lies between two clusters, and observations with a negative \eqn{s(i)} are probably placed in the wrong cluster. } \note{ While \code{silhouette()} is \emph{intrinsic} to the \code{\link{partition}} clusterings, and hence has a (trivial) method for these, it is straightforward to get silhouettes from hierarchical clusterings from \code{silhouette.default()} with \code{\link{cutree}()} and distance as input. By default, for \code{\link{clara}()} partitions, the silhouette is just for the best random \emph{subset} used. Use \code{full = TRUE} to compute (and later possibly plot) the full silhouette. } \value{ \code{silhouette()} returns an object, \code{sil}, of class \code{silhouette} which is an \eqn{n \times 3}{n x 3} matrix with attributes. For each observation i, \code{sil[i,]} contains the cluster to which i belongs as well as the neighbor cluster of i (the cluster, not containing i, for which the average dissimilarity between its observations and i is minimal), and the silhouette width \eqn{s(i)} of the observation. The \code{\link{colnames}} correspondingly are \code{c("cluster", "neighbor", "sil_width")}. \code{summary(sil)} returns an object of class \code{summary.silhouette}, a list with components \describe{ \item{\code{si.summary}:}{numerical \code{\link{summary}} of the individual silhouette widths \eqn{s(i)}.} \item{\code{clus.avg.widths}:}{numeric (rank 1) array of clusterwise \emph{means} of silhouette widths where \code{mean = FUN} is used.} \item{\code{avg.width}:}{the total mean \code{FUN(s)} where \code{s} are the individual silhouette widths.} \item{\code{clus.sizes}:}{\code{\link{table}} of the \eqn{k} cluster sizes.} \item{\code{call}:}{if available, the \code{\link{call}} creating \code{sil}.} \item{\code{Ordered}:}{logical identical to \code{attr(sil, "Ordered")}, see below.} } \code{sortSilhouette(sil)} orders the rows of \code{sil} as in the silhouette plot, by cluster (increasingly) and decreasing silhouette width \eqn{s(i)}. \cr \code{attr(sil, "Ordered")} is a logical indicating if \code{sil} \emph{is} ordered as by \code{sortSilhouette()}. In that case, \code{rownames(sil)} will contain case labels or numbers, and \cr \code{attr(sil, "iOrd")} the ordering index vector. } \references{ Rousseeuw, P.J. (1987) Silhouettes: A graphical aid to the interpretation and validation of cluster analysis. \emph{J. Comput. Appl. Math.}, \bold{20}, 53--65. chapter 2 of Kaufman and Rousseeuw (1990), see the references in \code{\link{plot.agnes}}. } \seealso{\code{\link{partition.object}}, \code{\link{plot.partition}}. } \examples{ data(ruspini) pr4 <- pam(ruspini, 4) str(si <- silhouette(pr4)) (ssi <- summary(si)) plot(si) # silhouette plot plot(si, col = c("red", "green", "blue", "purple"))# with cluster-wise coloring si2 <- silhouette(pr4$clustering, dist(ruspini, "canberra")) summary(si2) # has small values: "canberra"'s fault plot(si2, nmax= 80, cex.names=0.6) op <- par(mfrow= c(3,2), oma= c(0,0, 3, 0), mgp= c(1.6,.8,0), mar= .1+c(4,2,2,2)) for(k in 2:6) plot(silhouette(pam(ruspini, k=k)), main = paste("k = ",k), do.n.k=FALSE) mtext("PAM(Ruspini) as in Kaufman & Rousseeuw, p.101", outer = TRUE, font = par("font.main"), cex = par("cex.main")); frame() ## the same with cluster-wise colours: c6 <- c("tomato", "forest green", "dark blue", "purple2", "goldenrod4", "gray20") for(k in 2:6) plot(silhouette(pam(ruspini, k=k)), main = paste("k = ",k), do.n.k=FALSE, col = c6[1:k]) par(op) ## clara(): standard silhouette is just for the best random subset data(xclara) set.seed(7) str(xc1k <- xclara[ sample(nrow(xclara), size = 1000) ,]) # rownames == indices cl3 <- clara(xc1k, 3) plot(silhouette(cl3))# only of the "best" subset of 46 ## The full silhouette: internally needs large (36 MB) dist object: sf <- silhouette(cl3, full = TRUE) ## this is the same as s.full <- silhouette(cl3$clustering, daisy(xc1k)) stopifnot(all.equal(sf, s.full, check.attributes = FALSE, tolerance = 0)) ## color dependent on original "3 groups of each 1000": % __FIXME ??__ plot(sf, col = 2+ as.integer(names(cl3$clustering) ) \%/\% 1000, main ="plot(silhouette(clara(.), full = TRUE))") ## Silhouette for a hierarchical clustering: ar <- agnes(ruspini) si3 <- silhouette(cutree(ar, k = 5), # k = 4 gave the same as pam() above daisy(ruspini)) stopifnot(is.data.frame(di3 <- as.data.frame(si3))) plot(si3, nmax = 80, cex.names = 0.5) ## 2 groups: Agnes() wasn't too good: si4 <- silhouette(cutree(ar, k = 2), daisy(ruspini)) plot(si4, nmax = 80, cex.names = 0.5) } \keyword{cluster} cluster/man/clusplot.partition.Rd0000644000176200001440000000545114277710074016670 0ustar liggesusers\name{clusplot} \alias{clusplot} \alias{clusplot.partition} \title{Bivariate Cluster Plot (of a Partitioning Object)} \description{ Draws a 2-dimensional \dQuote{clusplot} (clustering plot) on the current graphics device. The generic function has a default and a \code{partition} method. } \usage{ clusplot(x, \dots) \method{clusplot}{partition}(x, main = NULL, dist = NULL, \dots) } \arguments{ \item{x}{an \R object, here, specifically an object of class \code{"partition"}, e.g. created by one of the functions \code{\link{pam}}, \code{\link{clara}}, or \code{\link{fanny}}.} \item{main}{title for the plot; when \code{NULL} (by default), a title is constructed, using \code{x$call}.} \item{dist}{when \code{x} does not have a \code{diss} nor a \code{data} component, e.g., for \code{\link{pam}(dist(*), keep.diss=FALSE)}, \code{dist} must specify the dissimilarity for the clusplot.} \item{\dots}{optional arguments passed to methods, notably the \code{\link{clusplot.default}} method (except for the \code{diss} one) may also be supplied to this function. Many graphical parameters (see \code{\link{par}}) may also be supplied as arguments here.} } \section{Side Effects}{ a 2-dimensional clusplot is created on the current graphics device. } \value{ For the \code{partition} (and \code{default}) method: An invisible list with components \code{Distances} and \code{Shading}, as for \code{\link{clusplot.default}}, see there. } \details{ The \code{clusplot.partition()} method relies on \code{\link{clusplot.default}}. If the clustering algorithms \code{pam}, \code{fanny} and \code{clara} are applied to a data matrix of observations-by-variables then a clusplot of the resulting clustering can always be drawn. When the data matrix contains missing values and the clustering is performed with \code{\link{pam}} or \code{\link{fanny}}, the dissimilarity matrix will be given as input to \code{clusplot}. When the clustering algorithm \code{\link{clara}} was applied to a data matrix with \code{\link{NA}}s then \code{clusplot()} will replace the missing values as described in \code{\link{clusplot.default}}, because a dissimilarity matrix is not available. } \seealso{\code{\link{clusplot.default}} for references; \code{\link{partition.object}}, \code{\link{pam}}, \code{\link{pam.object}}, \code{\link{clara}}, \code{\link{clara.object}}, \code{\link{fanny}}, \code{\link{fanny.object}}, \code{\link{par}}. } \examples{ ## For more, see ?clusplot.default ## generate 25 objects, divided into 2 clusters. x <- rbind(cbind(rnorm(10,0,0.5), rnorm(10,0,0.5)), cbind(rnorm(15,5,0.5), rnorm(15,5,0.5))) clusplot(pam(x, 2)) ## add noise, and try again : x4 <- cbind(x, rnorm(25), rnorm(25)) clusplot(pam(x4, 2)) } \keyword{cluster} \keyword{hplot} cluster/man/summary.mona.Rd0000644000176200001440000000075513467043363015443 0ustar liggesusers\name{summary.mona} \alias{summary.mona} \alias{print.summary.mona} \title{Summary Method for 'mona' Objects} \description{Returns (and prints) a summary list for a \code{mona} object.} \usage{ \method{summary}{mona}(object, \dots) \method{print}{summary.mona}(x, \dots) } \arguments{ \item{x, object}{a \code{\link{mona}} object.} \item{\dots}{potential further arguments (require by generic).} } \seealso{\code{\link{mona}}, \code{\link{mona.object}}.} \keyword{cluster} \keyword{print} cluster/man/flower.Rd0000644000176200001440000000423114465673501014306 0ustar liggesusers\name{flower} \alias{flower} \title{Flower Characteristics} \usage{data(flower)} \description{8 characteristics for 18 popular flowers.} \format{ A data frame with 18 observations on 8 variables: \tabular{rll}{ [ , "V1"] \tab factor \tab winters \cr [ , "V2"] \tab factor \tab shadow \cr [ , "V3"] \tab factor \tab tubers \cr [ , "V4"] \tab factor \tab color \cr [ , "V5"] \tab ordered \tab soil \cr [ , "V6"] \tab ordered \tab preference \cr [ , "V7"] \tab numeric \tab height \cr [ , "V8"] \tab numeric \tab distance } \describe{ \item{V1}{winters, is binary and indicates whether the plant may be left in the garden when it freezes.} \item{V2}{shadow, is binary and shows whether the plant needs to stand in the shadow.} \item{V3}{tubers, is asymmetric binary and distinguishes between plants with tubers and plants that grow in any other way.} \item{V4}{color, is nominal and specifies the flower's color (1 = white, 2 = yellow, 3 = pink, 4 = red, 5 = blue).} \item{V5}{soil, is ordinal and indicates whether the plant grows in dry (1), normal (2), or wet (3) soil.} \item{V6}{preference, is ordinal and gives someone's preference ranking going from 1 to 18.} \item{V7}{height, is interval scaled, the plant's height in centimeters.} \item{V8}{distance, is interval scaled, the distance in centimeters that should be left between the plants.} } } \references{ Struyf, Hubert and Rousseeuw (1996), see \code{\link{agnes}}. } \examples{ data(flower) str(flower) # factors, ordered, numeric ## "Nicer" version (less numeric more self explainable) of 'flower': flowerN <- flower colnames(flowerN) <- c("winters", "shadow", "tubers", "color", "soil", "preference", "height", "distance") for(j in 1:3) flowerN[,j] <- (flowerN[,j] == "1") levels(flowerN$color) <- c("1" = "white", "2" = "yellow", "3" = "pink", "4" = "red", "5" = "blue")[levels(flowerN$color)] levels(flowerN$soil) <- c("1" = "dry", "2" = "normal", "3" = "wet")[levels(flowerN$soil)] flowerN ## ==> example(daisy) on how it is used } \keyword{datasets} cluster/man/xclara.Rd0000644000176200001440000000506313355614250014257 0ustar liggesusers\name{xclara} \alias{xclara} \title{Bivariate Data Set with 3 Clusters} \description{ An artificial data set consisting of 3000 points in 3 quite well-separated clusters. } \usage{data(xclara)} \format{ A data frame with 3000 observations on 2 numeric variables (named \code{V1} and \code{V2}) giving the \eqn{x} and \eqn{y} coordinates of the points, respectively. } \source{ Sample data set accompanying the reference below (file \file{xclara.dat} in side \file{clus_examples.tar.gz}). } \note{ Our version of the \code{xclara} is slightly more rounded than the one from \code{\link{read.table}("xclara.dat")} and the relative difference measured by \code{\link{all.equal}} is \code{1.15e-7} for \code{V1} and \code{1.17e-7} for \code{V2} which suggests that our version has been the result of a \code{\link{options}(digits = 7)} formatting. Previously (before May 2017), it was claimed the three cluster were each of size 1000, which is clearly wrong. \code{\link{pam}(*, 3)} gives cluster sizes of 899, 1149, and 952, which apart from seven \dQuote{outliers} (or \dQuote{mislabellings}) correspond to observation indices \eqn{\{1:900\}}{1:900}, \eqn{\{901:2050\}}{901:2050}, and \eqn{\{2051:3000\}}{2051:3000}, see the example. } \references{ Anja Struyf, Mia Hubert & Peter J. Rousseeuw (1996) Clustering in an Object-Oriented Environment. \emph{Journal of Statistical Software} \bold{1}. \doi{10.18637/jss.v001.i04} } \keyword{datasets} \examples{ ## Visualization: Assuming groups are defined as {1:1000}, {1001:2000}, {2001:3000} plot(xclara, cex = 3/4, col = rep(1:3, each=1000)) p.ID <- c(78, 1411, 2535) ## PAM's medoid indices == pam(xclara, 3)$id.med text(xclara[p.ID,], labels = 1:3, cex=2, col=1:3) \donttest{%% TODO: a clara() call with the _identical_ clustering (but faster!) px <- pam(xclara, 3) ## takes ~2 seconds cxcl <- px$clustering ; iCl <- split(seq_along(cxcl), cxcl) boxplot(iCl, range = 0.7, horizontal=TRUE, main = "Indices of the 3 clusters of pam(xclara, 3)") ## Look more closely now: bxCl <- boxplot(iCl, range = 0.7, plot=FALSE) ## We see 3 + 2 + 2 = 7 clear "outlier"s or "wrong group" observations: with(bxCl, rbind(out, group)) ## out 1038 1451 1610 30 327 562 770 ## group 1 1 1 2 2 3 3 ## Apart from these, what are the robust ranges of indices? -- Robust range: t(iR <- bxCl$stats[c(1,5),]) ## 1 900 ## 901 2050 ## 2051 3000 gc <- adjustcolor("gray20",1/2) abline(v = iR, col = gc, lty=3) axis(3, at = c(0, iR[2,]), padj = 1.2, col=gc, col.axis=gc) }% dont }cluster/man/agriculture.Rd0000644000176200001440000000274211711740461015332 0ustar liggesusers\name{agriculture} \alias{agriculture} \title{European Union Agricultural Workforces} \usage{data(agriculture)} \description{ Gross National Product (GNP) per capita and percentage of the population working in agriculture for each country belonging to the European Union in 1993. } \format{ A data frame with 12 observations on 2 variables: \tabular{rlll}{ [ , 1] \tab \code{x} \tab numeric \tab per capita GNP \cr [ , 2] \tab \code{y} \tab numeric \tab percentage in agriculture } The row names of the data frame indicate the countries. } \source{ Eurostat (European Statistical Agency, 1994): \emph{Cijfers en feiten: Een statistisch portret van de Europese Unie}. } \details{ The data seem to show two clusters, the \dQuote{more agricultural} one consisting of Greece, Portugal, Spain, and Ireland. } \seealso{\code{\link{agnes}}, \code{\link{daisy}}, \code{\link{diana}}. } \references{ see those in \code{\link{agnes}}. } \examples{ data(agriculture) ## Compute the dissimilarities using Euclidean metric and without ## standardization daisy(agriculture, metric = "euclidean", stand = FALSE) ## 2nd plot is similar to Figure 3 in Struyf et al (1996) plot(pam(agriculture, 2)) ## Plot similar to Figure 7 in Struyf et al (1996) \dontrun{plot(agnes(agriculture), ask = TRUE)} \dontshow{plot(agnes(agriculture))} ## Plot similar to Figure 8 in Struyf et al (1996) \dontrun{plot(diana(agriculture), ask = TRUE)} \dontshow{plot(diana(agriculture))} } \keyword{datasets} cluster/man/medoids.Rd0000644000176200001440000000416514764134022014432 0ustar liggesusers\name{medoids} \alias{medoids} \title{Compute \code{pam}-consistent Medoids from Clustering} \description{ Given a data matrix or dissimilarity \code{x} for say \eqn{n} observational units and a clustering, compute the \code{\link{pam}()}-consistent medoids. } \usage{ medoids(x, clustering, diss = inherits(x, "dist"), USE.NAMES = FALSE, ...) } \arguments{ \item{x}{Either a data matrix or data frame, or dissimilarity matrix or object, see also \code{\link{pam}}.} \item{clustering}{an integer vector of length \eqn{n}, the number of observations, giving for each observation the number ('id') of the cluster to which it belongs. In other words, \code{clustering} has values from \code{1:k} where \code{k} is the number of clusters, see also \code{\link{partition.object}} and \code{\link{cutree}()}, for examples where such clustering vectors are computed.} \item{diss}{see also \code{\link{pam}}.} \item{USE.NAMES}{a logical, typical false, passed to the \code{\link{vapply}()} call computing the medoids.} \item{\dots}{optional further argument passed to \code{\link{pam}(xj, k=1, \dots)}, notably \code{metric}, or \code{variant="f_5"} to use a faster algorithm, or \code{trace.lev = k}.} } %% \details{ %% } \value{ a numeric vector of length } %% \references{ %% } \author{Martin Maechler, after being asked how \code{\link{pam}()} could be used instead of \code{\link{kmeans}()}, starting from a previous clustering. } %% \note{ %% } \seealso{ \code{\link{pam}}, \code{\link{kmeans}}. Further, \code{\link{cutree}()} and \code{\link{agnes}} (or \code{\link{hclust}}). } \examples{ ## From example(agnes): data(votes.repub) agn1 <- agnes(votes.repub, metric = "manhattan", stand = TRUE) agn2 <- agnes(daisy(votes.repub), diss = TRUE, method = "complete") agnS <- agnes(votes.repub, method = "flexible", par.method = 0.625) for(k in 2:11) { print(table(cl.k <- cutree(agnS, k=k))) stopifnot(length(cl.k) == nrow(votes.repub), 1 <= cl.k, cl.k <= k, table(cl.k) >= 2) m.k <- medoids(votes.repub, cl.k) cat("k =", k,"; sort(medoids) = "); dput(sort(m.k), control={}) } } \keyword{cluster} cluster/man/print.agnes.Rd0000644000176200001440000000134613467043363015242 0ustar liggesusers\name{print.agnes} \alias{print.agnes} \title{Print Method for AGNES Objects} \description{ Prints the call, agglomerative coefficient, ordering of objects and distances between merging clusters ('Height') of an \code{agnes} object. This is a method for the generic \code{\link{print}()} function for objects inheriting from class \code{agnes}, see \code{\link{agnes.object}}. } \usage{ \method{print}{agnes}(x, \dots) } \arguments{ \item{x}{an agnes object.} \item{\dots}{potential further arguments (required by generic).} } \seealso{ \code{\link{summary.agnes}} producing more output; \code{\link{agnes}}, \code{\link{agnes.object}}, \code{\link{print}}, \code{\link{print.default}}. } \keyword{cluster} \keyword{print} cluster/man/volume.ellipsoid.Rd0000644000176200001440000000272713467043541016306 0ustar liggesusers\name{volume.ellipsoid} \alias{volume} \alias{volume.ellipsoid} \title{Compute the Volume (of an Ellipsoid)} \description{ Compute the volume of geometric \R object. This is a generic function and has a method for \code{ellipsoid} objects (typically resulting from \code{\link{ellipsoidhull}()}. } \usage{ volume(object, \dots) \method{volume}{ellipsoid}(object, log = FALSE, \dots) } \arguments{ \item{object}{an \R object the volume of which is wanted; for the \code{ellipsoid} method, an object of that class (see \code{\link{ellipsoidhull}} or the example below).} \item{log}{\code{\link{logical}} indicating if the volume should be returned in log scale. Maybe needed in largish dimensions.} \item{\dots}{potential further arguments of methods, e.g. \code{log}.} } \value{ a number, the volume \eqn{V} (or \eqn{\log(V)} if \code{log = TRUE}) of the given \code{object}. } \author{ Martin Maechler (2002, extracting from former \code{\link{clusplot}} code); Keefe Murphy (2019) provided code for dimensions \eqn{d > 2}. } \seealso{\code{\link{ellipsoidhull}} for spanning ellipsoid computation.} \examples{ ## example(ellipsoidhull) # which defines 'ellipsoid' object myEl <- structure(list(cov = rbind(c(3,1),1:2), loc = c(0,0), d2 = 10), class = "ellipsoid") volume(myEl)# i.e. "area" here (d = 2) myEl # also mentions the "volume" set.seed(1) d5 <- matrix(rt(500, df=3), 100,5) e5 <- ellipsoidhull(d5) } \keyword{utilities} cluster/man/ruspini.Rd0000644000176200001440000000136311711740461014473 0ustar liggesusers\name{ruspini} \alias{ruspini} \title{Ruspini Data} \usage{data(ruspini)} \description{ The Ruspini data set, consisting of 75 points in four groups that is popular for illustrating clustering techniques. } \format{ A data frame with 75 observations on 2 variables giving the x and y coordinates of the points, respectively. } \source{ E. H. Ruspini (1970) Numerical methods for fuzzy clustering. \emph{Inform. Sci.} \bold{2}, 319--350. } \references{ see those in \code{\link{agnes}}. } \examples{ data(ruspini) ## Plot similar to Figure 4 in Stryuf et al (1996) \dontrun{plot(pam(ruspini, 4), ask = TRUE)} \dontshow{plot(pam(ruspini, 4))} ## Plot similar to Figure 6 in Stryuf et al (1996) plot(fanny(ruspini, 5)) } \keyword{datasets} cluster/man/daisy.Rd0000644000176200001440000003012714764133305014117 0ustar liggesusers\name{daisy} \alias{daisy} \title{Dissimilarity Matrix Calculation} \concept{Gower's formula} \concept{Gower's distance} \concept{Gower's coefficient}% FIXME: see ../TODO-MM \description{ Compute all the pairwise dissimilarities (distances) between observations in the data set. The original variables may be of mixed types. In that case, or whenever \code{metric = "gower"} is set, a generalization of Gower's formula is used, see \sQuote{Details} below. } \usage{ daisy(x, metric = c("euclidean", "manhattan", "gower"), stand = FALSE, type = list(), weights = rep.int(1, p), warnBin = warnType, warnAsym = warnType, warnConst = warnType, warnType = TRUE) } \arguments{ \item{x}{ numeric matrix or data frame, of dimension \eqn{n\times p}{n x p}, say. Dissimilarities will be computed between the rows of \code{x}. Columns of mode \code{numeric} (i.e. all columns when \code{x} is a matrix) will be recognized as interval scaled variables, columns of class \code{factor} will be recognized as nominal variables, and columns of class \code{ordered} will be recognized as ordinal variables. Other variable types should be specified with the \code{type} argument. Missing values (\code{\link{NA}}s) are allowed. } \item{metric}{ character string specifying the metric to be used. The currently available options are \code{"euclidean"} (the default), \code{"manhattan"} and \code{"gower"}.\cr Euclidean distances are root sum-of-squares of differences, and manhattan distances are the sum of absolute differences. \dQuote{Gower's distance} is chosen by metric \code{"gower"} or automatically if some columns of \code{x} are not numeric. Also known as Gower's coefficient (1971), expressed as a dissimilarity, this implies that a particular standardisation will be applied to each variable, and the \dQuote{distance} between two units is the sum of all the variable-specific distances, see the details section. } \item{stand}{logical flag: if TRUE, then the measurements in \code{x} are standardized before calculating the dissimilarities. Measurements are standardized for each variable (column), by subtracting the variable's mean value and dividing by the variable's mean absolute deviation. If not all columns of \code{x} are numeric, \code{stand} will be ignored and Gower's standardization (based on the \code{\link{range}}) will be applied in any case, see argument \code{metric}, above, and the details section. } \item{type}{list for specifying some (or all) of the types of the variables (columns) in \code{x}. The list may contain the following components: \describe{ \item{\code{"asymm"} }{\bold{A}symmetric binary variable, aka \code{"A"} in result \code{Types}, see \code{\link{dissimilarity.object}}.} \item{\code{"symm"} }{\bold{S}ymmetric binary variable, aka \code{"S"}.} \item{\code{"factor"} }{\bold{N}ominal -- the default for \code{\link{factor}} variables, aka \code{"N"}. When the factor has 2 levels, this is equivalent to \code{type = "S"} for a (symmetric) binary variable.} \item{\code{"ordered"}}{\bold{O}rdinal -- the default for \code{\link{ordered}} (factor) variables, aka \code{"O"}, see \code{\link{dissimilarity.object}}.} \item{\code{"logratio"}}{ratio scaled numeric variables that are to be logarithmically transformed (\code{\link{log10}}) and then treated as numeric (\code{"I"}): must be \emph{positive} numeric variable.} \item{\code{"ordratio"}}{\dQuote{ra\bold{T}io}-like variable to be treated as \code{\link{ordered}} (using the factor codes \code{unclass(\link{as.ordered}(x[,j]))}), aka \code{"T"}.} \item{\code{"numeric"}/\code{"integer"}}{\bold{I}nterval scaled -- the \bold{default} for all numeric (incl \code{integer}) columns of \code{x}, aka \code{"I"} in result \code{Types}, see \code{\link{dissimilarity.object}}.} } Each component is a (character or numeric) vector, containing either the names or the numbers of the corresponding columns of \code{x}. Variables not mentioned in \code{type} are interpreted as usual, see argument \code{x}, and also \sQuote{default} above. Consequently, the default \code{type = list()} may often be sufficient. } \item{weights}{an optional numeric vector of length \eqn{p}(=\code{ncol(x)}); to be used in \dQuote{case 2} (mixed variables, or \code{metric = "gower"}), specifying a weight for each variable (\code{x[,k]}) instead of \eqn{1} in Gower's original formula.} \item{warnBin, warnAsym, warnConst}{logicals indicating if the corresponding type checking warnings should be signalled (when found).} \item{warnType}{logical indicating if \emph{all} the type checking warnings should be active or not.} }% end{arg..} \value{ an object of class \code{"dissimilarity"} containing the dissimilarities among the rows of \code{x}. This is typically the input for the functions \code{pam}, \code{fanny}, \code{agnes} or \code{diana}. For more details, see \code{\link{dissimilarity.object}}. } \details{ The original version of \code{daisy} is fully described in chapter 1 of Kaufman and Rousseeuw (1990). Compared to \code{\link{dist}} whose input must be numeric variables, the main feature of \code{daisy} is its ability to handle other variable types as well (e.g. nominal, ordinal, (a)symmetric binary) even when different types occur in the same data set. The handling of nominal, ordinal, and (a)symmetric binary data is achieved by using the general dissimilarity coefficient of Gower (1971). If \code{x} contains any columns of these data-types, both arguments \code{metric} and \code{stand} will be ignored and Gower's coefficient will be used as the metric. This can also be activated for purely numeric data by \code{metric = "gower"}. With that, each variable (column) is first standardized by dividing each entry by the range of the corresponding variable, after subtracting the minimum value; consequently the rescaled variable has range \eqn{[0,1]}, exactly. %% FIXME: Use something like "gowerRob" which uses *robust* rescaling Note that setting the type to \code{symm} (symmetric binary) gives the same dissimilarities as using \emph{nominal} (which is chosen for non-ordered factors) only when no missing values are present, and more efficiently. Note that \code{daisy} signals a warning when 2-valued numerical variables do not have an explicit \code{type} specified, because the reference authors recommend to consider using \code{"asymm"}; the warning may be silenced by \code{warnBin = FALSE}. In the \code{daisy} algorithm, missing values in a row of x are not included in the dissimilarities involving that row. There are two main cases, \enumerate{ \item If all variables are interval scaled (and \code{metric} is \emph{not} \code{"gower"}), the metric is "euclidean", and \eqn{n_g} is the number of columns in which neither row i and j have NAs, then the dissimilarity d(i,j) returned is \eqn{\sqrt{p/n_g}}{sqrt(p/n_g)} (\eqn{p=}ncol(x)) times the Euclidean distance between the two vectors of length \eqn{n_g} shortened to exclude NAs. The rule is similar for the "manhattan" metric, except that the coefficient is \eqn{p/n_g}. If \eqn{n_g = 0}, the dissimilarity is NA. \item When some variables have a type other than interval scaled, or if \code{metric = "gower"} is specified, the dissimilarity between two rows is the weighted mean of the contributions of each variable. Specifically, \deqn{d_{ij} = d(i,j) = \frac{\sum_{k=1}^p w_k \delta_{ij}^{(k)} d_{ij}^{(k)}}{ \sum_{k=1}^p w_k \delta_{ij}^{(k)}}. }{d_ij = d(i,j) = sum(k=1:p; w_k delta(ij;k) d(ij,k)) / sum(k=1:p; w_k delta(ij;k)).} In other words, \eqn{d_{ij}}{d_ij} is a weighted mean of \eqn{d_{ij}^{(k)}}{d(ij,k)} with weights \eqn{w_k \delta_{ij}^{(k)}}{w_k delta(ij;k)}, where \eqn{w_k}\code{= weigths[k]}, \eqn{\delta_{ij}^{(k)}}{delta(ij;k)} is 0 or 1, and \eqn{d_{ij}^{(k)}}{d(ij,k)}, the k-th variable contribution to the total distance, is a distance between \code{x[i,k]} and \code{x[j,k]}, see below. The 0-1 weight \eqn{\delta_{ij}^{(k)}}{delta(ij;k)} becomes zero when the variable \code{x[,k]} is missing in either or both rows (i and j), or when the variable is asymmetric binary and both values are zero. In all other situations it is 1. The contribution \eqn{d_{ij}^{(k)}}{d(ij,k)} of a nominal or binary variable to the total dissimilarity is 0 if both values are equal, 1 otherwise. The contribution of other variables is the absolute difference of both values, divided by the total range of that variable. Note that \dQuote{standard scoring} is applied to ordinal variables, i.e., they are replaced by their integer codes \code{1:K}. Note that this is not the same as using their ranks (since there typically are ties). % contrary to what Kaufman and Rousseeuw write in their book, and % the original help page. As the individual contributions \eqn{d_{ij}^{(k)}}{d(ij,k)} are in \eqn{[0,1]}, the dissimilarity \eqn{d_{ij}}{d_ij} will remain in this range. If all weights \eqn{w_k \delta_{ij}^{(k)}}{w_k delta(ij;k)} are zero, the dissimilarity is set to \code{\link{NA}}. } } \section{Background}{ Dissimilarities are used as inputs to cluster analysis and multidimensional scaling. The choice of metric may have a large impact. } \references{ Gower, J. C. (1971) A general coefficient of similarity and some of its properties, \emph{Biometrics} \bold{27}, 857--874. Kaufman, L. and Rousseeuw, P.J. (1990) \emph{Finding Groups in Data: An Introduction to Cluster Analysis}. Wiley, New York. Struyf, A., Hubert, M. and Rousseeuw, P.J. (1997) Integrating Robust Clustering Techniques in S-PLUS, \emph{Computational Statistics and Data Analysis} \bold{26}, 17--37. } \author{ Anja Struyf, Mia Hubert, and Peter and Rousseeuw, for the original version. \cr Martin Maechler improved the \code{\link{NA}} handling and \code{type} specification checking, and extended functionality to \code{metric = "gower"} and the optional \code{weights} argument. } \seealso{ \code{\link{dissimilarity.object}}, \code{\link{dist}}, \code{\link{pam}}, \code{\link{fanny}}, \code{\link{clara}}, \code{\link{agnes}}, \code{\link{diana}}. } \examples{% NB: >>> ../tests/daisy-ex.R <<<< data(agriculture) ## Example 1 in ref: ## Dissimilarities using Euclidean metric and without standardization d.agr <- daisy(agriculture, metric = "euclidean", stand = FALSE) d.agr as.matrix(d.agr)[,"DK"] # via as.matrix.dist(.) ## compare with as.matrix(daisy(agriculture, metric = "gower")) ## Example 2 in reference, extended --- different ways of "mixed" / "gower": example(flower) # -> data(flower) *and* provide 'flowerN' summary(d0 <- daisy(flower)) # -> the first 3 {0,1} treated as *N*ominal summary(dS123 <- daisy(flower, type = list(symm = 1:3))) # first 3 treated as *S*ymmetric stopifnot(dS123 == d0) # i.e., *S*ymmetric <==> *N*ominal {for 2-level factor} summary(dNS123<- daisy(flowerN, type = list(symm = 1:3))) stopifnot(dS123 == d0) ## by default, however ... summary(dA123 <- daisy(flowerN)) # .. all 3 logicals treated *A*symmetric binary (w/ warning) summary(dA3 <- daisy(flower, type = list(asymm = 3))) summary(dA13 <- daisy(flower, type = list(asymm = c(1, 3), ordratio = 7))) ## Mixing variable *names* and column numbers (failed in the past): summary(dfl3 <- daisy(flower, type = list(asymm = c("V1", "V3"), symm= 2, ordratio= 7, logratio= 8))) ## If we'd treat the first 3 as simple {0,1} Nflow <- flower Nflow[,1:3] <- lapply(flower[,1:3], function(f) as.integer(as.character(f))) summary(dN <- daisy(Nflow)) # w/ warning: treated binary .. 1:3 as interval ## Still, using Euclidean/Manhattan distance for {0-1} *is* identical to treating them as "N" : stopifnot(dN == d0) stopifnot(dN == daisy(Nflow, type = list(symm = 1:3))) # or as "S" } \keyword{cluster} cluster/man/votes.repub.Rd0000644000176200001440000000113407351402102015242 0ustar liggesusers\name{votes.repub} \alias{votes.repub} \title{Votes for Republican Candidate in Presidential Elections} \usage{data(votes.repub)} \description{ A data frame with the percents of votes given to the republican candidate in presidential elections from 1856 to 1976. Rows represent the 50 states, and columns the 31 elections. } \source{ S. Peterson (1973): \emph{A Statistical History of the American Presidential Elections}. New York: Frederick Ungar Publishing Co. Data from 1964 to 1976 is from R. M. Scammon, \emph{American Votes 12}, Congressional Quarterly. } \keyword{datasets} cluster/man/pam.object.Rd0000644000176200001440000000663412461440602015027 0ustar liggesusers\name{pam.object} \alias{pam.object} \title{Partitioning Around Medoids (PAM) Object} \description{ The objects of class \code{"pam"} represent a partitioning of a dataset into clusters. } \section{GENERATION}{ These objects are returned from \code{\link{pam}}.} \section{METHODS}{ The \code{"pam"} class has methods for the following generic functions: \code{print}, \code{summary}. } \section{INHERITANCE}{ The class \code{"pam"} inherits from \code{"partition"}. Therefore, the generic functions \code{plot} and \code{clusplot} can be used on a \code{pam} object. } \value{ A legitimate \code{pam} object is a \code{\link{list}} with the following components: \item{medoids}{ the medoids or representative objects of the clusters. If a dissimilarity matrix was given as input to \code{pam}, then a vector of numbers or labels of observations is given, else \code{medoids} is a \code{\link{matrix}} with in each row the coordinates of one medoid.} \item{id.med}{integer vector of \emph{indices} giving the medoid observation numbers.} \item{clustering}{the clustering vector, see \code{\link{partition.object}}.} \item{objective}{the objective function after the first and second step of the \code{pam} algorithm.} \item{isolation}{ vector with length equal to the number of clusters, specifying which clusters are isolated clusters (L- or L*-clusters) and which clusters are not isolated.\cr A cluster is an L*-cluster iff its diameter is smaller than its separation. A cluster is an L-cluster iff for each observation i the maximal dissimilarity between i and any other observation of the cluster is smaller than the minimal dissimilarity between i and any observation of another cluster. Clearly each L*-cluster is also an L-cluster. } \item{clusinfo}{ matrix, each row gives numerical information for one cluster. These are the cardinality of the cluster (number of observations), the maximal and average dissimilarity between the observations in the cluster and the cluster's medoid, %% FIXME: Now differs from clara.object.Rd: the diameter of the cluster (maximal dissimilarity between two observations of the cluster), and the separation of the cluster (minimal dissimilarity between an observation of the cluster and an observation of another cluster). } \item{silinfo}{list with silhouette width information, see \code{\link{partition.object}}.} \item{diss}{dissimilarity (maybe NULL), see \code{\link{partition.object}}.} \item{call}{generating call, see \code{\link{partition.object}}.} \item{data}{(possibibly standardized) see \code{\link{partition.object}}.} } \seealso{ \code{\link{pam}}, \code{\link{dissimilarity.object}}, \code{\link{partition.object}}, \code{\link{plot.partition}}. } \examples{ ## Use the silhouette widths for assessing the best number of clusters, ## following a one-dimensional example from Christian Hennig : ## x <- c(rnorm(50), rnorm(50,mean=5), rnorm(30,mean=15)) asw <- numeric(20) ## Note that "k=1" won't work! for (k in 2:20) asw[k] <- pam(x, k) $ silinfo $ avg.width k.best <- which.max(asw) cat("silhouette-optimal number of clusters:", k.best, "\n") plot(1:20, asw, type= "h", main = "pam() clustering assessment", xlab= "k (# clusters)", ylab = "average silhouette width") axis(1, k.best, paste("best",k.best,sep="\n"), col = "red", col.axis = "red") } \keyword{cluster} cluster/man/summary.diana.Rd0000644000176200001440000000077013467043363015562 0ustar liggesusers\name{summary.diana} \alias{summary.diana} \alias{print.summary.diana} \title{Summary Method for 'diana' Objects} \description{Returns (and prints) a summary list for a \code{diana} object.} \usage{ \method{summary}{diana}(object, \dots) \method{print}{summary.diana}(x, \dots) } \arguments{ \item{x, object}{a \code{\link{diana}} object.} \item{\dots}{potential further arguments (require by generic).} } \seealso{\code{\link{diana}}, \code{\link{diana.object}}.} \keyword{cluster} \keyword{print} cluster/man/diana.Rd0000644000176200001440000001647514764134021014070 0ustar liggesusers\name{diana} \title{DIvisive ANAlysis Clustering} \alias{diana} \alias{diana.object} \description{ Computes a divisive hierarchical clustering of the dataset returning an object of class \code{diana}. } \usage{ diana(x, diss = inherits(x, "dist"), metric = "euclidean", stand = FALSE, stop.at.k = FALSE, keep.diss = n < 100, keep.data = !diss, trace.lev = 0) } \arguments{ \item{x}{ data matrix or data frame, or dissimilarity matrix or object, depending on the value of the \code{diss} argument. In case of a matrix or data frame, each row corresponds to an observation, and each column corresponds to a variable. All variables must be numeric. Missing values (\code{\link{NA}}s) \emph{are} allowed. In case of a dissimilarity matrix, \code{x} is typically the output of \code{\link{daisy}} or \code{\link{dist}}. Also a vector of length n*(n-1)/2 is allowed (where n is the number of observations), and will be interpreted in the same way as the output of the above-mentioned functions. Missing values (NAs) are \emph{not} allowed. } \item{diss}{ logical flag: if TRUE (default for \code{dist} or \code{dissimilarity} objects), then \code{x} will be considered as a dissimilarity matrix. If FALSE, then \code{x} will be considered as a matrix of observations by variables. } \item{metric}{ character string specifying the metric to be used for calculating dissimilarities between observations.\cr The currently available options are "euclidean" and "manhattan". Euclidean distances are root sum-of-squares of differences, and manhattan distances are the sum of absolute differences. If \code{x} is already a dissimilarity matrix, then this argument will be ignored. } \item{stand}{logical; if true, the measurements in \code{x} are standardized before calculating the dissimilarities. Measurements are standardized for each variable (column), by subtracting the variable's mean value and dividing by the variable's mean absolute deviation. If \code{x} is already a dissimilarity matrix, then this argument will be ignored.} \item{stop.at.k}{logical or integer, \code{FALSE} by default. Otherwise must be integer, say \eqn{k}, in \eqn{\{1,2,..,n\}}, specifying that the \code{diana} algorithm should stop early. %_TODO_ namely after k splits _OR_ with k final clusters Non-default NOT YET IMPLEMENTED.} \item{keep.diss, keep.data}{logicals indicating if the dissimilarities and/or input data \code{x} should be kept in the result. Setting these to \code{FALSE} can give much smaller results and hence even save memory allocation \emph{time}.} \item{trace.lev}{integer specifying a trace level for printing diagnostics during the algorithm. Default \code{0} does not print anything; higher values print increasingly more.} } \value{ an object of class \code{"diana"} representing the clustering; this class has methods for the following generic functions: \code{print}, \code{summary}, \code{plot}. Further, the class \code{"diana"} inherits from \code{"twins"}. Therefore, the generic function \code{\link{pltree}} can be used on a \code{diana} object, and \code{\link{as.hclust}} and \code{\link{as.dendrogram}} methods are available. A legitimate \code{diana} object is a list with the following components: \item{order}{ a vector giving a permutation of the original observations to allow for plotting, in the sense that the branches of a clustering tree will not cross. } \item{order.lab}{ a vector similar to \code{order}, but containing observation labels instead of observation numbers. This component is only available if the original observations were labelled. } \item{height}{a vector with the diameters of the clusters prior to splitting. } \item{dc}{ the divisive coefficient, measuring the clustering structure of the dataset. For each observation i, denote by \eqn{d(i)} the diameter of the last cluster to which it belongs (before being split off as a single observation), divided by the diameter of the whole dataset. The \code{dc} is the average of all \eqn{1 - d(i)}. It can also be seen as the average width (or the percentage filled) of the banner plot. Because \code{dc} grows with the number of observations, this measure should not be used to compare datasets of very different sizes. } \item{merge}{ an (n-1) by 2 matrix, where n is the number of observations. Row i of \code{merge} describes the split at step n-i of the clustering. If a number \eqn{j} in row r is negative, then the single observation \eqn{|j|} is split off at stage n-r. If j is positive, then the cluster that will be splitted at stage n-j (described by row j), is split off at stage n-r. } \item{diss}{ an object of class \code{"dissimilarity"}, representing the total dissimilarity matrix of the dataset. } \item{data}{ a matrix containing the original or standardized measurements, depending on the \code{stand} option of the function \code{agnes}. If a dissimilarity matrix was given as input structure, then this component is not available. } } \details{ \code{diana} is fully described in chapter 6 of Kaufman and Rousseeuw (1990). It is probably unique in computing a divisive hierarchy, whereas most other software for hierarchical clustering is agglomerative. Moreover, \code{diana} provides (a) the divisive coefficient (see \code{diana.object}) which measures the amount of clustering structure found; and (b) the banner, a novel graphical display (see \code{plot.diana}). The \code{diana}-algorithm constructs a hierarchy of clusterings, starting with one large cluster containing all n observations. Clusters are divided until each cluster contains only a single observation.\cr At each stage, the cluster with the largest diameter is selected. (The diameter of a cluster is the largest dissimilarity between any two of its observations.)\cr To divide the selected cluster, the algorithm first looks for its most disparate observation (i.e., which has the largest average dissimilarity to the other observations of the selected cluster). This observation initiates the "splinter group". In subsequent steps, the algorithm reassigns observations that are closer to the "splinter group" than to the "old party". The result is a division of the selected cluster into two new clusters. } \seealso{ \code{\link{agnes}} also for background and references; \code{\link{cutree}} (and \code{\link{as.hclust}}) for grouping extraction; \code{\link{daisy}}, \code{\link{dist}}, \code{\link{plot.diana}}, \code{\link{twins.object}}. } \examples{ data(votes.repub) dv <- diana(votes.repub, metric = "manhattan", stand = TRUE) print(dv) plot(dv) #-> plot.diana() {w/ its own help + examples} ## Cut into 2 groups: dv2 <- cutree(as.hclust(dv), k = 2) table(dv2) # 8 and 42 group members rownames(votes.repub)[dv2 == 1] ## For two groups, does the metric matter ? dv0 <- diana(votes.repub, stand = TRUE) # default: Euclidean dv.2 <- cutree(as.hclust(dv0), k = 2) table(dv2 == dv.2)## identical group assignments str(as.dendrogram(dv0)) # {via as.dendrogram.twins() method} data(agriculture) ## Plot similar to Figure 8 in ref \dontrun{plot(diana(agriculture), ask = TRUE)} \dontshow{plot(diana(agriculture))} } \keyword{cluster} cluster/man/plot.mona.Rd0000644000176200001440000000406114277707561014725 0ustar liggesusers\name{plot.mona} \alias{plot.mona} \title{Banner of Monothetic Divisive Hierarchical Clusterings} \description{ Creates the banner of a \code{mona} object. } \usage{ \method{plot}{mona}(x, main = paste("Banner of ", deparse1(x$call)), sub = NULL, xlab = "Separation step", col = c(2,0), axes = TRUE, adj = 0, nmax.lab = 35, max.strlen = 5, \dots) } \arguments{ \item{x}{an object of class \code{"mona"}, typically created by \code{\link{mona}(.)}.} \item{main,sub}{main and sub titles for the plot, with convenient defaults. See documentation in \code{\link{plot.default}}.} \item{xlab}{x axis label, see \code{\link{title}}.} \item{col,adj}{graphical parameters passed to \code{\link{bannerplot}()}.} \item{axes}{logical, indicating if (labeled) axes should be drawn.} \item{nmax.lab}{integer indicating the number of labels which is considered too large for labeling.} \item{max.strlen}{positive integer giving the length to which strings are truncated in labeling.} \item{\dots}{further graphical arguments are passed to \code{\link{bannerplot}()} and \code{\link{text}}.} } \section{Side Effects}{ A banner is plotted on the current graphics device. } \details{ Plots the separation step at which clusters are splitted. The observations are given in the order found by the \code{mona} algorithm, the numbers in the \code{step} vector are represented as bars between the observations. When a long bar is drawn between two observations, those observations have the same value for each variable. See chapter 7 of Kaufman and Rousseeuw (1990). } \note{ In the banner plot, observation labels are only printed when the number of observations is limited less than \code{nmax.lab} (35, by default), for readability. Moreover, observation labels are truncated to maximally \code{max.strlen} (5) characters. } \references{see those in \code{\link{plot.agnes}}.} \seealso{ \code{\link{mona}}, \code{\link{mona.object}}, \code{\link{par}}. } \keyword{cluster} \keyword{hplot} % Converted by Sd2Rd version 0.3-2. cluster/man/pluton.Rd0000644000176200001440000000331612456276724014340 0ustar liggesusers\name{pluton} \alias{pluton} \title{Isotopic Composition Plutonium Batches} \usage{data(pluton)} \description{ The \code{pluton} data frame has 45 rows and 4 columns, containing percentages of isotopic composition of 45 Plutonium batches. } \format{ This data frame contains the following columns: \describe{ \item{Pu238}{the percentages of \eqn{\ ^{238}Pu}{(238)Pu}, always less than 2 percent.} \item{Pu239}{the percentages of \eqn{\ ^{239}Pu}{(239)Pu}, typically between 60 and 80 percent (from neutron capture of Uranium, \eqn{\ ^{238}U}{(238)U}).} \item{Pu240}{percentage of the plutonium 240 isotope.} \item{Pu241}{percentage of the plutonium 241 isotope.} } } \details{ Note that the percentage of plutonium~242 can be computed from the other four percentages, see the examples. In the reference below it is explained why it is very desirable to combine these plutonium patches in three groups of similar size. } \source{ Available as \file{pluton.dat} from the archive of the University of Antwerpen, %% originally at %% \url{http://win-www.uia.ac.be/u/statis/datasets/clusplot-examples.tar.gz}, %% no longer: Jan.2015: %% currently \url{http://www.agoras.ua.ac.be/datasets/clusplot-examples.tar.gz}. \file{..../datasets/clusplot-examples.tar.gz}, no longer available. } \references{ Rousseeuw, P.J. and Kaufman, L and Trauwaert, E. (1996) Fuzzy clustering using scatter matrices, \emph{Computational Statistics and Data Analysis} \bold{23}(1), 135--151. } \examples{ data(pluton) hist(apply(pluton,1,sum), col = "gray") # between 94\% and 100\% pu5 <- pluton pu5$Pu242 <- 100 - apply(pluton,1,sum) # the remaining isotope. pairs(pu5) } \keyword{datasets} cluster/man/summary.pam.Rd0000644000176200001440000000104710370161217015246 0ustar liggesusers\name{summary.pam} \alias{summary.pam} \alias{print.summary.pam} \title{Summary Method for PAM Objects} \description{Summarize a \code{\link{pam}} object and return an object of class \code{summary.pam}. There's a \code{\link{print}} method for the latter. } \usage{ \method{summary}{pam}(object, \dots) \method{print}{summary.pam}(x, \dots) } \arguments{ \item{x, object}{a \code{\link{pam}} object.} \item{\dots}{potential further arguments (require by generic).} } \seealso{\code{\link{pam}}, \code{\link{pam.object}}. } \keyword{cluster} cluster/man/animals.Rd0000644000176200001440000000204213467043363014430 0ustar liggesusers\name{animals} \alias{animals} \title{Attributes of Animals} \usage{data(animals)} \description{ This data set considers 6 binary attributes for 20 animals. } \format{ A data frame with 20 observations on 6 variables: \tabular{rll}{ [ , 1] \tab war \tab warm-blooded \cr [ , 2] \tab fly \tab can fly \cr [ , 3] \tab ver \tab vertebrate \cr [ , 4] \tab end \tab endangered \cr [ , 5] \tab gro \tab live in groups \cr [ , 6] \tab hai \tab have hair \cr } All variables are encoded as 1 = 'no', 2 = 'yes'. } \source{ Leonard Kaufman and Peter J. Rousseeuw (1990): \emph{Finding Groups in Data} (pp 297ff). New York: Wiley. } \details{ This dataset is useful for illustrating monothetic (only a single variable is used for each split) hierarchical clustering. } \references{ see Struyf, Hubert & Rousseeuw (1996), in \code{\link{agnes}}. } \examples{ data(animals) apply(animals,2, table) # simple overview ma <- mona(animals) ma ## Plot similar to Figure 10 in Struyf et al (1996) plot(ma) } \keyword{datasets} cluster/man/ellipsoidhull.Rd0000644000176200001440000001156114764134022015655 0ustar liggesusers\name{ellipsoidhull} \alias{ellipsoidhull} \alias{print.ellipsoid} \title{Compute the Ellipsoid Hull or Spanning Ellipsoid of a Point Set} \description{ Compute the \dQuote{ellipsoid hull} or \dQuote{spanning ellipsoid}, i.e. the ellipsoid of minimal volume (\sQuote{area} in 2D) such that all given points lie just inside or on the boundary of the ellipsoid. } \usage{ ellipsoidhull(x, tol=0.01, maxit=5000, ret.wt = FALSE, ret.sqdist = FALSE, ret.pr = FALSE) \method{print}{ellipsoid}(x, digits = max(1, getOption("digits") - 2), \dots) } \arguments{ \item{x}{the \eqn{n} \eqn{p}-dimensional points asnumeric \eqn{n\times p}{n x p} matrix.} \item{tol}{convergence tolerance for Titterington's algorithm. Setting this to much smaller values may drastically increase the number of iterations needed, and you may want to increas \code{maxit} as well.} \item{maxit}{integer giving the maximal number of iteration steps for the algorithm.} \item{ret.wt, ret.sqdist, ret.pr}{logicals indicating if additional information should be returned, \code{ret.wt} specifying the \emph{weights}, \code{ret.sqdist} the \emph{\bold{sq}uared \bold{dist}ances} and \code{ret.pr} the final \bold{pr}obabilities in the algorithms.} \item{digits,\dots}{the usual arguments to \code{\link{print}} methods.} } \details{ The \dQuote{spanning ellipsoid} algorithm is said to stem from Titterington(1976), in Pison et al (1999) who use it for \code{\link{clusplot.default}}.\cr The problem can be seen as a special case of the \dQuote{Min.Vol.} ellipsoid of which a more more flexible and general implementation is \code{\link[MASS]{cov.mve}} in the \code{MASS} package. } \value{ an object of class \code{"ellipsoid"}, basically a \code{\link{list}} with several components, comprising at least \item{cov}{\eqn{p\times p}{p x p} \emph{covariance} matrix description the ellipsoid.} \item{loc}{\eqn{p}-dimensional location of the ellipsoid center.} \item{d2}{average squared radius. Further, \eqn{d2 = t^2}, where \eqn{t} is \dQuote{the value of a t-statistic on the ellipse boundary} (from \code{\link[ellipse]{ellipse}} in the \CRANpkg{ellipse} package), and hence, more usefully, \code{d2 = qchisq(alpha, df = p)}, where \code{alpha} is the confidence level for p-variate normally distributed data with location and covariance \code{loc} and \code{cov} to lie inside the ellipsoid.} \item{wt}{the vector of weights iff \code{ret.wt} was true.} \item{sqdist}{the vector of squared distances iff \code{ret.sqdist} was true.} \item{prob}{the vector of algorithm probabilities iff \code{ret.pr} was true.} \item{it}{number of iterations used.} \item{tol, maxit}{just the input argument, see above.} \item{eps}{the achieved tolerance which is the maximal squared radius minus \eqn{p}.} \item{ierr}{error code as from the algorithm; \code{0} means \emph{ok}.} \item{conv}{logical indicating if the converged. This is defined as \code{it < maxit && ierr == 0}.} } \references{ Pison, G., Struyf, A. and Rousseeuw, P.J. (1999) Displaying a Clustering with CLUSPLOT, \emph{Computational Statistics and Data Analysis}, \bold{30}, 381--392.\cr %% Jan.2015 : no longer there: %% A version of this is available as technical report from %% \url{http://www.agoras.ua.ac.be/abstract/Disclu99.htm} D.M. Titterington (1976) Algorithms for computing D-optimal design on finite design spaces. In \emph{Proc.\ of the 1976 Conf.\ on Information Science and Systems}, 213--216; John Hopkins University. } \author{Martin Maechler did the present class implementation; Rousseeuw et al did the underlying original code.} \seealso{\code{\link{predict.ellipsoid}} which is also the \code{\link{predict}} method for \code{ellipsoid} objects. \code{\link{volume.ellipsoid}} for an example of \sQuote{manual} \code{ellipsoid} object construction;\cr further \code{\link[ellipse]{ellipse}} from package \CRANpkg{ellipse} and \code{\link[sfsmisc]{ellipsePoints}} from package \CRANpkg{sfsmisc}. \code{\link[grDevices]{chull}} for the convex hull, \code{\link{clusplot}} which makes use of this; \code{\link[MASS]{cov.mve}}. } \examples{ x <- rnorm(100) xy <- unname(cbind(x, rnorm(100) + 2*x + 10)) exy. <- ellipsoidhull(xy) exy. # >> calling print.ellipsoid() plot(xy, main = "ellipsoidhull() -- 'spanning points'") lines(predict(exy.), col="blue") points(rbind(exy.$loc), col = "red", cex = 3, pch = 13) exy <- ellipsoidhull(xy, tol = 1e-7, ret.wt = TRUE, ret.sqdist = TRUE) str(exy) # had small 'tol', hence many iterations (ii <- which(zapsmall(exy $ wt) > 1e-6)) ## --> only about 4 to 6 "spanning ellipsoid" points round(exy$wt[ii],3); sum(exy$wt[ii]) # weights summing to 1 points(xy[ii,], pch = 21, cex = 2, col="blue", bg = adjustcolor("blue",0.25)) } \keyword{dplot} \keyword{hplot}% << ? chull has "hplot" as well. cluster/man/partition.object.Rd0000644000176200001440000000544413467043363016273 0ustar liggesusers\name{partition.object} \alias{partition}% == class \alias{partition.object} \title{Partitioning Object} \description{ The objects of class \code{"partition"} represent a partitioning of a dataset into clusters. } \section{GENERATION}{ These objects are returned from \code{pam}, \code{clara} or \code{fanny}. } \section{METHODS}{ The \code{"partition"} class has a method for the following generic functions: \code{plot}, \code{clusplot}. } \section{INHERITANCE}{ The following classes inherit from class \code{"partition"} : \code{"pam"}, \code{"clara"} and \code{"fanny"}. See \code{\link{pam.object}}, \code{\link{clara.object}} and \code{\link{fanny.object}} for details. } \value{a \code{"partition"} object is a list with the following (and typically more) components: \item{clustering}{ the clustering vector. An integer vector of length \eqn{n}, the number of observations, giving for each observation the number ('id') of the cluster to which it belongs.} \item{call}{the matched \code{\link{call}} generating the object.} \item{silinfo}{ a list with all \emph{silhouette} information, only available when the number of clusters is non-trivial, i.e., \eqn{1 < k < n} and then has the following components, see \code{\link{silhouette}} \describe{ \item{widths}{an (n x 3) matrix, as returned by \code{\link{silhouette}()}, with for each observation i the cluster to which i belongs, as well as the neighbor cluster of i (the cluster, not containing i, for which the average dissimilarity between its observations and i is minimal), and the silhouette width \eqn{s(i)} of the observation. } \item{clus.avg.widths}{the average silhouette width per cluster.} \item{avg.width}{the average silhouette width for the dataset, i.e., simply the average of \eqn{s(i)} over all observations \eqn{i}.} }% describe This information is also needed to construct a \emph{silhouette plot} of the clustering, see \code{\link{plot.partition}}. Note that \code{avg.width} can be maximized over different clusterings (e.g. with varying number of clusters) to choose an \emph{optimal} clustering.%% see an example or a demo << FIXME >> } \item{objective}{value of criterion maximized during the partitioning algorithm, may more than one entry for different stages.} \item{diss}{ an object of class \code{"dissimilarity"}, representing the total dissimilarity matrix of the dataset (or relevant subset, e.g. for \code{clara}). } \item{data}{ a matrix containing the original or standardized data. This might be missing to save memory or when a dissimilarity matrix was given as input structure to the clustering method. } } \seealso{\code{\link{pam}}, \code{\link{clara}}, \code{\link{fanny}}. } \keyword{cluster} cluster/man/bannerplot.Rd0000644000176200001440000000575210367701315015155 0ustar liggesusers\name{bannerplot} \alias{bannerplot} \title{Plot Banner (of Hierarchical Clustering)} \description{ Draws a \dQuote{banner}, i.e. basically a horizontal \code{\link{barplot}} visualizing the (agglomerative or divisive) hierarchical clustering or an other binary dendrogram structure. } \usage{ bannerplot(x, w = rev(x$height), fromLeft = TRUE, main=NULL, sub=NULL, xlab = "Height", adj = 0, col = c(2, 0), border = 0, axes = TRUE, frame.plot = axes, rev.xax = !fromLeft, xax.pretty = TRUE, labels = NULL, nmax.lab = 35, max.strlen = 5, yax.do = axes && length(x$order) <= nmax.lab, yaxRight = fromLeft, y.mar = 2.4 + max.strlen/2.5, \dots) } \arguments{ \item{x}{a list with components \code{order}, \code{order.lab} and \code{height} when \code{w}, the next argument is not specified.} \item{w}{non-negative numeric vector of bar widths.} \item{fromLeft}{logical, indicating if the banner is from the left or not.} \item{main,sub}{main and sub titles, see \code{\link{title}}.} \item{xlab}{x axis label (with \sQuote{correct} default e.g. for \code{plot.agnes}).} \item{adj}{passed to \code{\link{title}(main,sub)} for string adjustment.} \item{col}{vector of length 2, for two horizontal segments.} \item{border}{color for bar border; now defaults to background (no border).} \item{axes}{logical indicating if axes (and labels) should be drawn at all.} \item{frame.plot}{logical indicating the banner should be framed; mainly used when \code{border = 0} (as per default).} \item{rev.xax}{logical indicating if the x axis should be reversed (as in \code{plot.diana}).} \item{xax.pretty}{logical or integer indicating if \code{\link{pretty}()} should be used for the x axis. \code{xax.pretty = FALSE} is mainly for back compatibility.} \item{labels}{labels to use on y-axis; the default is constructed from \code{x}.} \item{nmax.lab}{integer indicating the number of labels which is considered too large for single-name labelling the banner plot.} \item{max.strlen}{positive integer giving the length to which strings are truncated in banner plot labeling.} \item{yax.do}{logical indicating if a y axis and banner labels should be drawn.} \item{yaxRight}{logical indicating if the y axis is on the right or left.} \item{y.mar}{positive number specifying the margin width to use when banners are labeled (along a y-axis). The default adapts to the string width and optimally would also dependend on the font.} \item{\dots}{graphical parameters (see \code{\link{par}}) may also be supplied as arguments to this function.} } \author{Martin Maechler (from original code of Kaufman and Rousseeuw).} \note{This is mainly a utility called from \code{\link{plot.agnes}}, \code{\link{plot.diana}} and \code{\link{plot.mona}}. }% also serves as \seealso{*} \examples{ data(agriculture) bannerplot(agnes(agriculture), main = "Bannerplot") } \keyword{hplot} \keyword{cluster} \keyword{utilities} cluster/man/print.diana.Rd0000644000176200001440000000116507351402102015201 0ustar liggesusers\name{print.diana} \alias{print.diana} \title{Print Method for DIANA Objects} \description{ Prints the ordering of objects, diameters of splitted clusters, and divisive coefficient of a \code{diana} object. This is a method for the function \code{\link{print}()} for objects inheriting from class \code{\link{diana}}. } \usage{ \method{print}{diana}(x, \dots) } \arguments{ \item{x}{a diana object.} \item{\dots}{potential further arguments (require by generic).} } \seealso{ \code{\link{diana}}, \code{\link{diana.object}}, \code{\link{print}}, \code{\link{print.default}}. } \keyword{cluster} \keyword{print} cluster/man/print.fanny.Rd0000644000176200001440000000165010247645540015254 0ustar liggesusers\name{print.fanny} \alias{print.fanny} \alias{summary.fanny} \alias{print.summary.fanny} \title{Print and Summary Methods for FANNY Objects} \description{ Prints the objective function, membership coefficients and clustering vector of \code{fanny} object. This is a method for the function \code{\link{print}()} for objects inheriting from class \code{\link{fanny}}. } \usage{ \method{print}{fanny}(x, digits = getOption("digits"), \dots) \method{summary}{fanny}(object, \dots) \method{print}{summary.fanny}(x, digits = getOption("digits"), \dots) } \arguments{ \item{x, object}{a \code{\link{fanny}} object.} \item{digits}{number of significant digits for printing, see \code{\link{print.default}}.} \item{\dots}{potential further arguments (required by generic).} } \seealso{ \code{\link{fanny}}, \code{\link{fanny.object}}, \code{\link{print}}, \code{\link{print.default}}. } \keyword{cluster} \keyword{print} cluster/man/agnes.Rd0000644000176200001440000002763214764134021014106 0ustar liggesusers\name{agnes} \alias{agnes} \title{Agglomerative Nesting (Hierarchical Clustering)} \concept{UPGMA clustering} \description{ Computes agglomerative hierarchical clustering of the dataset. } \usage{ agnes(x, diss = inherits(x, "dist"), metric = "euclidean", stand = FALSE, method = "average", par.method, keep.diss = n < 100, keep.data = !diss, trace.lev = 0) } \arguments{ \item{x}{ data matrix or data frame, or dissimilarity matrix, depending on the value of the \code{diss} argument. In case of a matrix or data frame, each row corresponds to an observation, and each column corresponds to a variable. All variables must be numeric. Missing values (NAs) are allowed. In case of a dissimilarity matrix, \code{x} is typically the output of \code{\link{daisy}} or \code{\link{dist}}. Also a vector with length n*(n-1)/2 is allowed (where n is the number of observations), and will be interpreted in the same way as the output of the above-mentioned functions. Missing values (NAs) are not allowed. } \item{diss}{ logical flag: if TRUE (default for \code{dist} or \code{dissimilarity} objects), then \code{x} is assumed to be a dissimilarity matrix. If FALSE, then \code{x} is treated as a matrix of observations by variables. } \item{metric}{ character string specifying the metric to be used for calculating dissimilarities between observations. The currently available options are \code{"euclidean"} and \code{"manhattan"}. Euclidean distances are root sum-of-squares of differences, and manhattan distances are the sum of absolute differences. If \code{x} is already a dissimilarity matrix, then this argument will be ignored. } \item{stand}{ logical flag: if TRUE, then the measurements in \code{x} are standardized before calculating the dissimilarities. Measurements are standardized for each variable (column), by subtracting the variable's mean value and dividing by the variable's mean absolute deviation. If \code{x} is already a dissimilarity matrix, then this argument will be ignored. } \item{method}{ character string defining the clustering method. The six methods implemented are \code{"average"} ([unweighted pair-]group [arithMetic] average method, aka \sQuote{UPGMA}), \code{"single"} (single linkage), \code{"complete"} (complete linkage), \code{"ward"} (Ward's method), \code{"weighted"} (weighted average linkage, aka \sQuote{WPGMA}), its generalization \code{"flexible"} which uses (a constant version of) the Lance-Williams formula and the \code{par.method} argument, and \code{"gaverage"} a generalized \code{"average"} aka \dQuote{flexible UPGMA} method also using the Lance-Williams formula and \code{par.method}. The default is \code{"average"}. } \item{par.method}{ If \code{method} is \code{"flexible"} or \code{"gaverage"}, a numeric vector of length 1, 3, or 4, (with a default for \code{"gaverage"}), see in the details section. } \item{keep.diss, keep.data}{logicals indicating if the dissimilarities and/or input data \code{x} should be kept in the result. Setting these to \code{FALSE} can give much smaller results and hence even save memory allocation \emph{time}.} \item{trace.lev}{integer specifying a trace level for printing diagnostics during the algorithm. Default \code{0} does not print anything; higher values print increasingly more.} } \value{ an object of class \code{"agnes"} (which extends \code{"twins"}) representing the clustering. See \code{\link{agnes.object}} for details, and methods applicable. } \author{ Method \code{"gaverage"} has been contributed by Pierre Roudier, Landcare Research, New Zealand. } \details{ \code{agnes} is fully described in chapter 5 of Kaufman and Rousseeuw (1990). Compared to other agglomerative clustering methods such as \code{hclust}, \code{agnes} has the following features: (a) it yields the agglomerative coefficient (see \code{\link{agnes.object}}) which measures the amount of clustering structure found; and (b) apart from the usual tree it also provides the banner, a novel graphical display (see \code{\link{plot.agnes}}). The \code{agnes}-algorithm constructs a hierarchy of clusterings.\cr At first, each observation is a small cluster by itself. Clusters are merged until only one large cluster remains which contains all the observations. At each stage the two \emph{nearest} clusters are combined to form one larger cluster. For \code{method="average"}, the distance between two clusters is the average of the dissimilarities between the points in one cluster and the points in the other cluster. \cr In \code{method="single"}, we use the smallest dissimilarity between a point in the first cluster and a point in the second cluster (nearest neighbor method). \cr When \code{method="complete"}, we use the largest dissimilarity between a point in the first cluster and a point in the second cluster (furthest neighbor method). The \code{method = "flexible"} allows (and requires) more details: The Lance-Williams formula specifies how dissimilarities are computed when clusters are agglomerated (equation (32) in K&R(1990), p.237). If clusters \eqn{C_1} and \eqn{C_2} are agglomerated into a new cluster, the dissimilarity between their union and another cluster \eqn{Q} is given by \deqn{ D(C_1 \cup C_2, Q) = \alpha_1 * D(C_1, Q) + \alpha_2 * D(C_2, Q) + \beta * D(C_1,C_2) + \gamma * |D(C_1, Q) - D(C_2, Q)|, } where the four coefficients \eqn{(\alpha_1, \alpha_2, \beta, \gamma)} are specified by the vector \code{par.method}, either directly as vector of length 4, or (more conveniently) if \code{par.method} is of length 1, say \eqn{= \alpha}, \code{par.method} is extended to give the \dQuote{Flexible Strategy} (K&R(1990), p.236 f) with Lance-Williams coefficients \eqn{(\alpha_1 = \alpha_2 = \alpha, \beta = 1 - 2\alpha, \gamma=0)}.\cr Also, if \code{length(par.method) == 3}, \eqn{\gamma = 0} is set. \bold{Care} and expertise is probably needed when using \code{method = "flexible"} particularly for the case when \code{par.method} is specified of longer length than one. Since \pkg{cluster} version 2.0, choices leading to invalid \code{merge} structures now signal an error (from the C code already). The \emph{weighted average} (\code{method="weighted"}) is the same as \code{method="flexible", par.method = 0.5}. Further, \code{method= "single"} is equivalent to \code{method="flexible", par.method = c(.5,.5,0,-.5)}, and \code{method="complete"} is equivalent to \code{method="flexible", par.method = c(.5,.5,0,+.5)}. The \code{method = "gaverage"} is a generalization of \code{"average"}, aka \dQuote{flexible UPGMA} method, and is (a generalization of the approach) detailed in Belbin et al. (1992). As \code{"flexible"}, it uses the Lance-Williams formula above for dissimilarity updating, but with \eqn{\alpha_1} and \eqn{\alpha_2} not constant, but \emph{proportional} to the \emph{sizes} \eqn{n_1} and \eqn{n_2} of the clusters \eqn{C_1} and \eqn{C_2} respectively, i.e, \deqn{\alpha_j = \alpha'_j \frac{n_1}{n_1+n_2},}{% \alpha_j = \alpha'_j * n_1/(n_1 + n_2),} where \eqn{\alpha'_1}, \eqn{\alpha'_2} are determined from \code{par.method}, either directly as \eqn{(\alpha_1, \alpha_2, \beta, \gamma)} or \eqn{(\alpha_1, \alpha_2, \beta)} with \eqn{\gamma = 0}, or (less flexibly, but more conveniently) as follows: Belbin et al proposed \dQuote{flexible beta}, i.e. the user would only specify \eqn{\beta} (as \code{par.method}), sensibly in \deqn{-1 \leq \beta < 1,}{-1 \le \beta < 1,} and \eqn{\beta} determines \eqn{\alpha'_1} and \eqn{\alpha'_2} as \deqn{\alpha'_j = 1 - \beta,} and \eqn{\gamma = 0}. This \eqn{\beta} may be specified by \code{par.method} (as length 1 vector), and if \code{par.method} is not specified, a default value of -0.1 is used, as Belbin et al recommend taking a \eqn{\beta} value around -0.1 as a general agglomerative hierarchical clustering strategy. Note that \code{method = "gaverage", par.method = 0} (or \code{par.method = c(1,1,0,0)}) is equivalent to the \code{agnes()} default method \code{"average"}. } \section{BACKGROUND}{ Cluster analysis divides a dataset into groups (clusters) of observations that are similar to each other. \describe{ \item{Hierarchical methods}{like \code{agnes}, \code{\link{diana}}, and \code{\link{mona}} construct a hierarchy of clusterings, with the number of clusters ranging from one to the number of observations.} \item{Partitioning methods}{like \code{\link{pam}}, \code{\link{clara}}, and \code{\link{fanny}} require that the number of clusters be given by the user.} } } \references{ Kaufman, L. and Rousseeuw, P.J. (1990). (=: \dQuote{K&R(1990)}) \emph{Finding Groups in Data: An Introduction to Cluster Analysis}. Wiley, New York. Anja Struyf, Mia Hubert and Peter J. Rousseeuw (1996) Clustering in an Object-Oriented Environment. \emph{Journal of Statistical Software} \bold{1}. \doi{10.18637/jss.v001.i04} Struyf, A., Hubert, M. and Rousseeuw, P.J. (1997). Integrating Robust Clustering Techniques in S-PLUS, \emph{Computational Statistics and Data Analysis}, \bold{26}, 17--37. Lance, G.N., and W.T. Williams (1966). A General Theory of Classifactory Sorting Strategies, I. Hierarchical Systems. \emph{Computer J.} \bold{9}, 373--380. Belbin, L., Faith, D.P. and Milligan, G.W. (1992). A Comparison of Two Approaches to Beta-Flexible Clustering. \emph{Multivariate Behavioral Research}, \bold{27}, 417--433. } \seealso{ \code{\link{agnes.object}}, \code{\link{daisy}}, \code{\link{diana}}, \code{\link{dist}}, \code{\link{hclust}}, \code{\link{plot.agnes}}, \code{\link{twins.object}}. } \examples{ data(votes.repub) agn1 <- agnes(votes.repub, metric = "manhattan", stand = TRUE) agn1 plot(agn1) op <- par(mfrow=c(2,2)) agn2 <- agnes(daisy(votes.repub), diss = TRUE, method = "complete") plot(agn2) ## alpha = 0.625 ==> beta = -1/4 is "recommended" by some agnS <- agnes(votes.repub, method = "flexible", par.method = 0.625) plot(agnS) par(op) ## "show" equivalence of three "flexible" special cases d.vr <- daisy(votes.repub) a.wgt <- agnes(d.vr, method = "weighted") a.sing <- agnes(d.vr, method = "single") a.comp <- agnes(d.vr, method = "complete") iC <- -(6:7) # not using 'call' and 'method' for comparisons stopifnot( all.equal(a.wgt [iC], agnes(d.vr, method="flexible", par.method = 0.5)[iC]) , all.equal(a.sing[iC], agnes(d.vr, method="flex", par.method= c(.5,.5,0, -.5))[iC]), all.equal(a.comp[iC], agnes(d.vr, method="flex", par.method= c(.5,.5,0, +.5))[iC])) ## Exploring the dendrogram structure (d2 <- as.dendrogram(agn2)) # two main branches d2[[1]] # the first branch d2[[2]] # the 2nd one { 8 + 42 = 50 } d2[[1]][[1]]# first sub-branch of branch 1 .. and shorter form identical(d2[[c(1,1)]], d2[[1]][[1]]) ## a "textual picture" of the dendrogram : str(d2) data(agriculture) ## Plot similar to Figure 7 in ref \dontrun{plot(agnes(agriculture), ask = TRUE)} \dontshow{plot(agnes(agriculture))} data(animals) aa.a <- agnes(animals) # default method = "average" aa.ga <- agnes(animals, method = "gaverage") op <- par(mfcol=1:2, mgp=c(1.5, 0.6, 0), mar=c(.1+ c(4,3,2,1)), cex.main=0.8) plot(aa.a, which.plots = 2) plot(aa.ga, which.plots = 2) par(op) \dontshow{## equivalence stopifnot( ## below show ave == gave(0); here ave == gave(c(1,1,0,0)): all.equal(aa.a [iC], agnes(animals, method="gave", par.method= c(1,1,0,0))[iC]), all.equal(aa.ga[iC], agnes(animals, method="gave", par.method= -0.1 )[iC]), all.equal(aa.ga[iC], agnes(animals, method="gav", par.method=c(1.1,1.1,-0.1,0))[iC])) } ## Show how "gaverage" is a "generalized average": aa.ga.0 <- agnes(animals, method = "gaverage", par.method = 0) stopifnot(all.equal(aa.ga.0[iC], aa.a[iC])) } \keyword{cluster} cluster/man/plot.partition.Rd0000644000176200001440000001110511674154360015770 0ustar liggesusers\name{plot.partition} \alias{plot.partition} \title{Plot of a Partition of the Data Set} \description{Creates plots for visualizing a \code{partition} object.} \usage{ \method{plot}{partition}(x, ask = FALSE, which.plots = NULL, nmax.lab = 40, max.strlen = 5, data = x$data, dist = NULL, stand = FALSE, lines = 2, shade = FALSE, color = FALSE, labels = 0, plotchar = TRUE, span = TRUE, xlim = NULL, ylim = NULL, main = NULL, \dots) } \arguments{ \item{x}{an object of class \code{"partition"}, typically created by the functions \code{\link{pam}}, \code{\link{clara}}, or \code{\link{fanny}}.} \item{ask}{logical; if true and \code{which.plots} is \code{NULL}, \code{plot.partition} operates in interactive mode, via \code{\link{menu}}.} \item{which.plots}{integer vector or NULL (default), the latter producing both plots. Otherwise, \code{which.plots} must contain integers of \code{1} for a \emph{clusplot} or \code{2} for \emph{silhouette}.} \item{nmax.lab}{integer indicating the number of labels which is considered too large for single-name labeling the silhouette plot.} \item{max.strlen}{positive integer giving the length to which strings are truncated in silhouette plot labeling.} \item{data}{numeric matrix with the scaled data; per default taken from the partition object \code{x}, but can be specified explicitly.} \item{dist}{when \code{x} does not have a \code{diss} component as for \code{\link{pam}(*, keep.diss=FALSE)}, \code{dist} must be the dissimilarity if a clusplot is desired.} \item{stand,lines,shade,color,labels,plotchar,span,xlim,ylim,main, \dots}{ All optional arguments available for the \code{\link{clusplot.default}} function (except for the \code{diss} one) and graphical parameters (see \code{\link{par}}) may also be supplied as arguments to this function.} } \section{Side Effects}{ An appropriate plot is produced on the current graphics device. This can be one or both of the following choices: \cr Clusplot \cr Silhouette plot } \details{ When \code{ask= TRUE}, rather than producing each plot sequentially, \code{plot.partition} displays a menu listing all the plots that can be produced. If the menu is not desired but a pause between plots is still wanted, call \code{par(ask= TRUE)} before invoking the plot command. The \emph{clusplot} of a cluster partition consists of a two-dimensional representation of the observations, in which the clusters are indicated by ellipses (see \code{\link{clusplot.partition}} for more details). The \emph{silhouette plot} of a nonhierarchical clustering is fully described in Rousseeuw (1987) and in chapter 2 of Kaufman and Rousseeuw (1990). For each observation i, a bar is drawn, representing its silhouette width s(i), see \code{\link{silhouette}} for details. Observations are grouped per cluster, starting with cluster 1 at the top. Observations with a large s(i) (almost 1) are very well clustered, a small s(i) (around 0) means that the observation lies between two clusters, and observations with a negative s(i) are probably placed in the wrong cluster. A clustering can be performed for several values of \code{k} (the number of clusters). Finally, choose the value of \code{k} with the largest overall average silhouette width. } \note{ In the silhouette plot, observation labels are only printed when the number of observations is less than \code{nmax.lab} (40, by default), for readability. Moreover, observation labels are truncated to maximally \code{max.strlen} (5) characters. \cr For more flexibility, use \code{plot(silhouette(x), ...)}, see \code{\link{plot.silhouette}}. } \references{ Rousseeuw, P.J. (1987) Silhouettes: A graphical aid to the interpretation and validation of cluster analysis. \emph{J. Comput. Appl. Math.}, \bold{20}, 53--65. Further, the references in \code{\link{plot.agnes}}. } \seealso{ \code{\link{partition.object}}, \code{\link{clusplot.partition}}, \code{\link{clusplot.default}}, \code{\link{pam}}, \code{\link{pam.object}}, \code{\link{clara}}, \code{\link{clara.object}}, \code{\link{fanny}}, \code{\link{fanny.object}}, \code{\link{par}}. } \examples{ ## generate 25 objects, divided into 2 clusters. x <- rbind(cbind(rnorm(10,0,0.5), rnorm(10,0,0.5)), cbind(rnorm(15,5,0.5), rnorm(15,5,0.5))) plot(pam(x, 2)) ## Save space not keeping data in clus.object, and still clusplot() it: data(xclara) cx <- clara(xclara, 3, keep.data = FALSE) cx$data # is NULL plot(cx, data = xclara) } \keyword{cluster} \keyword{hplot} % Converted by Sd2Rd version 0.3-2. cluster/man/pam.Rd0000644000176200001440000002740614614222637013572 0ustar liggesusers\name{pam} \alias{pam} \title{Partitioning Around Medoids} \description{ Partitioning (clustering) of the data into \code{k} clusters \dQuote{around medoids}, a more robust version of K-means. } \usage{ pam(x, k, diss = inherits(x, "dist"), metric = c("euclidean", "manhattan"), %% FIXME: add "jaccard" medoids = if(is.numeric(nstart)) "random", nstart = if(variant == "faster") 1 else NA, stand = FALSE, cluster.only = FALSE, do.swap = TRUE, keep.diss = !diss && !cluster.only && n < 100, keep.data = !diss && !cluster.only, variant = c("original", "o_1", "o_2", "f_3", "f_4", "f_5", "faster"), pamonce = FALSE, trace.lev = 0) } \arguments{ \item{x}{ data matrix or data frame, or dissimilarity matrix or object, depending on the value of the \code{diss} argument. In case of a matrix or data frame, each row corresponds to an observation, and each column corresponds to a variable. All variables must be numeric (or logical). Missing values (\code{\link{NA}}s) \emph{are} allowed---as long as every pair of observations has at least one case not missing. In case of a dissimilarity matrix, \code{x} is typically the output of \code{\link{daisy}} or \code{\link{dist}}. Also a vector of length n*(n-1)/2 is allowed (where n is the number of observations), and will be interpreted in the same way as the output of the above-mentioned functions. Missing values (\code{\link{NA}}s) are \emph{not} allowed. } \item{k}{positive integer specifying the number of clusters, less than the number of observations.} \item{diss}{ logical flag: if TRUE (default for \code{dist} or \code{dissimilarity} objects), then \code{x} will be considered as a dissimilarity matrix. If FALSE, then \code{x} will be considered as a matrix of observations by variables. } \item{metric}{ character string specifying the metric to be used for calculating dissimilarities between observations.\cr The currently available options are "euclidean" and "manhattan". Euclidean distances are root sum-of-squares of differences, and manhattan distances are the sum of absolute differences. If \code{x} is already a dissimilarity matrix, then this argument will be ignored. } \item{medoids}{NULL (default) or length-\code{k} vector of integer indices (in \code{1:n}) specifying initial medoids instead of using the \sQuote{\emph{build}} algorithm.} \item{nstart}{used only when \code{medoids = "random"}: specifies the \emph{number} of random \dQuote{starts}; this argument corresponds to the one of \code{\link{kmeans}()} (from \R's package \pkg{stats}).} \item{stand}{logical; if true, the measurements in \code{x} are standardized before calculating the dissimilarities. Measurements are standardized for each variable (column), by subtracting the variable's mean value and dividing by the variable's mean absolute deviation. If \code{x} is already a dissimilarity matrix, then this argument will be ignored.} \item{cluster.only}{logical; if true, only the clustering will be computed and returned, see details.} \item{do.swap}{logical indicating if the \bold{swap} phase should happen. The default, \code{TRUE}, correspond to the original algorithm. On the other hand, the \bold{swap} phase is much more computer intensive than the \bold{build} one for large \eqn{n}, so can be skipped by \code{do.swap = FALSE}.} \item{keep.diss, keep.data}{logicals indicating if the dissimilarities and/or input data \code{x} should be kept in the result. Setting these to \code{FALSE} can give much smaller results and hence even save memory allocation \emph{time}.} \item{pamonce}{logical or integer in \code{0:6} specifying algorithmic short cuts as proposed by Reynolds et al. (2006), and Schubert and Rousseeuw (2019, 2021) see below.} \item{variant}{a \code{\link{character}} string denoting the variant of PAM algorithm to use; a more self-documenting version of \code{pamonce} which should be used preferably; note that \code{"faster"} not only uses \code{pamonce = 6} but also \code{nstart = 1} and hence \code{medoids = "random"} by default.} \item{trace.lev}{integer specifying a trace level for printing diagnostics during the build and swap phase of the algorithm. Default \code{0} does not print anything; higher values print increasingly more.} } \value{ an object of class \code{"pam"} representing the clustering. See \code{?\link{pam.object}} for details. } \details{ The basic \code{pam} algorithm is fully described in chapter 2 of Kaufman and Rousseeuw(1990). Compared to the k-means approach in \code{kmeans}, the function \code{pam} has the following features: (a) it also accepts a dissimilarity matrix; (b) it is more robust because it minimizes a sum of dissimilarities instead of a sum of squared euclidean distances; (c) it provides a novel graphical display, the silhouette plot (see \code{plot.partition}) (d) it allows to select the number of clusters using \code{mean(\link{silhouette}(pr)[, "sil_width"])} on the result \code{pr <- pam(..)}, or directly its component \code{pr$silinfo$avg.width}, see also \code{\link{pam.object}}. When \code{cluster.only} is true, the result is simply a (possibly named) integer vector specifying the clustering, i.e.,\cr \code{pam(x,k, cluster.only=TRUE)} is the same as \cr \code{pam(x,k)$clustering} but computed more efficiently. The \code{pam}-algorithm is based on the search for \code{k} representative objects or medoids among the observations of the dataset. These observations should represent the structure of the data. After finding a set of \code{k} medoids, \code{k} clusters are constructed by assigning each observation to the nearest medoid. The goal is to find \code{k} representative objects which minimize the sum of the dissimilarities of the observations to their closest representative object. \cr By default, when \code{medoids} are not specified, the algorithm first looks for a good initial set of medoids (this is called the \bold{build} phase). Then it finds a local minimum for the objective function, that is, a solution such that there is no single switch of an observation with a medoid (i.e. a \sQuote{swap}) that will decrease the objective (this is called the \bold{swap} phase). When the \code{medoids} are specified (or randomly generated), their order does \emph{not} matter; in general, the algorithms have been designed to not depend on the order of the observations. The \code{pamonce} option, new in cluster 1.14.2 (Jan. 2012), has been proposed by Matthias Studer, University of Geneva, based on the findings by Reynolds et al. (2006) and was extended by Erich Schubert, TU Dortmund, with the FastPAM optimizations. The default \code{FALSE} (or integer \code{0}) corresponds to the original \dQuote{swap} algorithm, whereas \code{pamonce = 1} (or \code{TRUE}), corresponds to the first proposal .... %% FIXME and \code{pamonce = 2} additionally implements the second proposal as well. % FIXME more details The key ideas of \sQuote{FastPAM} (Schubert and Rousseeuw, 2019) are implemented except for the linear approximate build as follows: \describe{ \item{\code{pamonce = 3}:}{ reduces the runtime by a factor of O(k) by exploiting that points cannot be closest to all current medoids at the same time.} \item{\code{pamonce = 4}:}{ additionally allows executing multiple swaps per iteration, usually reducing the number of iterations.} \item{\code{pamonce = 5}:}{ adds minor optimizations copied from the \code{pamonce = 2} approach, and is expected to be the fastest of the \sQuote{FastPam} variants included.} } \sQuote{FasterPAM} (Schubert and Rousseeuw, 2021) is implemented via \describe{ \item{\code{pamonce = 6}:}{execute each swap which improves results immediately, and hence typically multiple swaps per iteration; this swapping algorithm runs in \eqn{O(n^2)} rather than \eqn{O(n(n-k)k)} time which is much faster for all but small \eqn{k}.} } In addition, \sQuote{FasterPAM} uses \emph{random} initialization of the medoids (instead of the \sQuote{\emph{build}} phase) to avoid the \eqn{O(n^2 k)} initialization cost of the build algorithm. In particular for large k, this yields a much faster algorithm, while preserving a similar result quality. One may decide to use \emph{repeated} random initialization by setting \code{nstart > 1}.%% FIXME(also above) THOUGH we have said the *order* should really not matter. } \note{ For large datasets, \code{pam} may need too much memory or too much computation time since both are \eqn{O(n^2)}. Then, \code{\link{clara}()} is preferable, see its documentation. There is hard limit currently, \eqn{n \le 65536}{n <= 65536}, at \eqn{2^{16}} because for larger \eqn{n}, \eqn{n(n-1)/2} is larger than the maximal integer (\code{\link{.Machine}$integer.max} = \eqn{2^{31} - 1}). } \author{Kaufman and Rousseeuw's orginal Fortran code was translated to C and augmented in several ways, e.g. to allow \code{cluster.only=TRUE} or \code{do.swap=FALSE}, by Martin Maechler. \cr Matthias Studer, Univ.Geneva provided the \code{pamonce} (\code{1} and \code{2}) implementation. \cr Erich Schubert, TU Dortmund contributed the \code{pamonce} (\code{3} to \code{6}) implementation. } \references{ %% the pamonce=1,2 options : Reynolds, A., Richards, G., de la Iglesia, B. and Rayward-Smith, V. (1992) Clustering rules: A comparison of partitioning and hierarchical clustering algorithms; \emph{Journal of Mathematical Modelling and Algorithms} \bold{5}, 475--504. \doi{10.1007/s10852-005-9022-1}. %% the pamonce=3,4,5 (FastPAM) options: Erich Schubert and Peter J. Rousseeuw (2019) Faster k-Medoids Clustering: Improving the PAM, CLARA, and CLARANS Algorithms; SISAP 2020, 171--187. \doi{10.1007/978-3-030-32047-8_16}. %% improvements to FastPAM, and FasterPAM: Erich Schubert and Peter J. Rousseeuw (2021) Fast and Eager k-Medoids Clustering: O(k) Runtime Improvement of the PAM, CLARA, and CLARANS Algorithms; Preprint, to appear in Information Systems (\url{https://arxiv.org/abs/2008.05171}). } \seealso{ \code{\link{agnes}} for background and references; \code{\link{pam.object}}, \code{\link{clara}}, \code{\link{daisy}}, \code{\link{partition.object}}, \code{\link{plot.partition}}, \code{\link{dist}}. } \examples{ ## generate 25 objects, divided into 2 clusters. set.seed(17) # to get reproducible data: x <- rbind(cbind(rnorm(10,0,0.5), rnorm(10,0,0.5)), cbind(rnorm(15,5,0.5), rnorm(15,5,0.5))) pamx <- pam(x, 2) pamx # Medoids: '9' and '15' ... summary(pamx) plot(pamx) stopifnot(pamx$id.med == c(9, 15)) stopifnot(identical(pamx$clustering, rep(1:2, c(10, 15)))) ## use obs. 1 & 16 as starting medoids -- same result (for seed above, *and* typically) : (p2m <- pam(x, 2, medoids = c(1,16))) ## no _build_ *and* no _swap_ phase: just cluster all obs. around (1, 16): p2.s <- pam(x, 2, medoids = c(1,16), do.swap = FALSE) p2.s keep_nms <- setdiff(names(pamx), c("call", "objective"))# .$objective["build"] differ stopifnot(p2.s$id.med == c(1,16), # of course identical(pamx[keep_nms], p2m[keep_nms])) p3m <- pam(x, 3, trace.lev = 2) ## rather stupid initial medoids: (p3m. <- pam(x, 3, medoids = 3:1, trace.lev = 1)) \dontshow{ ii <- pmatch(c("obj","call"), names(pamx)) stopifnot(all.equal(pamx [-ii], p2m [-ii], tolerance=1e-14), all.equal(pamx$objective[2], p2m$objective[2], tolerance=1e-14)) } pam(daisy(x, metric = "manhattan"), 2, diss = TRUE) data(ruspini) ## Plot similar to Figure 4 in Stryuf et al (1996) \dontrun{plot(pam(ruspini, 4), ask = TRUE)} \dontshow{plot(pam(ruspini, 4))} } \keyword{cluster} cluster/man/twins.object.Rd0000644000176200001440000000134310370161217015405 0ustar liggesusers\name{twins.object} \alias{twins.object} \alias{twins}% == class \title{Hierarchical Clustering Object} \description{ The objects of class \code{"twins"} represent an agglomerative or divisive (polythetic) hierarchical clustering of a dataset. } \section{GENERATION}{ This class of objects is returned from \code{agnes} or \code{diana}. } \section{METHODS}{ The \code{"twins"} class has a method for the following generic function: \code{pltree}. } \section{INHERITANCE}{ The following classes inherit from class \code{"twins"} : \code{"agnes"} and \code{"diana"}. } \value{ See \code{\link{agnes.object}} and \code{\link{diana.object}} for details. } \seealso{\code{\link{agnes}},\code{\link{diana}}. } \keyword{cluster} cluster/man/lower.to.upper.tri.inds.Rd0000644000176200001440000000174512422156450017441 0ustar liggesusers\name{lower.to.upper.tri.inds} \alias{lower.to.upper.tri.inds} \alias{upper.to.lower.tri.inds} \title{Permute Indices for Triangular Matrices} \description{ Compute index vectors for extracting or reordering of lower or upper triangular matrices that are stored as contiguous vectors. } \usage{ lower.to.upper.tri.inds(n) upper.to.lower.tri.inds(n) } \arguments{ \item{n}{integer larger than 1.} } \value{ integer vector containing a permutation of \code{1:N} where \eqn{N = n(n-1)/2}. } \seealso{\code{\link{upper.tri}}, \code{\link{lower.tri}} with a related purpose.} \examples{ m5 <- matrix(NA,5,5) m <- m5; m[lower.tri(m)] <- upper.to.lower.tri.inds(5); m m <- m5; m[upper.tri(m)] <- lower.to.upper.tri.inds(5); m stopifnot(lower.to.upper.tri.inds(2) == 1, lower.to.upper.tri.inds(3) == 1:3, upper.to.lower.tri.inds(3) == 1:3, sort(upper.to.lower.tri.inds(5)) == 1:10, sort(lower.to.upper.tri.inds(6)) == 1:15) } \keyword{array} \keyword{utilities} cluster/man/print.pam.Rd0000644000176200001440000000110410073061404014674 0ustar liggesusers\name{print.pam} \alias{print.pam} \title{Print Method for PAM Objects} \description{ Prints the medoids, clustering vector and objective function of \code{pam} object. This is a method for the function \code{\link{print}()} for objects inheriting from class \code{\link{pam}}. } \usage{ \method{print}{pam}(x, \dots) } \arguments{ \item{x}{a pam object.} \item{\dots}{potential further arguments (require by generic).} } \seealso{ \code{\link{pam}}, \code{\link{pam.object}}, \code{\link{print}}, \code{\link{print.default}}. } \keyword{cluster} \keyword{print} cluster/man/summary.clara.Rd0000644000176200001440000000241514764134022015560 0ustar liggesusers\name{summary.clara} \alias{summary.clara} \alias{print.summary.clara} \title{Summary Method for 'clara' Objects} \description{ Returns (and prints) a summary list for a \code{clara} object. Printing gives more output than the corresponding \code{\link{print.clara}} method. } \usage{ \method{summary}{clara}(object, \dots) \method{print}{summary.clara}(x, \dots) } \arguments{ \item{x, object}{a \code{\link{clara}} object.} \item{\dots}{potential further arguments (require by generic).} } \seealso{\code{\link{clara.object}}} \examples{ ## generate 2000 objects, divided into 5 clusters. set.seed(47) x <- rbind(cbind(rnorm(400, 0,4), rnorm(400, 0,4)), cbind(rnorm(400,10,8), rnorm(400,40,6)), cbind(rnorm(400,30,4), rnorm(400, 0,4)), cbind(rnorm(400,40,4), rnorm(400,20,2)), cbind(rnorm(400,50,4), rnorm(400,50,4)) ) clx5 <- clara(x, 5) ## Mis'classification' table: % R version >= 1.5 : % table(rep(1:5, each = 400), clx5$clust) # -> 1 "error" table(rep(1:5, rep(400,5)), clx5$clustering) # -> 1 "error" summary(clx5) ## Graphically: par(mfrow = c(3,1), mgp = c(1.5, 0.6, 0), mar = par("mar") - c(0,0,2,0)) %>1.5: plot(x, col = rep(2:6, each = 400)) plot(x, col = rep(2:6, rep(400,5))) plot(clx5) } \keyword{cluster} \keyword{print} cluster/man/plot.agnes.Rd0000644000176200001440000001102014764134022015044 0ustar liggesusers\name{plot.agnes} %% almost identical to ./plot.diana.Rd and quite similar to ./plot.mona.Rd \alias{plot.agnes} \title{Plots of an Agglomerative Hierarchical Clustering} \description{ Creates plots for visualizing an \code{agnes} object. } \usage{ \method{plot}{agnes}(x, ask = FALSE, which.plots = NULL, main = NULL, sub = paste("Agglomerative Coefficient = ",round(x$ac, digits = 2)), adj = 0, nmax.lab = 35, max.strlen = 5, xax.pretty = TRUE, \dots) } \arguments{ \item{x}{an object of class \code{"agnes"}, typically created by \code{\link{agnes}(.)}.} \item{ask}{logical; if true and \code{which.plots} is \code{NULL}, \code{plot.agnes} operates in interactive mode, via \code{\link{menu}}.} \item{which.plots}{integer vector or NULL (default), the latter producing both plots. Otherwise, \code{which.plots} must contain integers of \code{1} for a \emph{banner} plot or \code{2} for a dendrogram or \dQuote{clustering tree}.} \item{main, sub}{main and sub title for the plot, with convenient defaults. See documentation for these arguments in \code{\link{plot.default}}.} \item{adj}{for label adjustment in \code{\link{bannerplot}()}.} \item{nmax.lab}{integer indicating the number of labels which is considered too large for single-name labelling the banner plot.} \item{max.strlen}{positive integer giving the length to which strings are truncated in banner plot labeling.} \item{xax.pretty}{logical or integer indicating if \code{\link{pretty}(*, n = xax.pretty)} should be used for the x axis. \code{xax.pretty = FALSE} is for back compatibility.} \item{\dots}{graphical parameters (see \code{\link{par}}) may also be supplied and are passed to \code{\link{bannerplot}()} or \code{pltree()} (see \code{\link{pltree.twins}}), respectively.} } \section{Side Effects}{ Appropriate plots are produced on the current graphics device. This can be one or both of the following choices: \cr Banner \cr Clustering tree } \details{ When \code{ask = TRUE}, rather than producing each plot sequentially, \code{plot.agnes} displays a menu listing all the plots that can be produced. If the menu is not desired but a pause between plots is still wanted one must set \code{par(ask= TRUE)} before invoking the plot command. The banner displays the hierarchy of clusters, and is equivalent to a tree. See Rousseeuw (1986) or chapter 5 of Kaufman and Rousseeuw (1990). The banner plots distances at which observations and clusters are merged. The observations are listed in the order found by the \code{agnes} algorithm, and the numbers in the \code{height} vector are represented as bars between the observations. The leaves of the clustering tree are the original observations. Two branches come together at the distance between the two clusters being merged. For more customization of the plots, rather call \code{\link{bannerplot}} and \code{pltree()}, i.e., its method \code{\link{pltree.twins}}, respectively. directly with corresponding arguments, e.g., \code{xlab} or \code{ylab}. } \note{ In the banner plot, observation labels are only printed when the number of observations is limited less than \code{nmax.lab} (35, by default), for readability. Moreover, observation labels are truncated to maximally \code{max.strlen} (5) characters. For the dendrogram, more flexibility than via \code{pltree()} is provided by \code{dg <- \link{as.dendrogram}(x)} and plotting \code{dg} via \code{\link[stats]{plot.dendrogram}}. } \references{ Kaufman, L. and Rousseeuw, P.J. (1990) \emph{Finding Groups in Data: An Introduction to Cluster Analysis}. Wiley, New York. Rousseeuw, P.J. (1986). A visual display for hierarchical classification, in \emph{Data Analysis and Informatics 4}; edited by E. Diday, Y. Escoufier, L. Lebart, J. Pages, Y. Schektman, and R. Tomassone. North-Holland, Amsterdam, 743--748. Struyf, A., Hubert, M. and Rousseeuw, P.J. (1997) Integrating Robust Clustering Techniques in S-PLUS, \emph{Computational Statistics and Data Analysis}, \bold{26}, 17--37. } \seealso{ \code{\link{agnes}} and \code{\link{agnes.object}}; \code{\link{bannerplot}}, \code{\link{pltree.twins}}, and \code{\link{par}}. } \examples{ ## Can also pass 'labels' to pltree() and bannerplot(): data(iris) cS <- as.character(Sp <- iris$Species) cS[Sp == "setosa"] <- "S" cS[Sp == "versicolor"] <- "V" cS[Sp == "virginica"] <- "g" ai <- agnes(iris[, 1:4]) plot(ai, labels = cS, nmax.lab = 150)# bannerplot labels are mess } \keyword{cluster} \keyword{hplot} cluster/man/clusGap.Rd0000644000176200001440000002714014764134021014401 0ustar liggesusers\name{clusGap} \title{Gap Statistic for Estimating the Number of Clusters} \alias{clusGap} \alias{maxSE} \alias{print.clusGap} \alias{plot.clusGap} \description{ \code{clusGap()} calculates a goodness of clustering measure, the \dQuote{gap} statistic. For each number of clusters \eqn{k}, it compares \eqn{\log(W(k))}{log(W(k))} with \eqn{E^*[\log(W(k))]}{E*[log(W(k))]} where the latter is defined via bootstrapping, i.e., simulating from a reference (\eqn{H_0}) distribution, a uniform distribution on the hypercube determined by the ranges of \code{x}, after first centering, and then \code{\link{svd}} (aka \sQuote{PCA})-rotating them when (as by default) \code{spaceH0 = "scaledPCA"}. \code{maxSE(f, SE.f)} determines the location of the \bold{maximum} of \code{f}, taking a \dQuote{1-SE rule} into account for the \code{*SE*} methods. The default method \code{"firstSEmax"} looks for the smallest \eqn{k} such that its value \eqn{f(k)} is not more than 1 standard error away from the first local maximum. This is similar but not the same as \code{"Tibs2001SEmax"}, Tibshirani et al's recommendation of determining the number of clusters from the gap statistics and their standard deviations. } \usage{ clusGap(x, FUNcluster, K.max, B = 100, d.power = 1, spaceH0 = c("scaledPCA", "original"), verbose = interactive(), \dots) maxSE(f, SE.f, method = c("firstSEmax", "Tibs2001SEmax", "globalSEmax", "firstmax", "globalmax"), SE.factor = 1) \S3method{print}{clusGap}(x, method = "firstSEmax", SE.factor = 1, \dots) \S3method{plot}{clusGap}(x, type = "b", xlab = "k", ylab = expression(Gap[k]), main = NULL, do.arrows = TRUE, arrowArgs = list(col="red3", length=1/16, angle=90, code=3), \dots) } \arguments{ \item{x}{numeric matrix or \code{\link{data.frame}}.} \item{FUNcluster}{a \code{\link{function}} which accepts as first argument a (data) matrix like \code{x}, second argument, say \eqn{k, k\geq 2}{k, k >= 2}, the number of clusters desired, and returns a \code{\link{list}} with a component named (or shortened to) \code{cluster} which is a vector of length \code{n = nrow(x)} of integers in \code{1:k} determining the clustering or grouping of the \code{n} observations.} \item{K.max}{the maximum number of clusters to consider, must be at least two.} \item{B}{integer, number of Monte Carlo (\dQuote{bootstrap}) samples.} \item{d.power}{a positive integer specifying the power \eqn{p} which is applied to the euclidean distances (\code{\link{dist}}) before they are summed up to give \eqn{W(k)}. The default, \code{d.power = 1}, corresponds to the \dQuote{historical} \R implementation, whereas \code{d.power = 2} corresponds to what Tibshirani et al had proposed. This was found by Juan Gonzalez, in 2016-02.}%Feb.\sspace{}2016.} \item{spaceH0}{a \code{\link{character}} string specifying the space of the \eqn{H_0} distribution (of \emph{no} cluster). Both \code{"scaledPCA"} and \code{"original"} use a uniform distribution in a hyper cube and had been mentioned in the reference; \code{"original"} been added after a proposal (including code) by Juan Gonzalez.} \item{verbose}{integer or logical, determining if \dQuote{progress} output should be printed. The default prints one bit per bootstrap sample.} \item{\dots}{(for \code{clusGap()}:) optionally further arguments for \code{FUNcluster()}, see \code{kmeans} example below.} \item{f}{numeric vector of \sQuote{function values}, of length \eqn{K}, whose (\dQuote{1 SE respected}) maximum we want.} \item{SE.f}{numeric vector of length \eqn{K} of standard errors of \code{f}.} \item{method}{character string indicating how the \dQuote{optimal} number of clusters, \eqn{\hat k}{k^}, is computed from the gap statistics (and their standard deviations), or more generally how the location \eqn{\hat k}{k^} of the maximum of \eqn{f_k}{f[k]} should be determined. %% -> ../R/clusGap.R \describe{ \item{\code{"globalmax"}:}{simply corresponds to the global maximum, i.e., is \code{which.max(f)}} \item{\code{"firstmax"}:}{gives the location of the first \emph{local} maximum.} \item{\code{"Tibs2001SEmax"}:}{uses the criterion, Tibshirani et al (2001) proposed: \dQuote{the smallest \eqn{k} such that \eqn{f(k) \ge f(k+1) - s_{k+1}}}. Note that this chooses \eqn{k = 1} when all standard deviations are larger than the differences \eqn{f(k+1) - f(k)}.} \item{\code{"firstSEmax"}:}{location of the first \eqn{f()} value which is not smaller than the first \emph{local} maximum minus \code{SE.factor * SE.f[]}, i.e, within an \dQuote{f S.E.} range of that maximum (see also \code{SE.factor}). This, the default, has been proposed by Martin Maechler in 2012, when adding \code{clusGap()} to the \pkg{cluster} package, after having seen the \code{"globalSEmax"} proposal (in code) and read the \code{"Tibs2001SEmax"} proposal.} \item{\code{"globalSEmax"}:}{(used in Dudoit and Fridlyand (2002), supposedly following Tibshirani's proposition): location of the first \eqn{f()} value which is not smaller than the \emph{global} maximum minus \code{SE.factor * SE.f[]}, i.e, within an \dQuote{f S.E.} range of that maximum (see also \code{SE.factor}).} } See the examples for a comparison in a simple case. } \item{SE.factor}{[When \code{method} contains \code{"SE"}] Determining the optimal number of clusters, Tibshirani et al. proposed the \dQuote{1 S.E.}-rule. Using an \code{SE.factor} \eqn{f}, the \dQuote{f S.E.}-rule is used, more generally.} %% plot(): \item{type, xlab, ylab, main}{arguments with the same meaning as in \code{\link{plot.default}()}, with different default.} \item{do.arrows}{logical indicating if (1 SE -)\dQuote{error bars} should be drawn, via \code{\link{arrows}()}.} \item{arrowArgs}{a list of arguments passed to \code{\link{arrows}()}; the default, notably \code{angle} and \code{code}, provide a style matching usual error bars.} } \details{ The main result \code{$Tab[,"gap"]} of course is from bootstrapping aka Monte Carlo simulation and hence random, or equivalently, depending on the initial random seed (see \code{\link{set.seed}()}). On the other hand, in our experience, using \code{B = 500} gives quite precise results such that the gap plot is basically unchanged after an another run. } \value{ \code{clusGap(..)} returns an object of S3 class \code{"clusGap"}, basically a list with components \item{Tab}{a matrix with \code{K.max} rows and 4 columns, named "logW", "E.logW", "gap", and "SE.sim", where \code{gap = E.logW - logW}, and \code{SE.sim} corresponds to the standard error of \code{gap}, \code{SE.sim[k]=}\eqn{s_k}{s[k]}, where \eqn{s_k := \sqrt{1 + 1/B} sd^*(gap_j)}{s[k] := sqrt(1 + 1/B) sd^*(gap[])}, and \eqn{sd^*()} is the standard deviation of the simulated (\dQuote{bootstrapped}) gap values. } \item{call}{the \code{clusGap(..)} \code{\link{call}}.} \item{spaceH0}{the \code{spaceH0} argument (\code{\link{match.arg}()}ed).} \item{n}{number of observations, i.e., \code{nrow(x)}.} \item{B}{input \code{B}} \item{FUNcluster}{input function \code{FUNcluster}} } \references{ Tibshirani, R., Walther, G. and Hastie, T. (2001). Estimating the number of data clusters via the Gap statistic. \emph{Journal of the Royal Statistical Society B}, \bold{63}, 411--423. Tibshirani, R., Walther, G. and Hastie, T. (2000). Estimating the number of clusters in a dataset via the Gap statistic. Technical Report. Stanford. Dudoit, S. and Fridlyand, J. (2002) A prediction-based resampling method for estimating the number of clusters in a dataset. \emph{Genome Biology} \bold{3}(7). \doi{10.1186/gb-2002-3-7-research0036} Per Broberg (2006). SAGx: Statistical Analysis of the GeneChip. R package version 1.9.7.% moved to Bioconductor sometime after 2006 % Martin Morgan (2018-10-15): Last change was in 2011 % URL <= ~2018: \url{http://home.swipnet.se/pibroberg/expression_hemsida1.html} % deprecated Bioc 3.13, removed in Bioc 3.14 (~2022): hence this is "last": \url{https://bioconductor.org/packages/3.12/bioc/html/SAGx.html} Deprecated and removed from Bioc ca. 2022 } \author{ This function is originally based on the functions \code{gap} of former (Bioconductor) package \pkg{SAGx} by Per Broberg, \code{gapStat()} from former package \pkg{SLmisc} by Matthias Kohl and ideas from \code{gap()} and its methods of package \pkg{lga} by Justin Harrington. The current implementation is by Martin Maechler. The implementation of \code{spaceH0 = "original"} is based on code proposed by Juan Gonzalez. } \seealso{ \code{\link{silhouette}} for a much simpler less sophisticated goodness of clustering measure. \code{\link[fpc]{cluster.stats}()} in package \pkg{fpc} for alternative measures. %\code{\link[SGAx]{gap}} in Bioconductor package \pkg{SGAx}. } \examples{ ### --- maxSE() methods ------------------------------------------- (mets <- eval(formals(maxSE)$method)) fk <- c(2,3,5,4,7,8,5,4) sk <- c(1,1,2,1,1,3,1,1)/2 ## use plot.clusGap(): plot(structure(class="clusGap", list(Tab = cbind(gap=fk, SE.sim=sk)))) ## Note that 'firstmax' and 'globalmax' are always at 3 and 6 : sapply(c(1/4, 1,2,4), function(SEf) sapply(mets, function(M) maxSE(fk, sk, method = M, SE.factor = SEf))) ### --- clusGap() ------------------------------------------------- ## ridiculously nicely separated clusters in 3 D : x <- rbind(matrix(rnorm(150, sd = 0.1), ncol = 3), matrix(rnorm(150, mean = 1, sd = 0.1), ncol = 3), matrix(rnorm(150, mean = 2, sd = 0.1), ncol = 3), matrix(rnorm(150, mean = 3, sd = 0.1), ncol = 3)) ## Slightly faster way to use pam (see below) pam1 <- function(x,k) list(cluster = pam(x,k, cluster.only=TRUE)) ## We do not recommend using hier.clustering here, but if you want, ## there is factoextra::hcut () or a cheap version of it hclusCut <- function(x, k, d.meth = "euclidean", ...) list(cluster = cutree(hclust(dist(x, method=d.meth), ...), k=k)) ## You can manually set it before running this : doExtras <- TRUE # or FALSE if(!(exists("doExtras") && is.logical(doExtras))) doExtras <- cluster:::doExtras() if(doExtras) { ## Note we use B = 60 in the following examples to keep them "speedy". ## ---- rather keep the default B = 500 for your analysis! ## note we can pass 'nstart = 20' to kmeans() : gskmn <- clusGap(x, FUNcluster = kmeans, nstart = 20, K.max = 8, B = 60) gskmn #-> its print() method plot(gskmn, main = "clusGap(., FUNcluster = kmeans, n.start=20, B= 60)") set.seed(12); system.time( gsPam0 <- clusGap(x, FUNcluster = pam, K.max = 8, B = 60) ) set.seed(12); system.time( gsPam1 <- clusGap(x, FUNcluster = pam1, K.max = 8, B = 60) ) ## and show that it gives the "same": not.eq <- c("call", "FUNcluster"); n <- names(gsPam0) eq <- n[!(n \%in\% not.eq)] stopifnot(identical(gsPam1[eq], gsPam0[eq])) print(gsPam1, method="globalSEmax") print(gsPam1, method="globalmax") print(gsHc <- clusGap(x, FUNcluster = hclusCut, K.max = 8, B = 60)) }# end {doExtras} gs.pam.RU <- clusGap(ruspini, FUNcluster = pam1, K.max = 8, B = 60) gs.pam.RU plot(gs.pam.RU, main = "Gap statistic for the 'ruspini' data") mtext("k = 4 is best .. and k = 5 pretty close") \donttest{## This takes a minute.. ## No clustering ==> k = 1 ("one cluster") should be optimal: Z <- matrix(rnorm(256*3), 256,3) gsP.Z <- clusGap(Z, FUNcluster = pam1, K.max = 8, B = 200) plot(gsP.Z, main = "clusGap() ==> k = 1 cluster is optimal") gsP.Z }%end{dont..} } \keyword{cluster} cluster/man/pltree.Rd0000644000176200001440000000460214277707561014312 0ustar liggesusers\name{pltree} \alias{pltree} \alias{pltree.twins} \title{Plot Clustering Tree of a Hierarchical Clustering} \description{ \code{pltree()} Draws a clustering tree (\dQuote{dendrogram}) on the current graphics device. We provide the \code{twins} method draws the tree of a \code{twins} object, i.e., hierarchical clustering, typically resulting from \code{\link{agnes}()} or \code{\link{diana}()}. } \usage{ pltree(x, \dots) \method{pltree}{twins}(x, main = paste("Dendrogram of ", deparse1(x$call)), labels = NULL, ylab = "Height", \dots) } \arguments{ \item{x}{in general, an \R object for which a \code{pltree} method is defined; specifically, an object of class \code{"twins"}, typically created by either \code{\link{agnes}()} or \code{\link{diana}()}.} \item{main}{main title with a sensible default.} \item{labels}{labels to use; the default is constructed from \code{x}.} \item{ylab}{label for y-axis.} \item{\dots}{graphical parameters (see \code{\link{par}}) may also be supplied as arguments to this function.} } \value{ a NULL value is returned. } \details{ Creates a plot of a clustering tree given a \code{twins} object. The leaves of the tree are the original observations. In case of an agglomerative clustering, two branches come together at the distance between the two clusters being merged. For a divisive clustering, a branch splits up at the diameter of the cluster being splitted. Note that currently the method function simply calls \code{plot(\link[stats]{as.hclust}(x), ...)}, which dispatches to \code{\link{plot.hclust}(..)}. If more flexible plots are needed, consider \code{xx <- \link{as.dendrogram}(\link{as.hclust}(x))} and plotting \code{xx}, see \code{\link{plot.dendrogram}}. } \seealso{ \code{\link{agnes}}, \code{\link{agnes.object}}, \code{\link{diana}}, \code{\link{diana.object}}, \code{\link{hclust}}, \code{\link{par}}, \code{\link{plot.agnes}}, \code{\link{plot.diana}}. } \examples{ data(votes.repub) agn <- agnes(votes.repub) pltree(agn) dagn <- as.dendrogram(as.hclust(agn)) dagn2 <- as.dendrogram(as.hclust(agn), hang = 0.2) op <- par(mar = par("mar") + c(0,0,0, 2)) # more space to the right plot(dagn2, horiz = TRUE) plot(dagn, horiz = TRUE, center = TRUE, nodePar = list(lab.cex = 0.6, lab.col = "forest green", pch = NA), main = deparse(agn$call)) par(op) } \keyword{cluster} \keyword{hplot} cluster/man/clara.object.Rd0000644000176200001440000000505210500041124015311 0ustar liggesusers\name{clara.object} \alias{clara.object} \title{Clustering Large Applications (CLARA) Object} \description{ The objects of class \code{"clara"} represent a partitioning of a large dataset into clusters and are typically returned from \code{\link{clara}}. } \section{Methods, Inheritance}{ The \code{"clara"} class has methods for the following generic functions: \code{print}, \code{summary}. The class \code{"clara"} inherits from \code{"partition"}. Therefore, the generic functions \code{plot} and \code{clusplot} can be used on a \code{clara} object. } \value{ A legitimate \code{clara} object is a list with the following components: \item{sample}{ labels or case numbers of the observations in the best sample, that is, the sample used by the \code{clara} algorithm for the final partition.} \item{medoids}{the medoids or representative objects of the clusters. It is a matrix with in each row the coordinates of one medoid. Possibly \code{NULL}, namely when the object resulted from \code{clara(*, medoids.x=FALSE)}. Use the following \code{i.med} in that case.} \item{i.med}{ the \emph{indices} of the \code{medoids} above: \code{medoids <- x[i.med,]} where \code{x} is the original data matrix in \code{clara(x,*)}.} \item{clustering}{the clustering vector, see \code{\link{partition.object}}.} \item{objective}{the objective function for the final clustering of the entire dataset.} \item{clusinfo}{ matrix, each row gives numerical information for one cluster. These are the cardinality of the cluster (number of observations), the maximal and average dissimilarity between the observations in the cluster and the cluster's medoid. %% FIXME: Now differs from pam.object.Rd: The last column is the maximal dissimilarity between the observations in the cluster and the cluster's medoid, divided by the minimal dissimilarity between the cluster's medoid and the medoid of any other cluster. If this ratio is small, the cluster is well-separated from the other clusters. } \item{diss}{dissimilarity (maybe NULL), see \code{\link{partition.object}}.} \item{silinfo}{list with silhouette width information for the best sample, see \code{\link{partition.object}}.} \item{call}{generating call, see \code{\link{partition.object}}.} \item{data}{matrix, possibibly standardized, or NULL, see \code{\link{partition.object}}.} } \seealso{ \code{\link{clara}}, \code{\link{dissimilarity.object}}, \code{\link{partition.object}}, \code{\link{plot.partition}}. } \keyword{cluster} cluster/man/cluster-internal.Rd0000644000176200001440000000101214514234154016265 0ustar liggesusers\name{cluster-internal} \alias{meanabsdev} \title{Internal cluster functions} \description{ Internal cluster functions. } \usage{ meanabsdev(y) } \arguments{ \item{y}{numeric vector.} } \details{ These are not to be called by the user. A more \R-like version of \code{meanabsdev()} would default to \code{na.rm=FALSE}, as e.g., \code{\link{mean}()} or \code{\link{median}()}: \preformatted{ meanabsdev <- function(y, na.rm=FALSE) mean(abs(y - mean(y, na.rm=na.rm)), na.rm=na.rm) } } \keyword{internal} cluster/man/coef.hclust.Rd0000644000176200001440000000442511674345261015230 0ustar liggesusers\name{coef.hclust} \alias{coefHier} \alias{coef.hclust} \alias{coef.twins} \title{Agglomerative / Divisive Coefficient for 'hclust' Objects} \description{ Computes the \dQuote{agglomerative coefficient} (aka \dQuote{divisive coefficient} for \code{\link{diana}}), measuring the clustering structure of the dataset. For each observation i, denote by \eqn{m(i)} its dissimilarity to the first cluster it is merged with, divided by the dissimilarity of the merger in the final step of the algorithm. The agglomerative coefficient is the average of all \eqn{1 - m(i)}. It can also be seen as the average width (or the percentage filled) of the banner plot. \code{coefHier()} directly interfaces to the underlying C code, and \dQuote{proves} that \emph{only} \code{object$heights} is needed to compute the coefficient. Because it grows with the number of observations, this measure should not be used to compare datasets of very different sizes. } \usage{ coefHier(object) coef.hclust(object, \dots)%-- we export this, on purpose \method{coef}{hclust}(object, \dots) \method{coef}{twins}(object, \dots) } \arguments{ \item{object}{an object of class \code{"hclust"} or \code{"twins"}, i.e., typically the result of \code{\link{hclust}(.)},\code{\link{agnes}(.)}, or \code{\link{diana}(.)}. Since \code{coef.hclust} only uses \code{object$heights}, and \code{object$merge}, \code{object} can be any list-like object with appropriate \code{merge} and \code{heights} components. For \code{coefHier}, even only \code{object$heights} is needed. } \item{\dots}{currently unused potential further arguments} } \value{ a number specifying the \emph{agglomerative} (or \emph{divisive} for \code{diana} objects) coefficient as defined by Kaufman and Rousseeuw, see \code{\link{agnes.object} $ ac} or \code{\link{diana.object} $ dc}. } \examples{ data(agriculture) aa <- agnes(agriculture) coef(aa) # really just extracts aa$ac coef(as.hclust(aa))# recomputes coefHier(aa) # ditto \dontshow{ stopifnot(all.equal(coef(aa), coefHier(aa))) d.a <- dist(agriculture, "manhattan") for (m in c("average", "single", "complete")) stopifnot(all.equal(coef(hclust(d.a, method=m)), coef(agnes (d.a, method=m)), tol=1e-13)) } } \keyword{cluster} cluster/man/agnes.object.Rd0000644000176200001440000000641312155364050015344 0ustar liggesusers\name{agnes.object} \alias{agnes.object} \title{Agglomerative Nesting (AGNES) Object} \description{ The objects of class \code{"agnes"} represent an agglomerative hierarchical clustering of a dataset. } \section{GENERATION}{ This class of objects is returned from \code{\link{agnes}}. } \section{METHODS}{ The \code{"agnes"} class has methods for the following generic functions: \code{print}, \code{summary}, \code{plot}, and \code{\link{as.dendrogram}}. In addition, \code{\link{cutree}(x, *)} can be used to \dQuote{cut} the dendrogram in order to produce cluster assignments. } \section{INHERITANCE}{ The class \code{"agnes"} inherits from \code{"twins"}. Therefore, the generic functions \code{\link{pltree}} and \code{\link{as.hclust}} are available for \code{agnes} objects. After applying \code{as.hclust()}, all \emph{its} methods are available, of course. } \value{ A legitimate \code{agnes} object is a list with the following components: \item{order}{ a vector giving a permutation of the original observations to allow for plotting, in the sense that the branches of a clustering tree will not cross.} \item{order.lab}{ a vector similar to \code{order}, but containing observation labels instead of observation numbers. This component is only available if the original observations were labelled. } \item{height}{ a vector with the distances between merging clusters at the successive stages. } \item{ac}{ the agglomerative coefficient, measuring the clustering structure of the dataset. For each observation i, denote by m(i) its dissimilarity to the first cluster it is merged with, divided by the dissimilarity of the merger in the final step of the algorithm. The \code{ac} is the average of all 1 - m(i). It can also be seen as the average width (or the percentage filled) of the banner plot. Because \code{ac} grows with the number of observations, this measure should not be used to compare datasets of very different sizes. } \item{merge}{ an (n-1) by 2 matrix, where n is the number of observations. Row i of \code{merge} describes the merging of clusters at step i of the clustering. If a number j in the row is negative, then the single observation |j| is merged at this stage. If j is positive, then the merger is with the cluster formed at stage j of the algorithm. } \item{diss}{ an object of class \code{"dissimilarity"} (see \code{\link{dissimilarity.object}}), representing the total dissimilarity matrix of the dataset. } \item{data}{ a matrix containing the original or standardized measurements, depending on the \code{stand} option of the function \code{agnes}. If a dissimilarity matrix was given as input structure, then this component is not available. } } \seealso{ \code{\link{agnes}}, \code{\link{diana}}, \code{\link{as.hclust}}, \code{\link{hclust}}, \code{\link{plot.agnes}}, \code{\link{twins.object}}. \code{\link{cutree}}. } \examples{ data(agriculture) ag.ag <- agnes(agriculture) class(ag.ag) pltree(ag.ag) # the dendrogram ## cut the dendrogram -> get cluster assignments: (ck3 <- cutree(ag.ag, k = 3)) (ch6 <- cutree(as.hclust(ag.ag), h = 6)) stopifnot(identical(unname(ch6), ck3)) } \keyword{cluster} cluster/man/print.clara.Rd0000644000176200001440000000127407520565344015230 0ustar liggesusers\name{print.clara} \alias{print.clara} \title{Print Method for CLARA Objects} \description{ Prints the best sample, medoids, clustering vector and objective function of \code{clara} object. This is a method for the function \code{\link{print}()} for objects inheriting from class \code{\link{clara}}. } \usage{ \method{print}{clara}(x, \dots) } \arguments{ \item{x}{a clara object.} \item{\dots}{potential further arguments (require by generic).} } \seealso{ \code{\link{summary.clara}} producing more output; \code{\link{clara}}, \code{\link{clara.object}}, \code{\link{print}}, \code{\link{print.default}}. } \keyword{cluster} \keyword{print} % Converted by Sd2Rd version 0.3-2. cluster/man/mona.Rd0000644000176200001440000001054713257175664013756 0ustar liggesusers\name{mona} \alias{mona} \title{MONothetic Analysis Clustering of Binary Variables} \description{ Returns a list representing a divisive hierarchical clustering of a dataset with binary variables only. } \usage{ mona(x, trace.lev = 0)% FIXME: allow early stopping } \arguments{ \item{x}{ data matrix or data frame in which each row corresponds to an observation, and each column corresponds to a variable. All variables must be binary. A limited number of missing values (\code{NA}s) is allowed. Every observation must have at least one value different from \code{\link{NA}}. No variable should have half of its values missing. There must be at least one variable which has no missing values. A variable with all its non-missing values identical is not allowed.} \item{trace.lev}{logical or integer indicating if (and how much) the algorithm should produce progress output.} } \value{ an object of class \code{"mona"} representing the clustering. See \code{\link{mona.object}} for details. } \details{ \code{mona} is fully described in chapter 7 of Kaufman and Rousseeuw (1990). It is \dQuote{monothetic} in the sense that each division is based on a single (well-chosen) variable, whereas most other hierarchical methods (including \code{agnes} and \code{diana}) are \dQuote{polythetic}, i.e. they use all variables together. The \code{mona}-algorithm constructs a hierarchy of clusterings, starting with one large cluster. Clusters are divided until all observations in the same cluster have identical values for all variables. \cr At each stage, all clusters are divided according to the values of one variable. A cluster is divided into one cluster with all observations having value 1 for that variable, and another cluster with all observations having value 0 for that variable. The variable used for splitting a cluster is the variable with the maximal total association to the other variables, according to the observations in the cluster to be splitted. The association between variables f and g is given by a(f,g)*d(f,g) - b(f,g)*c(f,g), where a(f,g), b(f,g), c(f,g), and d(f,g) are the numbers in the contingency table of f and g. [That is, a(f,g) (resp. d(f,g)) is the number of observations for which f and g both have value 0 (resp. value 1); b(f,g) (resp. c(f,g)) is the number of observations for which f has value 0 (resp. 1) and g has value 1 (resp. 0).] The total association of a variable f is the sum of its associations to all variables. } \section{Missing Values (\code{\link{NA}}s)}{ The mona-algorithm requires \dQuote{pure} 0-1 values. However, \code{mona(x)} allows \code{x} to contain (not too many) \code{\link{NA}}s. In a preliminary step, these are \dQuote{imputed}, i.e., all missing values are filled in. To do this, the same measure of association between variables is used as in the algorithm. When variable f has missing values, the variable g with the largest absolute association to f is looked up. When the association between f and g is positive, any missing value of f is replaced by the value of g for the same observation. If the association between f and g is negative, then any missing value of f is replaced by the value of 1-g for the same observation. } \note{ In \pkg{cluster} versions before 2.0.6, the algorithm entered an infinite loop in the boundary case of one variable, i.e., \code{ncol(x) == 1}, which currently signals an error (because the algorithm now in C, haes not correctly taken account of this special case). %% FIXME ("patches are welcome") } \seealso{ \code{\link{agnes}} for background and references; \code{\link{mona.object}}, \code{\link{plot.mona}}. } \examples{ data(animals) ma <- mona(animals) ma ## Plot similar to Figure 10 in Struyf et al (1996) plot(ma) ## One place to see if/how error messages are *translated* (to 'de' / 'pl'): ani.NA <- animals; ani.NA[4,] <- NA aniNA <- within(animals, { end[2:9] <- NA }) aniN2 <- animals; aniN2[cbind(1:6, c(3, 1, 4:6, 2))] <- NA ani.non2 <- within(animals, end[7] <- 3 ) ani.idNA <- within(animals, end[!is.na(end)] <- 1 ) try( mona(ani.NA) ) ## error: .. object with all values missing try( mona(aniNA) ) ## error: .. more than half missing values try( mona(aniN2) ) ## error: all have at least one missing try( mona(ani.non2) ) ## error: all must be binary try( mona(ani.idNA) ) ## error: ditto } \keyword{cluster} cluster/man/sizeDiss.Rd0000644000176200001440000000171010224226467014576 0ustar liggesusers\name{sizeDiss} \alias{sizeDiss} \title{Sample Size of Dissimilarity Like Object} \description{ Returns the number of observations (\emph{sample size}) corresponding to a dissimilarity like object, or equivalently, the number of rows or columns of a matrix when only the lower or upper triangular part (without diagonal) is given. It is nothing else but the inverse function of \eqn{f(n) = n(n-1)/2}. } \usage{ sizeDiss(d) } \arguments{ \item{d}{any \R object with length (typically) \eqn{n(n-1)/2}.} } \value{ a number; \eqn{n} if \code{length(d) == n(n-1)/2}, \code{NA} otherwise. } \seealso{\code{\link{dissimilarity.object}} and also \code{\link{as.dist}} for class \code{dissimilarity} and \code{dist} objects which have a \code{Size} attribute.} \examples{ sizeDiss(1:10)# 5, since 10 == 5 * (5 - 1) / 2 sizeDiss(1:9) # NA n <- 1:100 stopifnot(n == sapply( n*(n-1)/2, function(n) sizeDiss(logical(n)))) } \keyword{utilities} \keyword{arith} cluster/man/plot.diana.Rd0000644000176200001440000000664514764134022015044 0ustar liggesusers\name{plot.diana} %% almost identical to ./plot.agnes.Rd and quite similar to ./plot.mona.Rd \alias{plot.diana} \title{Plots of a Divisive Hierarchical Clustering} \description{ Creates plots for visualizing a \code{diana} object. } \usage{ \method{plot}{diana}(x, ask = FALSE, which.plots = NULL, main = NULL, sub = paste("Divisive Coefficient = ", round(x$dc, digits = 2)), adj = 0, nmax.lab = 35, max.strlen = 5, xax.pretty = TRUE, \dots) } \arguments{ \item{x}{an object of class \code{"diana"}, typically created by \code{\link{diana}(.)}.} \item{ask}{logical; if true and \code{which.plots} is \code{NULL}, \code{plot.diana} operates in interactive mode, via \code{\link{menu}}.} \item{which.plots}{integer vector or NULL (default), the latter producing both plots. Otherwise, \code{which.plots} must contain integers of \code{1} for a \emph{banner} plot or \code{2} for a dendrogram or \dQuote{clustering tree}.} \item{main, sub}{main and sub title for the plot, each with a convenient default. See documentation for these arguments in \code{\link{plot.default}}.} \item{adj}{for label adjustment in \code{\link{bannerplot}()}.} \item{nmax.lab}{integer indicating the number of labels which is considered too large for single-name labelling the banner plot.} \item{max.strlen}{positive integer giving the length to which strings are truncated in banner plot labeling.} \item{xax.pretty}{logical or integer indicating if \code{\link{pretty}(*, n = xax.pretty)} should be used for the x axis. \code{xax.pretty = FALSE} is for back compatibility.} \item{\dots}{graphical parameters (see \code{\link{par}}) may also be supplied and are passed to \code{\link{bannerplot}()} or \code{\link{pltree}()}, respectively.} } \section{Side Effects}{ An appropriate plot is produced on the current graphics device. This can be one or both of the following choices: \cr Banner \cr Clustering tree } \details{ When \code{ask = TRUE}, rather than producing each plot sequentially, \code{plot.diana} displays a menu listing all the plots that can be produced. If the menu is not desired but a pause between plots is still wanted one must set \code{par(ask= TRUE)} before invoking the plot command. The banner displays the hierarchy of clusters, and is equivalent to a tree. See Rousseeuw (1986) or chapter 6 of Kaufman and Rousseeuw (1990). The banner plots the diameter of each cluster being splitted. The observations are listed in the order found by the \code{diana} algorithm, and the numbers in the \code{height} vector are represented as bars between the observations. The leaves of the clustering tree are the original observations. A branch splits up at the diameter of the cluster being splitted. } \note{ In the banner plot, observation labels are only printed when the number of observations is limited less than \code{nmax.lab} (35, by default), for readability. Moreover, observation labels are truncated to maximally \code{max.strlen} (5) characters. } \references{see those in \code{\link{plot.agnes}}.} \seealso{ \code{\link{diana}}, \code{\link{diana.object}}, \code{\link{twins.object}}, \code{\link{par}}. } \examples{ example(diana)# -> dv <- diana(....) plot(dv, which.plots = 1, nmax.lab = 100) ## wider labels : op <- par(mar = par("mar") + c(0, 2, 0,0)) plot(dv, which.plots = 1, nmax.lab = 100, max.strlen = 12) par(op) } \keyword{cluster} \keyword{hplot} cluster/man/clara.Rd0000644000176200001440000002304614764134021014066 0ustar liggesusers\name{clara} \alias{clara} \title{Clustering Large Applications} \description{ Computes a \code{"clara"} object, a \code{\link{list}} representing a clustering of the data into \code{k} clusters. } \usage{ clara(x, k, metric = c("euclidean", "manhattan", "jaccard"), stand = FALSE, cluster.only = FALSE, samples = 5, sampsize = min(n, 40 + 2 * k), trace = 0, medoids.x = TRUE, keep.data = medoids.x, rngR = FALSE, pamLike = FALSE, correct.d = TRUE) } \arguments{ \item{x}{ data matrix or data frame, each row corresponds to an observation, and each column corresponds to a variable. All variables must be numeric (or logical). Missing values (NAs) are allowed.} \item{k}{integer, the number of clusters. It is required that \eqn{0 < k < n} where \eqn{n} is the number of observations (i.e., n = \code{nrow(x)}).} \item{metric}{ character string specifying the metric to be used for calculating dissimilarities between observations. The currently available options are "euclidean", "manhattan", "jaccard". % , and "gower". For the latter, see \code{\link{daisy}()}. Euclidean distances are root sum-of-squares of differences, and manhattan distances are the sum of absolute differences. } \item{stand}{logical, indicating if the measurements in \code{x} are standardized before calculating the dissimilarities. Measurements are standardized for each variable (column), by subtracting the variable's mean value and dividing by the variable's mean absolute deviation. } \item{cluster.only}{logical; if true, only the clustering will be computed and returned, see details.} \item{samples}{integer, say \eqn{N}, the number of samples to be drawn from the dataset. The default, \code{N = 5}, is rather small for historical (and now back compatibility) reasons and we \emph{recommend to set \code{samples} an order of magnitude larger}. } \item{sampsize}{integer, say \eqn{j}, the number of observations in each sample. \code{sampsize} should be higher than the number of clusters (\code{k}) and at most the number of observations (\eqn{n =} \code{nrow(x)}). While computational effort is proportional to \eqn{j^2}, see note below, it may still be advisable to set \eqn{j = }\code{sampsize} to a \emph{larger} value than the (historical) default.} \item{trace}{integer indicating a \emph{trace level} for diagnostic output during the algorithm.} \item{medoids.x}{logical indicating if the medoids should be returned, identically to some rows of the input data \code{x}. If \code{FALSE}, \code{keep.data} must be false as well, and the medoid indices, i.e., row numbers of the medoids will still be returned (\code{i.med} component), and the algorithm saves space by needing one copy less of \code{x}.} \item{keep.data}{logical indicating if the (\emph{scaled} if \code{stand} is true) data should be kept in the result. % (\code{keepdata} is equivalent to \code{keep.data} where the former % is deprecated.) Setting this to \code{FALSE} saves memory (and hence time), but disables \code{\link{clusplot}()}ing of the result. Use \code{medoids.x = FALSE} to save even more memory.} \item{rngR}{logical indicating if \R's random number generator should be used instead of the primitive clara()-builtin one. If true, this also means that each call to \code{clara()} returns a different result -- though only slightly different in good situations.} \item{pamLike}{logical indicating if the \dQuote{swap} phase (see \code{\link{pam}}, in C code) should use the same algorithm as \code{\link{pam}()}. Note that from Kaufman and Rousseeuw's description this \emph{should} have been true always, but as the original Fortran code and the subsequent port to C has always contained a small one-letter change (a typo according to Martin Maechler) with respect to PAM, the default, \code{pamLike = FALSE} has been chosen to remain back compatible rather than \dQuote{PAM compatible}.} \item{correct.d}{logical or integer indicating that---only in the case of \code{NA}s present in \code{x}---the correct distance computation should be used instead of the wrong formula which has been present in the original Fortran code and been in use up to early 2016. Because the new correct formula is not back compatible, for the time being, a warning is signalled in this case, unless the user explicitly specifies \code{correct.d}.} } \value{ If \code{cluster.only} is false (as by default), an object of class \code{"clara"} representing the clustering. See \code{\link{clara.object}} for details. If \code{cluster.only} is true, the result is the "clustering", an integer vector of length \eqn{n} with entries from \code{1:k}. } \details{ \code{clara} (for "euclidean" and "manhattan") is fully described in chapter 3 of Kaufman and Rousseeuw (1990). Compared to other partitioning methods such as \code{pam}, it can deal with much larger datasets. Internally, this is achieved by considering sub-datasets of fixed size (\code{sampsize}) such that the time and storage requirements become linear in \eqn{n} rather than quadratic. Each sub-dataset is partitioned into \code{k} clusters using the same algorithm as in \code{\link{pam}}.\cr Once \code{k} representative objects have been selected from the sub-dataset, each observation of the entire dataset is assigned to the nearest medoid. The mean (equivalent to the sum) of the dissimilarities of the observations to their closest medoid is used as a measure of the quality of the clustering. The sub-dataset for which the mean (or sum) is minimal, is retained. A further analysis is carried out on the final partition. Each sub-dataset is forced to contain the medoids obtained from the best sub-dataset until then. Randomly drawn observations are added to this set until \code{sampsize} has been reached. When \code{cluster.only} is true, the result is simply a (possibly named) integer vector specifying the clustering, i.e.,\cr \code{clara(x,k, cluster.only=TRUE)} is the same as \cr \code{clara(x,k)$clustering} but computed more efficiently. } \note{ %% mostly by Martin Maechler : By default, the random sampling is implemented with a \emph{very} simple scheme (with period \eqn{2^{16} = 65536}) inside the Fortran code, independently of \R's random number generation, and as a matter of fact, deterministically. Alternatively, we recommend setting \code{rngR = TRUE} which uses \R's random number generators. Then, \code{clara()} results are made reproducible typically by using \code{\link{set.seed}()} before calling \code{clara}. The storage requirement of \code{clara} computation (for small \code{k}) is about \eqn{O(n \times p) + O(j^2)}{O(n * p) + O(j^2)} where \eqn{j = \code{sampsize}}, and \eqn{(n,p) = \code{dim(x)}}. The CPU computing time (again assuming small \code{k}) is about \eqn{O(n \times p \times j^2 \times N)}{O(n * p * j^2 * N)}, where \eqn{N = \code{samples}}. For \dQuote{small} datasets, the function \code{\link{pam}} can be used directly. What can be considered \emph{small}, is really a function of available computing power, both memory (RAM) and speed. Originally (1990), \dQuote{small} meant less than 100 observations; in 1997, the authors said \emph{\dQuote{small (say with fewer than 200 observations)}}; as of 2006, you can use \code{\link{pam}} with several thousand observations. } \author{ Kaufman and Rousseeuw (see \code{\link{agnes}}), originally. Metric \code{"jaccard"}: Kamil Kozlowski (\code{@ownedoutcomes.com}) and Kamil Jadeszko. All arguments from \code{trace} on, and most \R documentation and all tests by Martin Maechler. %% Kasper Fischer-Rasmussen provided \R and C code for \code{metric = "gower"}. } \seealso{ \code{\link{agnes}} for background and references; \code{\link{clara.object}}, \code{\link{pam}}, \code{\link{partition.object}}, \code{\link{plot.partition}}. } \examples{ ## generate 500 objects, divided into 2 clusters. x <- rbind(cbind(rnorm(200,0,8), rnorm(200,0,8)), cbind(rnorm(300,50,8), rnorm(300,50,8))) clarax <- clara(x, 2, samples=50) clarax clarax$clusinfo ## using pamLike=TRUE gives the same (apart from the 'call'): all.equal(clarax[-8], clara(x, 2, samples=50, pamLike = TRUE)[-8]) plot(clarax) ## cluster.only = TRUE -- save some memory/time : clclus <- clara(x, 2, samples=50, cluster.only = TRUE) stopifnot(identical(clclus, clarax$clustering)) ## 'xclara' is an artificial data set with 3 clusters of 1000 bivariate ## objects each. data(xclara) (clx3 <- clara(xclara, 3)) ## "better" number of samples cl.3 <- clara(xclara, 3, samples=100) ## but that did not change the result here: stopifnot(cl.3$clustering == clx3$clustering) ## Plot similar to Figure 5 in Struyf et al (1996) \dontrun{plot(clx3, ask = TRUE)} \dontshow{plot(clx3)} ## Try 100 times *different* random samples -- for reliability: nSim <- 100 nCl <- 3 # = no.classes set.seed(421)# (reproducibility) cl <- matrix(NA,nrow(xclara), nSim) for(i in 1:nSim) cl[,i] <- clara(xclara, nCl, medoids.x = FALSE, rngR = TRUE)$clustering tcl <- apply(cl,1, tabulate, nbins = nCl) ## those that are not always in same cluster (5 out of 3000 for this seed): (iDoubt <- which(apply(tcl,2, function(n) all(n < nSim)))) if(length(iDoubt)) { # (not for all seeds) tabD <- tcl[,iDoubt, drop=FALSE] dimnames(tabD) <- list(cluster = paste(1:nCl), obs = format(iDoubt)) t(tabD) # how many times in which clusters } }% end{examples} \keyword{cluster} cluster/man/print.mona.Rd0000644000176200001440000000112707351402102015055 0ustar liggesusers\name{print.mona} \alias{print.mona} \title{Print Method for MONA Objects} \description{ Prints the ordering of objects, separation steps, and used variables of a \code{mona} object. This is a method for the function \code{\link{print}()} for objects inheriting from class \code{\link{mona}}. } \usage{ \method{print}{mona}(x, \dots) } \arguments{ \item{x}{a mona object.} \item{\dots}{potential further arguments (require by generic).} } \seealso{ \code{\link{mona}}, \code{\link{mona.object}}, \code{\link{print}}, \code{\link{print.default}}. } \keyword{cluster} \keyword{print} cluster/man/print.dissimilarity.Rd0000644000176200001440000000303210224260017017006 0ustar liggesusers\title{Print and Summary Methods for Dissimilarity Objects} \name{print.dissimilarity} \alias{print.dissimilarity} \alias{summary.dissimilarity} \alias{print.summary.dissimilarity} \description{ Print or summarize the distances and the attributes of a \code{dissimilarity} object. These are methods for the functions \code{print()} and \code{summary()} for \code{dissimilarity} objects. See \code{print}, \code{print.default}, or \code{summary} for the general behavior of these. } \usage{ \method{print}{dissimilarity}(x, diag = NULL, upper = NULL, digits = getOption("digits"), justify = "none", right = TRUE, \dots) \method{summary}{dissimilarity}(object, digits = max(3, getOption("digits") - 2), \dots) \method{print}{summary.dissimilarity}(x, \dots) } \arguments{ \item{x, object}{a \code{dissimilarity} object or a \code{summary.dissimilarity} one for \code{print.summary.dissimilarity()}.} \item{digits}{the number of digits to use, see \code{\link{print.default}}.} \item{diag, upper, justify, right}{optional arguments specifying how the triangular dissimilarity matrix is printed; see \code{\link[stats]{print.dist}}.} \item{\dots}{potential further arguments (require by generic).} } \seealso{ \code{\link{daisy}}, \code{\link{dissimilarity.object}}, \code{\link{print}}, \code{\link{print.default}}, \code{\link{print.dist}}. } \examples{ ## See example(daisy) sd <- summary(daisy(matrix(rnorm(100), 20,5))) sd # -> print.summary.dissimilarity(.) str(sd) } \keyword{cluster} \keyword{print} cluster/man/plantTraits.Rd0000644000176200001440000001075610631261142015307 0ustar liggesusers\name{plantTraits} \alias{plantTraits} \title{Plant Species Traits Data} \docType{data} \encoding{latin1} \description{ This dataset constitutes a description of 136 plant species according to biological attributes (morphological or reproductive) } \usage{data(plantTraits) } \format{ A data frame with 136 observations on the following 31 variables. \describe{ \item{\code{pdias}}{Diaspore mass (mg)} \item{\code{longindex}}{Seed bank longevity} \item{\code{durflow}}{Flowering duration} \item{\code{height}}{Plant height, an ordered factor with levels \code{1} < \code{2} < \dots < \code{8}.} % Plant height}{an ordered factor with levels \code{1} <10cm < \code{2} 10-30cm< \code{3} 30-60cm< \code{4}60-100cm < \code{5}1-3m < \code{6}3-6m < \code{7}:6-15m < \code{8}>15m} \item{\code{begflow}}{Time of first flowering, an ordered factor with levels \code{1} < \code{2} < \code{3} < \code{4} < \code{5} < \code{6} < \code{7} < \code{8} < \code{9}} % {\code{begflow}}{an ordered factor with levels \code{1} january< \code{2} february< \code{3} march< \code{4}april < \code{5} may< \code{6} june< \code{7} july< \code{8}august < \code{9}september} \item{\code{mycor}}{Mycorrhizas, an ordered factor with levels \code{0}never < \code{1} sometimes< \code{2}always} \item{\code{vegaer}}{aerial vegetative propagation, an ordered factor with levels \code{0}never < \code{1} present but limited< \code{2}important.} \item{\code{vegsout}}{underground vegetative propagation, an ordered factor with 3 levels identical to \code{vegaer} above.} \item{\code{autopoll}}{selfing pollination, an ordered factor with levels \code{0}never < \code{1}rare < \code{2} often< the rule\code{3}} \item{\code{insects}}{insect pollination, an ordered factor with 5 levels \code{0} < \dots < \code{4}.} \item{\code{wind}}{wind pollination, an ordered factor with 5 levels \code{0} < \dots < \code{4}.} \item{\code{lign}}{a binary factor with levels \code{0:1}, indicating if plant is woody.} \item{\code{piq}}{a binary factor indicating if plant is thorny.} \item{\code{ros}}{a binary factor indicating if plant is rosette.} \item{\code{semiros}}{semi-rosette plant, a binary factor (\code{0}: no; \code{1}: yes).} \item{\code{leafy}}{leafy plant, a binary factor.} \item{\code{suman}}{summer annual, a binary factor.} \item{\code{winan}}{winter annual, a binary factor.} \item{\code{monocarp}}{monocarpic perennial, a binary factor.} \item{\code{polycarp}}{polycarpic perennial, a binary factor.} \item{\code{seasaes}}{seasonal aestival leaves, a binary factor.} \item{\code{seashiv}}{seasonal hibernal leaves, a binary factor.} \item{\code{seasver}}{seasonal vernal leaves, a binary factor.} \item{\code{everalw}}{leaves always evergreen, a binary factor.} \item{\code{everparti}}{leaves partially evergreen, a binary factor.} \item{\code{elaio}}{fruits with an elaiosome (dispersed by ants), a binary factor.} \item{\code{endozoo}}{endozoochorous fruits, a binary factor.} \item{\code{epizoo}}{epizoochorous fruits, a binary factor.} \item{\code{aquat}}{aquatic dispersal fruits, a binary factor.} \item{\code{windgl}}{wind dispersed fruits, a binary factor.} \item{\code{unsp}}{unspecialized mechanism of seed dispersal, a binary factor.} } } \details{ Most of factor attributes are not disjunctive. For example, a plant can be usually pollinated by insects but sometimes self-pollination can occured. } \source{ Vallet, Jeanne (2005) \emph{Structuration de communautés végétales et analyse comparative de traits biologiques le long d'un gradient d'urbanisation}. Mémoire de Master 2 'Ecologie-Biodiversité-Evolution'; Université Paris Sud XI, 30p.+ annexes (in french) } % \references{ % ~~ possibly secondary sources and usages ~~ % } \examples{ data(plantTraits) ## Calculation of a dissimilarity matrix library(cluster) dai.b <- daisy(plantTraits, type = list(ordratio = 4:11, symm = 12:13, asymm = 14:31)) ## Hierarchical classification agn.trts <- agnes(dai.b, method="ward") plot(agn.trts, which.plots = 2, cex= 0.6) plot(agn.trts, which.plots = 1) cutree6 <- cutree(agn.trts, k=6) cutree6 ## Principal Coordinate Analysis cmdsdai.b <- cmdscale(dai.b, k=6) plot(cmdsdai.b[, 1:2], asp = 1, col = cutree6) } \keyword{datasets} % plant attribute database, mixed type variables, dissimilarity matrix (DAISY), Hierarchical Classification (AGNES) % Principal Coordinates Analysis (CMDSCALE) cluster/man/chorSub.Rd0000644000176200001440000000165610417224251014410 0ustar liggesusers\name{chorSub} \alias{chorSub} \docType{data} \title{Subset of C-horizon of Kola Data} \description{ This is a small rounded subset of the C-horizon data \code{\link[mvoutlier]{chorizon}} from package \pkg{mvoutlier}. } \usage{data(chorSub)} \format{ A data frame with 61 observations on 10 variables. The variables contain scaled concentrations of chemical elements. } \details{ This data set was produced from \code{chorizon} via these statements: \preformatted{ data(chorizon, package = "mvoutlier") chorSub <- round(100*scale(chorizon[,101:110]))[190:250,] storage.mode(chorSub) <- "integer" colnames(chorSub) <- gsub("_.*", '', colnames(chorSub)) } } \source{Kola Project (1993-1998) } \seealso{ \code{\link[mvoutlier]{chorizon}} in package \pkg{mvoutlier} and other Kola data in the same package. } \examples{ data(chorSub) summary(chorSub) pairs(chorSub, gap= .1)# some outliers } \keyword{datasets} cluster/man/dissimilarity.object.Rd0000644000176200001440000000512414236220300017122 0ustar liggesusers\name{dissimilarity.object} \alias{dissimilarity.object} \title{Dissimilarity Matrix Object} \description{ Objects of class \code{"dissimilarity"} representing the dissimilarity matrix of a dataset. } \section{GENERATION}{ \code{\link{daisy}} returns this class of objects. Also the functions \code{pam}, \code{clara}, \code{fanny}, \code{agnes}, and \code{diana} return a \code{dissimilarity} object, as one component of their return objects. } \section{METHODS}{ The \code{"dissimilarity"} class has methods for the following generic functions: \code{print}, \code{summary}. } \value{ The dissimilarity matrix is symmetric, and hence its lower triangle (column wise) is represented as a vector to save storage space. If the object, is called \code{do}, and \code{n} the number of observations, i.e., \code{n <- attr(do, "Size")}, then for \eqn{i < j <= n}, the dissimilarity between (row) i and j is \code{do[n*(i-1) - i*(i-1)/2 + j-i]}. The length of the vector is \eqn{n*(n-1)/2}, i.e., of order \eqn{n^2}. \code{"dissimilarity"} objects also inherit from class \code{\link{dist}} and can use \code{dist} methods, in particular, \code{\link{as.matrix}}, such that \eqn{d_{ij}}{d(i,j)} from above is just \code{as.matrix(do)[i,j]}. The object has the following attributes: \item{Size}{the number of observations in the dataset.} \item{Metric}{the metric used for calculating the dissimilarities. Possible values are "euclidean", "manhattan", "mixed" (if variables of different types were present in the dataset), and "unspecified".} \item{Labels}{optionally, contains the labels, if any, of the observations of the dataset.} \item{NA.message}{optionally, if a dissimilarity could not be computed, because of too many missing values for some observations of the dataset.} \item{Types}{when a mixed metric was used, the types for each variable as one-letter codes, see also \code{type} in \code{\link{daisy}()}: % that was confusing with its "T": (as in the book, e.g. p.54): \describe{ \item{\code{A}: }{Asymmetric binary} \item{\code{S}: }{Symmetric binary} \item{\code{N}: }{Nominal (factor)} \item{\code{O}: }{Ordinal (ordered factor)} \item{\code{I}: }{Interval scaled, possibly after log transform \code{"logratio"} (numeric)} \item{\code{T}: }{ra\bold{T}io treated as \code{\link{ordered}}} }} } \seealso{ \code{\link{daisy}}, \code{\link{dist}}, \code{\link{pam}}, \code{\link{clara}}, \code{\link{fanny}}, \code{\link{agnes}}, \code{\link{diana}}. } %\examples{} --> ./daisy.Rd \keyword{cluster} cluster/man/fanny.object.Rd0000644000176200001440000000533310500041124015344 0ustar liggesusers\name{fanny.object} \alias{fanny.object} \title{Fuzzy Analysis (FANNY) Object} \description{ The objects of class \code{"fanny"} represent a fuzzy clustering of a dataset. } \section{GENERATION}{ These objects are returned from \code{\link{fanny}}. } \section{METHODS}{ The \code{"fanny"} class has methods for the following generic functions: \code{print}, \code{summary}. } \section{INHERITANCE}{ The class \code{"fanny"} inherits from \code{"partition"}. Therefore, the generic functions \code{plot} and \code{clusplot} can be used on a \code{fanny} object. } \value{ A legitimate \code{fanny} object is a list with the following components: \item{membership}{ matrix containing the memberships for each pair consisting of an observation and a cluster. } \item{memb.exp}{the membership exponent used in the fitting criterion.} \item{coeff}{ Dunn's partition coefficient \eqn{F(k)} of the clustering, where \eqn{k} is the number of clusters. \eqn{F(k)} is the sum of all \emph{squared} membership coefficients, divided by the number of observations. Its value is between \eqn{1/k} and 1. The normalized form of the coefficient is also given. It is defined as \eqn{(F(k) - 1/k) / (1 - 1/k)}, and ranges between 0 and 1. A low value of Dunn's coefficient indicates a very fuzzy clustering, whereas a value close to 1 indicates a near-crisp clustering. } \item{clustering}{ the clustering vector of the nearest crisp clustering, see \code{\link{partition.object}}.} \item{k.crisp}{integer (\eqn{\le k}{<= k}) giving the number of \emph{crisp} clusters; can be less than \eqn{k}, where it's recommended to decrease \code{memb.exp}.} \item{objective}{ named vector containing the minimal value of the objective function reached by the FANNY algorithm and the relative convergence tolerance \code{tol} used.% + still has 'iterations' for back-compatibility } \item{convergence}{ named vector with \code{iterations}, the number of iterations needed and \code{converged} indicating if the algorithm converged (in \code{maxit} iterations within convergence tolerance \code{tol}). } \item{diss}{ an object of class \code{"dissimilarity"}, see \code{\link{partition.object}}.} \item{call}{generating call, see \code{\link{partition.object}}.} \item{silinfo}{ list with silhouette information of the nearest crisp clustering, see \code{\link{partition.object}}.} \item{data}{matrix, possibibly standardized, or NULL, see \code{\link{partition.object}}.} } \seealso{ \code{\link{fanny}}, \code{\link{print.fanny}}, \code{\link{dissimilarity.object}}, \code{\link{partition.object}}, \code{\link{plot.partition}}. } \keyword{cluster} cluster/man/mona.object.Rd0000644000176200001440000000276107554320503015205 0ustar liggesusers\name{mona.object} \alias{mona.object} \title{Monothetic Analysis (MONA) Object} \description{ The objects of class \code{"mona"} represent the divisive hierarchical clustering of a dataset with only binary variables (measurements). This class of objects is returned from \code{\link{mona}}. } \section{METHODS}{ The \code{"mona"} class has methods for the following generic functions: \code{print}, \code{summary}, \code{plot}. } \value{ A legitimate \code{mona} object is a list with the following components: \item{data}{ matrix with the same dimensions as the original data matrix, but with factors coded as 0 and 1, and all missing values replaced. } \item{order}{ a vector giving a permutation of the original observations to allow for plotting, in the sense that the branches of a clustering tree will not cross. } \item{order.lab}{ a vector similar to \code{order}, but containing observation labels instead of observation numbers. This component is only available if the original observations were labelled. } \item{variable}{ vector of length n-1 where n is the number of observations, specifying the variables used to separate the observations of \code{order}. } \item{step}{ vector of length n-1 where n is the number of observations, specifying the separation steps at which the observations of \code{order} are separated. } } \seealso{\code{\link{mona}} for examples etc, \code{\link{plot.mona}}. } \keyword{cluster} cluster/man/clusplot.default.Rd0000644000176200001440000002712014277707561016307 0ustar liggesusers\name{clusplot.default} \alias{clusplot.default} \title{Bivariate Cluster Plot (clusplot) Default Method} \description{ Creates a bivariate plot visualizing a partition (clustering) of the data. All observation are represented by points in the plot, using principal components or multidimensional scaling. Around each cluster an ellipse is drawn. } \usage{ \method{clusplot}{default}(x, clus, diss = FALSE, s.x.2d = mkCheckX(x, diss), stand = FALSE, lines = 2, shade = FALSE, color = FALSE, labels= 0, plotchar = TRUE, col.p = "dark green", col.txt = col.p, col.clus = if(color) c(2, 4, 6, 3) else 5, cex = 1, cex.txt = cex, span = TRUE, add = FALSE, xlim = NULL, ylim = NULL, main = paste("CLUSPLOT(", deparse1(substitute(x)),")"), sub = paste("These two components explain", round(100 * var.dec, digits = 2), "\% of the point variability."), xlab = "Component 1", ylab = "Component 2", verbose = getOption("verbose"), \dots) } \arguments{ \item{x}{matrix or data frame, or dissimilarity matrix, depending on the value of the \code{diss} argument. In case of a matrix (alike), each row corresponds to an observation, and each column corresponds to a variable. All variables must be numeric. Missing values (\code{\link{NA}}s) are allowed. They are replaced by the median of the corresponding variable. When some variables or some observations contain only missing values, the function stops with a warning message. In case of a dissimilarity matrix, \code{x} is the output of \code{\link{daisy}} or \code{\link{dist}} or a symmetric matrix. Also, a vector of length \eqn{n*(n-1)/2} is allowed (where \eqn{n} is the number of observations), and will be interpreted in the same way as the output of the above-mentioned functions. Missing values (NAs) are not allowed. } \item{clus}{ a vector of length n representing a clustering of \code{x}. For each observation the vector lists the number or name of the cluster to which it has been assigned. \code{clus} is often the clustering component of the output of \code{\link{pam}}, \code{\link{fanny}} or \code{\link{clara}}.} \item{diss}{ logical indicating if \code{x} will be considered as a dissimilarity matrix or a matrix of observations by variables (see \code{x} arugment above).} \item{s.x.2d}{a \code{\link{list}} with components named \code{x} (a \eqn{n \times 2}{n x 2} matrix; typically something like principal components of original data), \code{labs} and \code{var.dec}.}% FIXME: 'labs' and 'var.dec' are not always needed \item{stand}{ logical flag: if true, then the representations of the n observations in the 2-dimensional plot are standardized. } \item{lines}{ integer out of \code{0, 1, 2}, used to obtain an idea of the distances between ellipses. The distance between two ellipses E1 and E2 is measured along the line connecting the centers \eqn{m1} and \eqn{m2} of the two ellipses. In case E1 and E2 overlap on the line through \eqn{m1} and \eqn{m2}, no line is drawn. Otherwise, the result depends on the value of \code{lines}: If \describe{ \item{lines = 0,}{no distance lines will appear on the plot;} \item{lines = 1,}{the line segment between \eqn{m1} and \eqn{m2} is drawn;} \item{lines = 2,}{a line segment between the boundaries of E1 and E2 is drawn (along the line connecting \eqn{m1} and \eqn{m2}).} } } \item{shade}{ logical flag: if TRUE, then the ellipses are shaded in relation to their density. The density is the number of points in the cluster divided by the area of the ellipse. } \item{color}{ logical flag: if TRUE, then the ellipses are colored with respect to their density. With increasing density, the colors are light blue, light green, red and purple. To see these colors on the graphics device, an appropriate color scheme should be selected (we recommend a white background).} \item{labels}{ integer code, currently one of 0,1,2,3,4 and 5. If \describe{ \item{labels= 0,}{no labels are placed in the plot;} \item{labels= 1,}{points and ellipses can be identified in the plot (see \code{\link{identify}});} \item{labels= 2,}{all points and ellipses are labelled in the plot;} \item{labels= 3,}{only the points are labelled in the plot;} \item{labels= 4,}{only the ellipses are labelled in the plot.} \item{labels= 5,}{the ellipses are labelled in the plot, and points can be identified.} } The levels of the vector \code{clus} are taken as labels for the clusters. The labels of the points are the rownames of \code{x} if \code{x} is matrix like. Otherwise (\code{diss = TRUE}), \code{x} is a vector, point labels can be attached to \code{x} as a "Labels" attribute (\code{attr(x,"Labels")}), as is done for the output of \code{\link{daisy}}. A possible \code{\link{names}} attribute of \code{clus} will not be taken into account. } \item{plotchar}{ logical flag: if TRUE, then the plotting symbols differ for points belonging to different clusters. } \item{span}{ logical flag: if TRUE, then each cluster is represented by the ellipse with smallest area containing all its points. (This is a special case of the minimum volume ellipsoid.)\cr If FALSE, the ellipse is based on the mean and covariance matrix of the same points. While this is faster to compute, it often yields a much larger ellipse. There are also some special cases: When a cluster consists of only one point, a tiny circle is drawn around it. When the points of a cluster fall on a straight line, \code{span=FALSE} draws a narrow ellipse around it and \code{span=TRUE} gives the exact line segment. } \item{add}{logical indicating if ellipses (and labels if \code{labels} is true) should be \emph{added} to an already existing plot. If false, neither a \code{\link{title}} or sub title, see \code{sub}, is written.} \item{col.p}{color code(s) used for the observation points.} \item{col.txt}{color code(s) used for the labels (if \code{labels >= 2}).} \item{col.clus}{color code for the ellipses (and their labels); only one if color is false (as per default).} \item{cex, cex.txt}{character \bold{ex}pansion (size), for the point symbols and point labels, respectively.} \item{xlim, ylim}{numeric vectors of length 2, giving the x- and y- ranges as in \code{\link{plot.default}}.} \item{main}{main title for the plot; by default, one is constructed.} \item{sub}{sub title for the plot; by default, one is constructed.} \item{xlab, ylab}{x- and y- axis labels for the plot, with defaults.} \item{verbose}{a logical indicating, if there should be extra diagnostic output; mainly for \sQuote{debugging}.} \item{\dots}{Further graphical parameters may also be supplied, see \code{\link{par}}.} }% End Arguments \value{ An invisible list with components: \item{Distances}{ When \code{lines} is 1 or 2 we optain a k by k matrix (k is the number of clusters). The element in \code{[i,j]} is the distance between ellipse i and ellipse j.\cr If \code{lines = 0}, then the value of this component is \code{NA}. } \item{Shading}{ A vector of length k (where k is the number of clusters), containing the amount of shading per cluster. Let y be a vector where element i is the ratio between the number of points in cluster i and the area of ellipse i. When the cluster i is a line segment, y[i] and the density of the cluster are set to \code{NA}. Let z be the sum of all the elements of y without the NAs. Then we put shading = y/z *37 + 3 . } } \section{Side Effects}{ a visual display of the clustering is plotted on the current graphics device. } \details{ \code{clusplot} uses function calls \code{\link{princomp}(*, cor = (ncol(x) > 2))} or \code{\link{cmdscale}(*, add=TRUE)}, respectively, depending on \code{diss} being false or true. These functions are data reduction techniques to represent the data in a bivariate plot. Ellipses are then drawn to indicate the clusters. The further layout of the plot is determined by the optional arguments. } \note{ When we have 4 or fewer clusters, then the \code{color=TRUE} gives every cluster a different color. When there are more than 4 clusters, clusplot uses the function \code{\link{pam}} to cluster the densities into 4 groups such that ellipses with nearly the same density get the same color. \code{col.clus} specifies the colors used. The \code{col.p} and \code{col.txt} arguments, added for \R, are recycled to have length the number of observations. If \code{col.p} has more than one value, using \code{color = TRUE} can be confusing because of a mix of point and ellipse colors. } \references{ Pison, G., Struyf, A. and Rousseeuw, P.J. (1999) Displaying a Clustering with CLUSPLOT, \emph{Computational Statistics and Data Analysis}, \bold{30}, 381--392.\cr %% Jan.2015 : no longer there: %% A version of this is available as technical report from %% \url{http://www.agoras.ua.ac.be/abstract/Disclu99.htm} Kaufman, L. and Rousseeuw, P.J. (1990). \emph{Finding Groups in Data: An Introduction to Cluster Analysis.} Wiley, New York. Struyf, A., Hubert, M. and Rousseeuw, P.J. (1997). Integrating Robust Clustering Techniques in S-PLUS, \emph{Computational Statistics and Data Analysis}, \bold{26}, 17-37. } \seealso{ \code{\link{princomp}}, \code{\link{cmdscale}}, \code{\link{pam}}, \code{\link{clara}}, \code{\link{daisy}}, \code{\link{par}}, \code{\link{identify}}, \code{\link[MASS]{cov.mve}}, \code{\link{clusplot.partition}}. } \examples{ ## plotting votes.diss(dissimilarity) in a bivariate plot and ## partitioning into 2 clusters data(votes.repub) votes.diss <- daisy(votes.repub) pamv <- pam(votes.diss, 2, diss = TRUE) clusplot(pamv, shade = TRUE) ## is the same as votes.clus <- pamv$clustering clusplot(votes.diss, votes.clus, diss = TRUE, shade = TRUE) ## Now look at components 3 and 2 instead of 1 and 2: str(cMDS <- cmdscale(votes.diss, k=3, add=TRUE)) clusplot(pamv, s.x.2d = list(x=cMDS$points[, c(3,2)], labs=rownames(votes.repub), var.dec=NA), shade = TRUE, col.p = votes.clus, sub="", xlab = "Component 3", ylab = "Component 2") clusplot(pamv, col.p = votes.clus, labels = 4)# color points and label ellipses # "simple" cheap ellipses: larger than minimum volume: # here they are *added* to the previous plot: clusplot(pamv, span = FALSE, add = TRUE, col.clus = "midnightblue") ## Setting a small *label* size: clusplot(votes.diss, votes.clus, diss = TRUE, labels = 3, cex.txt = 0.6) if(dev.interactive()) { # uses identify() *interactively* : clusplot(votes.diss, votes.clus, diss = TRUE, shade = TRUE, labels = 1) clusplot(votes.diss, votes.clus, diss = TRUE, labels = 5)# ident. only points } ## plotting iris (data frame) in a 2-dimensional plot and partitioning ## into 3 clusters. data(iris) iris.x <- iris[, 1:4] cl3 <- pam(iris.x, 3)$clustering op <- par(mfrow= c(2,2)) clusplot(iris.x, cl3, color = TRUE) U <- par("usr") ## zoom in : rect(0,-1, 2,1, border = "orange", lwd=2) clusplot(iris.x, cl3, color = TRUE, xlim = c(0,2), ylim = c(-1,1)) box(col="orange",lwd=2); mtext("sub region", font = 4, cex = 2) ## or zoom out : clusplot(iris.x, cl3, color = TRUE, xlim = c(-4,4), ylim = c(-4,4)) mtext("'super' region", font = 4, cex = 2) rect(U[1],U[3], U[2],U[4], lwd=2, lty = 3) # reset graphics par(op) } \keyword{cluster} \keyword{hplot} cluster/man/predict.ellipsoid.Rd0000644000176200001440000000420213467043363016421 0ustar liggesusers\name{predict.ellipsoid} \alias{predict.ellipsoid} \alias{ellipsoidPoints} \title{Predict Method for Ellipsoid Objects} \description{ Compute points on the ellipsoid boundary, mostly for drawing. } \usage{ % method *and* stand alone function on purpose : predict.ellipsoid(object, n.out=201, \dots) \method{predict}{ellipsoid}(object, n.out=201, \dots) ellipsoidPoints(A, d2, loc, n.half = 201) } \arguments{ \item{object}{an object of class \code{ellipsoid}, typically from \code{\link{ellipsoidhull}()}; alternatively any list-like object with proper components, see details below.} \item{n.out, n.half}{half the number of points to create.} \item{A, d2, loc}{arguments of the auxilary \code{ellipsoidPoints}, see below.} \item{\dots}{passed to and from methods.} } \details{ Note \code{ellipsoidPoints} is the workhorse function of \code{predict.ellipsoid} a standalone function and method for \code{ellipsoid} objects, see \code{\link{ellipsoidhull}}. The class of \code{object} is not checked; it must solely have valid components \code{loc} (length \eqn{p}), the \eqn{p \times p}{p x p} matrix \code{cov} (corresponding to \code{A}) and \code{d2} for the center, the shape (\dQuote{covariance}) matrix and the squared average radius (or distance) or \code{\link{qchisq}(*, p)} quantile. Unfortunately, this is only implemented for \eqn{p = 2}, currently; contributions for \eqn{p \ge 3}{p >= 3} are \emph{very welcome}. } \value{ a numeric matrix of dimension \code{2*n.out} times \eqn{p}. } \seealso{\code{\link{ellipsoidhull}}, \code{\link{volume.ellipsoid}}. } \examples{ ## see also example(ellipsoidhull) ## Robust vs. L.S. covariance matrix set.seed(143) x <- rt(200, df=3) y <- 3*x + rt(200, df=2) plot(x,y, main="non-normal data (N=200)") mtext("with classical and robust cov.matrix ellipsoids") X <- cbind(x,y) C.ls <- cov(X) ; m.ls <- colMeans(X) d2.99 <- qchisq(0.99, df = 2) lines(ellipsoidPoints(C.ls, d2.99, loc=m.ls), col="green") if(require(MASS)) { Cxy <- cov.rob(cbind(x,y)) lines(ellipsoidPoints(Cxy$cov, d2 = d2.99, loc=Cxy$center), col="red") }# MASS } \keyword{dplot} \keyword{utilities} cluster/man/summary.agnes.Rd0000644000176200001440000000122013467043363015572 0ustar liggesusers\name{summary.agnes} \alias{summary.agnes} \alias{print.summary.agnes} \title{Summary Method for 'agnes' Objects} \description{ Returns (and prints) a summary list for an \code{agnes} object. Printing gives more output than the corresponding \code{\link{print.agnes}} method. } \usage{ \method{summary}{agnes}(object, \dots) \method{print}{summary.agnes}(x, \dots) } \arguments{ \item{x, object}{a \code{\link{agnes}} object.} \item{\dots}{potential further arguments (require by generic).} } \seealso{\code{\link{agnes}}, \code{\link{agnes.object}}.} \examples{ data(agriculture) summary(agnes(agriculture)) } \keyword{cluster} \keyword{print} cluster/man/fanny.Rd0000644000176200001440000001521612710360667014125 0ustar liggesusers\name{fanny} \alias{fanny} \title{Fuzzy Analysis Clustering} \description{ Computes a fuzzy clustering of the data into \code{k} clusters. } \usage{ fanny(x, k, diss = inherits(x, "dist"), memb.exp = 2, metric = c("euclidean", "manhattan", "SqEuclidean"), stand = FALSE, iniMem.p = NULL, cluster.only = FALSE, keep.diss = !diss && !cluster.only && n < 100, keep.data = !diss && !cluster.only, maxit = 500, tol = 1e-15, trace.lev = 0) } \arguments{ \item{x}{ data matrix or data frame, or dissimilarity matrix, depending on the value of the \code{diss} argument. In case of a matrix or data frame, each row corresponds to an observation, and each column corresponds to a variable. All variables must be numeric. Missing values (NAs) are allowed. In case of a dissimilarity matrix, \code{x} is typically the output of \code{\link{daisy}} or \code{\link{dist}}. Also a vector of length n*(n-1)/2 is allowed (where n is the number of observations), and will be interpreted in the same way as the output of the above-mentioned functions. Missing values (NAs) are not allowed. } \item{k}{integer giving the desired number of clusters. It is required that \eqn{0 < k < n/2} where \eqn{n} is the number of observations.} \item{diss}{ logical flag: if TRUE (default for \code{dist} or \code{dissimilarity} objects), then \code{x} is assumed to be a dissimilarity matrix. If FALSE, then \code{x} is treated as a matrix of observations by variables. } \item{memb.exp}{number \eqn{r} strictly larger than 1 specifying the \emph{membership exponent} used in the fit criterion; see the \sQuote{Details} below. Default: \code{2} which used to be hardwired inside FANNY.} \item{metric}{character string specifying the metric to be used for calculating dissimilarities between observations. Options are \code{"euclidean"} (default), \code{"manhattan"}, and \code{"SqEuclidean"}. Euclidean distances are root sum-of-squares of differences, and manhattan distances are the sum of absolute differences, and \code{"SqEuclidean"}, the \emph{squared} euclidean distances are sum-of-squares of differences. Using this last option is equivalent (but somewhat slower) to computing so called \dQuote{fuzzy C-means}. \cr If \code{x} is already a dissimilarity matrix, then this argument will be ignored. } \item{stand}{logical; if true, the measurements in \code{x} are standardized before calculating the dissimilarities. Measurements are standardized for each variable (column), by subtracting the variable's mean value and dividing by the variable's mean absolute deviation. If \code{x} is already a dissimilarity matrix, then this argument will be ignored.} \item{iniMem.p}{numeric \eqn{n \times k}{n x k} matrix or \code{NULL} (by default); can be used to specify a starting \code{membership} matrix, i.e., a matrix of non-negative numbers, each row summing to one. } %% FIXME: add example \item{cluster.only}{logical; if true, no silhouette information will be computed and returned, see details.}%% FIXME: add example \item{keep.diss, keep.data}{logicals indicating if the dissimilarities and/or input data \code{x} should be kept in the result. Setting these to \code{FALSE} can give smaller results and hence also save memory allocation \emph{time}.} \item{maxit, tol}{maximal number of iterations and default tolerance for convergence (relative convergence of the fit criterion) for the FANNY algorithm. The defaults \code{maxit = 500} and \code{tol = 1e-15} used to be hardwired inside the algorithm.} \item{trace.lev}{integer specifying a trace level for printing diagnostics during the C-internal algorithm. Default \code{0} does not print anything; higher values print increasingly more.} } \value{ an object of class \code{"fanny"} representing the clustering. See \code{\link{fanny.object}} for details. } \details{ In a fuzzy clustering, each observation is \dQuote{spread out} over the various clusters. Denote by \eqn{u_{iv}}{u(i,v)} the membership of observation \eqn{i} to cluster \eqn{v}. The memberships are nonnegative, and for a fixed observation i they sum to 1. The particular method \code{fanny} stems from chapter 4 of Kaufman and Rousseeuw (1990) (see the references in \code{\link{daisy}}) and has been extended by Martin Maechler to allow user specified \code{memb.exp}, \code{iniMem.p}, \code{maxit}, \code{tol}, etc. Fanny aims to minimize the objective function \deqn{\sum_{v=1}^k \frac{\sum_{i=1}^n\sum_{j=1}^n u_{iv}^r u_{jv}^r d(i,j)}{ 2 \sum_{j=1}^n u_{jv}^r}}{% SUM_[v=1..k] (SUM_(i,j) u(i,v)^r u(j,v)^r d(i,j)) / (2 SUM_j u(j,v)^r)} where \eqn{n} is the number of observations, \eqn{k} is the number of clusters, \eqn{r} is the membership exponent \code{memb.exp} and \eqn{d(i,j)} is the dissimilarity between observations \eqn{i} and \eqn{j}. \cr Note that \eqn{r \to 1}{r -> 1} gives increasingly crisper clusterings whereas \eqn{r \to \infty}{r -> Inf} leads to complete fuzzyness. K&R(1990), p.191 note that values too close to 1 can lead to slow convergence. Further note that even the default, \eqn{r = 2} can lead to complete fuzzyness, i.e., memberships \eqn{u_{iv} \equiv 1/k}{u(i,v) == 1/k}. In that case a warning is signalled and the user is advised to chose a smaller \code{memb.exp} (\eqn{=r}). Compared to other fuzzy clustering methods, \code{fanny} has the following features: (a) it also accepts a dissimilarity matrix; (b) it is more robust to the \code{spherical cluster} assumption; (c) it provides a novel graphical display, the silhouette plot (see \code{\link{plot.partition}}). } \seealso{ \code{\link{agnes}} for background and references; \code{\link{fanny.object}}, \code{\link{partition.object}}, \code{\link{plot.partition}}, \code{\link{daisy}}, \code{\link{dist}}. } \examples{ ## generate 10+15 objects in two clusters, plus 3 objects lying ## between those clusters. x <- rbind(cbind(rnorm(10, 0, 0.5), rnorm(10, 0, 0.5)), cbind(rnorm(15, 5, 0.5), rnorm(15, 5, 0.5)), cbind(rnorm( 3,3.2,0.5), rnorm( 3,3.2,0.5))) fannyx <- fanny(x, 2) ## Note that observations 26:28 are "fuzzy" (closer to # 2): fannyx summary(fannyx) plot(fannyx) (fan.x.15 <- fanny(x, 2, memb.exp = 1.5)) # 'crispier' for obs. 26:28 (fanny(x, 2, memb.exp = 3)) # more fuzzy in general data(ruspini) f4 <- fanny(ruspini, 4) stopifnot(rle(f4$clustering)$lengths == c(20,23,17,15)) plot(f4, which = 1) ## Plot similar to Figure 6 in Stryuf et al (1996) plot(fanny(ruspini, 5)) } \keyword{cluster} cluster/DESCRIPTION0000644000176200001440000000550014764341102013443 0ustar liggesusersPackage: cluster Version: 2.1.8.1 VersionNote: Last CRAN: 2.1.8 on 2024-12-10; 2.1.7 on 2024-12-06; 2.1.6 on 2023-11-30; 2.1.5 on 2023-11-27 Date: 2025-03-11 Priority: recommended Title: "Finding Groups in Data": Cluster Analysis Extended Rousseeuw et al. Description: Methods for Cluster analysis. Much extended the original from Peter Rousseeuw, Anja Struyf and Mia Hubert, based on Kaufman and Rousseeuw (1990) "Finding Groups in Data". Maintainer: Martin Maechler Authors@R: c(person("Martin","Maechler", role = c("aut","cre"), email="maechler@stat.math.ethz.ch", comment = c(ORCID = "0000-0002-8685-9910")) ,person("Peter", "Rousseeuw", role="aut", email="peter.rousseeuw@kuleuven.be", comment = c("Fortran original", ORCID = "0000-0002-3807-5353")) ,person("Anja", "Struyf", role="aut", comment= "S original") ,person("Mia", "Hubert", role="aut", email= "Mia.Hubert@uia.ua.ac.be", comment = c("S original", ORCID = "0000-0001-6398-4850")) ,person("Kurt", "Hornik", role=c("trl", "ctb"), email="Kurt.Hornik@R-project.org", comment=c("port to R; maintenance(1999-2000)", ORCID="0000-0003-4198-9911")) ,person("Matthias", "Studer", role="ctb") ,person("Pierre", "Roudier", role="ctb") ,person("Juan", "Gonzalez", role="ctb") ,person("Kamil", "Kozlowski", role="ctb") ,person("Erich", "Schubert", role="ctb", comment = c("fastpam options for pam()", ORCID = "0000-0001-9143-4880")) ,person("Keefe", "Murphy", role="ctb", comment = "volume.ellipsoid({d >= 3})") #not yet ,person("Fischer-Rasmussen", "Kasper", role = "ctb", comment = "Gower distance for CLARA") ) Depends: R (>= 3.5.0) Imports: graphics, grDevices, stats, utils Suggests: MASS, Matrix SuggestsNote: MASS: two examples using cov.rob() and mvrnorm(); Matrix tools for testing Enhances: mvoutlier, fpc, ellipse, sfsmisc EnhancesNote: xref-ed in man/*.Rd LazyLoad: yes LazyData: yes ByteCompile: yes BuildResaveData: no License: GPL (>= 2) URL: https://svn.r-project.org/R-packages/trunk/cluster/ NeedsCompilation: yes Packaged: 2025-03-11 22:34:24 UTC; maechler Author: Martin Maechler [aut, cre] (), Peter Rousseeuw [aut] (Fortran original, ), Anja Struyf [aut] (S original), Mia Hubert [aut] (S original, ), Kurt Hornik [trl, ctb] (port to R; maintenance(1999-2000), ), Matthias Studer [ctb], Pierre Roudier [ctb], Juan Gonzalez [ctb], Kamil Kozlowski [ctb], Erich Schubert [ctb] (fastpam options for pam(), ), Keefe Murphy [ctb] (volume.ellipsoid({d >= 3})) Repository: CRAN Date/Publication: 2025-03-12 17:20:02 UTC