m.grum@cgiar.org
2003-Aug-04 08:51 UTC
[Rd] hclust() and agnes() method="average" divergence (PR#3648)
This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C35A53.75780090 Content-Type: text/plain; charset="iso-8859-1" Anyone have a clue why hclust() and agnes() produce different results in the example below when both use method="average"?? I'm not able to reproduce the problem with other datasets. ereck<-read.table("Ereck.txt",header=TRUE,sep="\t") emol<-subset(ereck,select=c(11:18,20:32)) library(cluster) library(mva) daisemol<-daisy(emol,type=list(asymm=c(1:21))) layout(matrix(c(1,1,2,2),2,2,byrow=TRUE)) hclustmol<-hclust(daisemol,method="average") plot(hclustmol,cex=0.6) agnesmol<-agnes(daisemol,method="average") pltree(agnesmol,cex=0.6) coagnes<-cophenetic(agnesmol) cor(coagnes,daisemol) cohclust<-cophenetic(hclustmol) cor(cohclust,daisemol) I'm using R 1.7.1 (2003-06-16) on Windows XP. Library "cluster" version 1.7.4 and library "mva" version 1.7.1. Best wishes, Mikkel Mikkel Grum International Plant Genetic Resources Institute (IPGRI) Sub-Saharan Africa Group *** PO Box 30677 00100 Nairobi, Kenya Tel: +254 20 524505(direct)/524500(IPGRI) Fax: +254 20 524501(IPGRI)/524001(ICRAF) m.grum@cgiar.org www.ipgri.org ------_=_NextPart_000_01C35A53.75780090 Content-Type: text/plain; name="Ereck.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="Ereck.txt" COLLNUM NPGRC No LOCALNAME DISTRICT VILLAGE PROVINCE DISEASERESISTANCE PLANTUSES PARTUSED FARMER V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20 V21 V22 MMB05 1343 Nhongoro Nyanga Samakande Manicaland food "stalk, seed" Mr Bulawayo 0 1 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 0 1 0 1 MMB07 1345 Ipwa Nyanga Samakande Manicaland food "stalk, seed" Mr Bulawayo 0 1 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 0 1 0 1 MMBO8 1346 Ipwa Nyanga Samakande Manicaland food "stalk, seed" Mr Bulawayo 0 0 0 0 1 0 0 1 1 0 0 1 0 0 1 0 0 0 0 1 1 0 MMB17 1355 Musoswe Nyanga Chibvembe Manicaland "food, beverage" "stalk, seed" Mr Mupunwa 0 0 1 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 1 0 1 0 MMB40 1378 Nzende Nyanga Mangezi Manicaland grasshoppers "food, beverage" seed Mr Kambara 0 1 0 0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 0 1 0 1 MMB46 1384 Nzende Nyanga Mangezi Manicaland low resistance to rotting food seed Mrs Chitimas 0 1 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 1 0 0 1 MMB47 1385 Musoswe Nyanga Mangezi Manicaland food seed Mrs Chitimas 0 0 0 1 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 0 1 MMB54 1392 Nhongoro Nyanga Mangezi Manicaland black sports on head food " seed, stalk" Mrs P Mangezi 0 0 1 0 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 1 0 1 MMB57 1395 Mudhabhure Nyanga Mangezi Manicaland food seed Mrs P Mangezi 0 1 0 0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 1 0 1 0 MMB61 1399 Nzende Nyanga Mangezi Manicaland "food, beverage" seed Mrs I Mangezi 0 0 0 1 0 0 1 0 1 0 0 0 1 0 1 0 0 0 0 1 0 1 MMB62 1400 Nhongoro Nyanga Mangezi Manicaland "food, beverage" seed Mrs I Mangezi 0 0 0 1 0 0 0 1 1 0 0 0 1 0 0 1 0 0 1 0 0 1 MMB63 1401 Musoswe Nyanga Mangezi Manicaland food seed Mrs I Mangezi 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 0 1 0 1 MMB64 1402 Sorghum Nyanga Mangezi Manicaland food seed Mrs I Mangezi 0 0 0 1 0 0 0 1 1 0 0 0 1 0 1 0 0 0 0 1 0 1 MMB71 1409 Nhongoro Nyanga Mangezi Manicaland "food, beverage" seed Mr & Mrs S Charachimwe 0 0 1 0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 0 1 1 0 MMB74 1412 Sorghum (white) Nyanga Mangezi Manicaland food seed Mr & Mrs S Charachimwe 1 0 0 0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 0 1 0 1 MMB 1425 0 0 1 0 0 1 0 1 1 0 0 1 0 0 0 1 0 0 0 1 1 0 MMB90 1428 Musoswe Nyanga Kamunhukamwe Manicaland black smuts "food, beverage" " seed, stalk" Mrs Katanganda 0 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 0 0 1 0 0 1 MMB92 1430 Sorghum Nyanga Kamunhukamwe Manicaland food seed Mrs Katanganda 0 0 0 0 1 0 0 1 1 0 0 0 1 0 1 0 0 0 0 1 1 0 MMB103 1441 Musoswe Nyanga Kamunhukamwe Manicaland smuts diseases food " seed, stalk" Mrs M Makombe 0 1 0 0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 1 0 1 0 MMB110 1448 Musoswe Nyanga Kamunhukamwe Manicaland "food, beverage" seed Mr & Mrs Musambidzi 0 1 0 0 0 0 0 1 1 0 0 1 0 0 1 0 0 0 1 0 0 1 MMB112 1450 Sorghum (shodhani) Nyanga Kamunhukamwe Manicaland "food, beverage" seed Mr & Mrs Musambidzi 0 0 1 0 1 0 0 1 1 0 0 0 1 0 1 0 0 0 0 1 1 0 MMB117 1455 Ipwa Nyanga Kamunhukamwe Manicaland food stalk Mr & Mrs Musambidzi 0 0 1 0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 1 0 1 0 MMB121 1459 Sorghum Nyanga Renzva Manicaland smuts "food, beverage" seed Mrs Chikwati 0 0 1 0 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 0 1 MMB122 1460 Musoswe Nyanga Renzva Manicaland "food, beverage" seed Mrs Chikwati 0 0 1 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 1 0 1 0 MMB123 1461 Sorghum Nyanga Renzva Manicaland "food, beverage" seed Mrs Chikwati 0 0 0 1 0 0 0 1 1 0 0 0 1 0 1 0 0 0 1 0 0 1 MMB134 1472 Sorghum (mutanda) Nyanga Renzva Manicaland food seed Mr & Mrs J Tungadza 0 0 0 1 0 0 0 1 1 0 0 0 1 0 0 1 0 0 1 0 0 1 MMB135 1473 Sorghum (malawi) Nyanga Renzva Manicaland food seed Mr & Mrs Tungadza 0 0 0 0 0 1 0 1 1 0 0 0 0 1 0 1 0 0 0 1 0 1 MMB136 1474 Sorghum (malawi) Nyanga Renzva Manicaland food seed Mr & Mrs Tungadza 0 1 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 0 1 MMB137 1475 Sorghum (shodhani) Nyanga Renzva Manicaland "food, beverage" seed Mr & Mrs Tungadza 0 1 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 1 1 0 1 0 MMB139 1477 Sorghum (chipemu) Nyanga Renzva Manicaland food seed Mr & Mrs Tungadza 0 0 1 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 1 0 0 1 MMB140 1478 Sorghum Nyanga Renzva Manicaland food seed Mr & Mrs Tungadza 0 0 0 1 0 0 1 0 1 0 0 0 1 0 1 0 0 0 0 1 0 1 MMB142 1480 Sorghum Nyanga Renzva Manicaland food seed Mr & Mrs Tungadza 0 0 1 0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 1 0 0 1 MMB143 1482 Sorghum Nyanga Renzva Manicaland food seed Mr & Mrs Tungadza 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 0 1 0 1 MMB145 1483 Nyamuwayawaya Nyanga Renzva Manicaland food seed Mr & Mrs Tungadza 0 1 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 0 1 1 0 MMB147 1485 Nzende Nyanga Renzva Manicaland food seed Mr & Mrs Tungadza 0 0 0 1 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 0 1 MMB149 1487 Sorghum Nyanga Renzva Manicaland food seed Mr & Mrs Tungadza 0 0 0 1 0 0 0 1 1 0 0 0 1 0 0 1 0 0 0 1 1 0 MMB158 1496 Sweet sorghum Nyanga Renzva Manicaland food stalk Mr & Mrs J Tungadza 0 1 0 0 0 0 0 1 1 0 0 1 0 0 1 0 0 0 0 1 1 0 TSH03 1499 Sorghum Tsholotsho Siyabalandela Matebeleland North high "food, beverage" Mrs Rose Nxumalo 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 1 0 0 0 1 0 1 TSH25 1521 Sorghum Tsholotsho Siyabalandela Matebeleland North high "food, beverage" seed Mrs Maggie Ndlovu 0 0 0 1 0 0 1 0 1 0 0 1 0 0 1 0 0 0 1 0 0 1 TSH27 1523 Sorghum (Isigobane) Tsholotsho Siyabalandela Matebeleland North high "food, beverage" "seed, stalk" Mrs M Nxumale 0 1 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 0 1 1 0 TSH31 1527 Sorghum Tsholotsho Siyabalandela Matebeleland North high "food, beverage" "stalk, seed" Mrs M Nxumale 0 1 0 0 0 0 0 1 1 0 0 0 1 0 0 0 0 1 0 1 1 1 TSH40 1535 Sorghum Tsholotsho Sizanani Matebeleland North low "food, beverage" "seed, stalk, leaf" Mr George Ndebele 0 0 1 0 0 0 1 0 1 0 0 0 1 0 0 1 0 0 0 1 0 1 TSH42 1537 Sorghum Tsholotsho Sizanani Matebeleland North low "food, beverage" "seed, stalk, leaf" Mr George Ndebele 0 0 0 1 0 0 0 1 1 0 0 0 1 0 0 1 0 0 0 1 1 0 TSH45 1540 Sorghum Tsholotsho Sizanani Matebeleland North low "food, beverage" "seed, leaf" Mr George Ndebele 0 0 1 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 0 0 1 0 TSH55 1550 Sorghum Tsholotsho SizananiMabhanda Matebeleland North high "food, beverage" "seed, stalk" Mrs Malethi Sibanda 0 1 0 0 0 0 0 1 1 0 0 0 1 0 0 1 0 0 0 1 0 1 TSH60 1555 Sorghum Tsholotsho SizananiMabhanda Matebeleland North high "food, beverage" "seed, stalk, leaf" Mrs Malethi Sibanda 0 1 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 0 1 0 1 TSH61 1556 Sorghum Tsholotsho SizananiMabhanda Matebeleland North high "food, beverage" "seed, stalk, leaf" Mrs Malethi Sibanda 0 0 0 0 0 1 0 1 1 0 0 0 1 0 1 0 0 0 0 1 0 1 TSH62 1557 Sorghum Tsholotsho SizananiMabhanda Matebeleland North low "food, beverage" "seed, stalk, leaf" Mrs Malethi Sibanda 0 1 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 0 1 0 1 MZA10 1572 Sorghum Tsholotsho Siyazama Matebeleland North yes food seed Mrs Mantombi Ndlovu 0 0 0 0 0 1 0 1 1 0 0 1 0 0 1 0 0 0 0 1 0 1 MZA30 1592 Sorghum Tsholotsho Siyazama Matebeleland North yes "food, beverage" seed Mrs Selina Gumbo 0 0 0 0 0 1 0 1 1 1 0 0 0 0 1 0 0 0 0 1 0 1 MZA31 1593 Sorghum Tsholotsho Siyazama Matebeleland North yes "food, beverage" seed Mrs Selina Gumbo 0 1 0 0 0 0 0 1 1 0 0 0 1 0 1 0 0 0 0 1 0 1 MZA73 1627 Sorghum Tsholotsho Phakamani Matebeleland North 0 0 0 0 1 0 0 1 1 0 1 0 0 0 1 0 0 0 0 1 0 1 ------_=_NextPart_000_01C35A53.75780090--
maechler@stat.math.ethz.ch
2003-Aug-14 09:25 UTC
[Rd] hclust() and agnes() method="average" divergence (PR#3648)
>>>>> "MikG" == m grum <m.grum@cgiar.org> >>>>> on Mon, 4 Aug 2003 08:51:30 +0200 (MET DST) writes:MikG> Anyone have a clue why hclust() and agnes() produce MikG> different results in the example below when both use MikG> method="average"?? I'm not able to reproduce the MikG> problem with other datasets. MikG> ereck <- read.table("Ereck.txt",header=TRUE,sep="\t") MikG> emol <- subset(ereck,select=c(11:18,20:32)) MikG> library(cluster) MikG> library(mva) MikG> daisemol <- daisy(emol,type=list(asymm=c(1:21))) The reason is that most of the distances/dissimilarities are the same: there are only 20 different values in the 1326 distances.> sort(table(daisemol), decreasing=TRUE)starts as>> 0.666666666666667 0.5 0.8 0.285714285714286 >> 387 284 251 94i.e. the distance 2/3 appears 387 times, 1/2 does 284 times, etc. With so many ties in the distances, choosing the next observation / cluster for "merging" is often chosing among many possibilities and hence the arbitrariness and the difference between too algorithms. For your situation, you might be able to use some continuous variable along with the factors and the many binary ones such that the distances won't have ties. NO bug! {i.e. you should have posted to R-help (you did have a good question!)} not R-bugs. Regards, Martin Maechler <maechler@stat.math.ethz.ch> http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 <><