# Re: [R] Output of silhouette (cluster package)

From: Martin Maechler <maechler_at_stat.math.ethz.ch>
Date: Sun, 15 Jun 2008 01:19:24 +0200

>>>>> "CV" == Cristiano Varin <cristiano.varin_at_mac.com> >>>>> on Fri, 13 Jun 2008 11:31:34 +0200 writes:

CV> Dear R users, I am mailing you about the graphical     CV> output of silhouette (cluster package)

CV> From the example of silhouette in help(silhouette):

>> ar <- agnes(ruspini)
>> si3 <- silhouette(cutree(ar, k = 5), # k = 4 gave the same as pam() above

```    CV> +                    daisy(ruspini))
```

>> plot(si3, nmax = 80, cex.names = 0.5)
```    CV> from which one may conclude that group 1 is composed by units from 1
CV> to 20, group 2 by units from 21 to 43, group 3 by units from 44 to 57,
CV> group 4 by units from 58 to 60 and, finally, group 5 by units from 61
CV> to 75.

CV> However, this seems to be in contrast with the output of silhouette
```
CV> where the fourth group is composed by units from 46 to 48 instead of     CV> units from 58 to 60 (belonging to the third cluster), see

You are right.
Indeed, I see that this has been a bug in sortSilhouette() ever since that had been introduced in 2002.

It will be fixed in cluster_1.11.11

Martin Maechler, ETH Zurich

>> si3

```    CV> cluster neighbor   sil_width
CV> [1,]       1        5 0.679838078
CV> [2,]       1        5 0.745615002
CV> [3,]       1        5 0.758796123
CV> [4,]       1        4 0.715554768
CV> [5,]       1        5 0.664657114
CV> [6,]       1        4 0.783993831
CV> [7,]       1        2 0.590057470
CV> [8,]       1        4 0.747969458
CV> [9,]       1        5 0.792304760
CV> [10,]       1        4 0.803547635
CV> [11,]       1        4 0.742402051
CV> [12,]       1        4 0.722302731
CV> [13,]       1        4 0.665412622
CV> [14,]       1        5 0.756910666
CV> [15,]       1        5 0.700685403
CV> [16,]       1        5 0.743601834
CV> [17,]       1        5 0.614854124
CV> [18,]       1        5 0.708007860
CV> [19,]       1        5 0.700093839
CV> [20,]       1        4 0.568989067
CV> [21,]       2        4 0.751866935
CV> [22,]       2        4 0.790783667
CV> [23,]       2        4 0.802659788
CV> [24,]       2        4 0.785895823
CV> [25,]       2        4 0.822943473
CV> [26,]       2        4 0.831313347
CV> [27,]       2        4 0.818043337
CV> [28,]       2        4 0.805454305
CV> [29,]       2        4 0.770547118
CV> [30,]       2        4 0.768289979
CV> [31,]       2        3 0.794485567
CV> [32,]       2        4 0.829925955
CV> [33,]       2        4 0.807379640
CV> [34,]       2        4 0.790626589
CV> [35,]       2        4 0.817427927
CV> [36,]       2        3 0.793572412
CV> [37,]       2        4 0.760561408
CV> [38,]       2        4 0.743170109
CV> [39,]       2        3 0.761413953
CV> [40,]       2        3 0.704193051
CV> [41,]       2        4 0.297007126
CV> [42,]       2        4 0.522049838
CV> [43,]       2        3 0.488556828
CV> [44,]       3        4 0.377632488
CV> [45,]       3        4 0.007214464
CV> [46,]       4        3 0.699407534
CV> [47,]       4        3 0.837451212
CV> [48,]       4        3 0.794349431
CV> [49,]       3        4 0.632862996
CV> [50,]       3        4 0.586149139
CV> [51,]       3        4 0.647326133
CV> [52,]       3        4 0.650020368
CV> [53,]       3        4 0.629131005
CV> [54,]       3        4 0.618843633
CV> [55,]       3        4 0.586439350
CV> [56,]       3        4 0.586788051
CV> [57,]       3        4 0.668108812
CV> [58,]       3        4 0.650074540
CV> [59,]       3        4 0.628444500
CV> [60,]       3        4 0.591393005
CV> [61,]       5        1 0.770110294
CV> [62,]       5        1 0.815309198
CV> [63,]       5        4 0.771622667
CV> [64,]       5        1 0.806125429
CV> [65,]       5        1 0.850310507
CV> [66,]       5        1 0.822984066
CV> [67,]       5        1 0.852743923
CV> [68,]       5        1 0.762055943
CV> [69,]       5        1 0.839180986
CV> [70,]       5        1 0.854894699
CV> [71,]       5        1 0.838106473
CV> [72,]       5        1 0.774812117
CV> [73,]       5        1 0.795021304
CV> [74,]       5        1 0.759681469
CV> [75,]       5        1 0.742553847
CV> attr(,"Ordered")
CV> [1] FALSE
CV> attr(,"call")
CV> silhouette.default(x = cutree(ar, k = 5), dist = daisy(ruspini))
CV> attr(,"class")
CV> [1] "silhouette"

CV> Cristiano
CV> ---------------------------------
CV> Cristiano Varin
```

CV> sammy_at_unive.it
CV> http://www.dst.unive.it/~sammy/

R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sat 14 Jun 2008 - 23:28:15 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 14 Jun 2008 - 23:31:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.