[adegenet-forum] predict.dapc

Jombart, Thibaut t.jombart at imperial.ac.uk
Tue Nov 22 18:07:46 CET 2011


Hello, 

I am sorry but I fail to see any problem in the analyses I have just re-run. Individuals are assigned to the cluster with the highest membership probability.
See for yourself:
> cbind.data.frame(round(dapc_clus6$posterior,5), dapc_clus6$assign)
        1 2 3 dapc_clus6$assign
TC00384 0 1 0                 2
TC00385 0 1 0                 2
TC00444 1 0 0                 1
TC00522 1 0 0                 1
TC00586 0 1 0                 2
TC00616 0 1 0                 2
TC00620 0 1 0                 2
TC00621 0 1 0                 2
TC00628 0 1 0                 2
TC00629 0 1 0                 2
TC00630 0 1 0                 2
TC00694 1 0 0                 1
TC00695 1 0 0                 1
TC00698 1 0 0                 1
TC00699 1 0 0                 1
TC00807 0 1 0                 2
TC00816 0 1 0                 2
TC00873 1 0 0                 1
TC00884 1 0 0                 1
TC00931 0 1 0                 2
TC00932 0 1 0                 2
TC00986 1 0 0                 1
TC00987 0 0 1                 3
TC00988 0 0 1                 3
TC00989 0 0 1                 3
TC00990 0 0 1                 3
TC00991 0 0 1                 3
TC00992 0 0 1                 3
TC00993 0 0 1                 3
TC00996 0 0 1                 3
TC00997 0 0 1                 3
TC00998 0 0 1                 3
TC00999 0 0 1                 3
TC01003 0 0 1                 3
TC01091 0 1 0                 2
TC01100 0 1 0                 2
TC01119 0 1 0                 2
TC01123 0 0 1                 3
TC01124 0 1 0                 2
TC01130 0 1 0                 2
TC01140 0 1 0                 2
TC01141 0 1 0                 2
TC01142 0 1 0                 2
TC01154 0 1 0                 2
TC01204 1 0 0                 1
TC01205 1 0 0                 1
TC01207 1 0 0                 1
TC01208 1 0 0                 1
TC01210 1 0 0                 1
TC01211 1 0 0                 1
TC01212 0 1 0                 2
TC01431 0 1 0                 2
TC01438 0 1 0                 2
TC01441 0 1 0                 2
TC01447 0 1 0                 2
TC01455 0 0 1                 3
TC01458 0 0 1                 3
TC01460 0 0 1                 3
TC01467 0 1 0                 2
TC01480 0 0 1                 3
TC01483 0 1 0                 2
TC01490 0 1 0                 2
TC01492 0 1 0                 2
TC01494 0 1 0                 2
TC01496 0 1 0                 2
TC01500 0 1 0                 2
TC01501 0 1 0                 2
TC01503 0 1 0                 2
TC01504 0 1 0                 2
TC01505 0 1 0                 2
TC01508 0 1 0                 2
TC01511 0 1 0                 2
TC01513 0 1 0                 2
TC02473 0 0 1                 3
TC02474 0 0 1                 3
TC02475 0 0 1                 3
TC02476 0 0 1                 3
TC02477 0 0 1                 3
TC02478 0 0 1                 3
TC02479 0 0 1                 3
TC02480 0 0 1                 3
TC02481 0 0 1                 3
TC02482 0 0 1                 3
TC02483 0 0 1                 3
TC02484 0 0 1                 3
TC02485 0 0 1                 3
TC02486 0 0 1                 3
TC02487 0 0 1                 3
TC02488 0 0 1                 3
TC02489 0 0 1                 3
TC02490 0 0 1                 3
TC02491 0 0 1                 3
TC02492 0 0 1                 3
TC02507 1 0 0                 1
TC02508 1 0 0                 1
TC02512 1 0 0                 1
TC02513 1 0 0                 1
TC02514 1 0 0                 1
TC02515 1 0 0                 1
TC02516 1 0 0                 1
TC02601 1 0 0                 1
TC02602 1 0 0                 1
TC02722 0 0 1                 3
TC02968 0 1 0                 2
TC02971 0 1 0                 2
TC02980 0 1 0                 2
TC02981 1 0 0                 1
TC02982 1 0 0                 1
TC02983 1 0 0                 1
TC02984 1 0 0                 1
TC02987 1 0 0                 1
TC02988 1 0 0                 1
TC02989 1 0 0                 1
TC02990 1 0 0                 1
TC02991 1 0 0                 1
TC02992 1 0 0                 1
TC02993 1 0 0                 1
TC02994 1 0 0                 1
TC02995 0 1 0                 2
TC02997 1 0 0                 1
TC02998 1 0 0                 1
TC02999 0 1 0                 2
TC03000 0 1 0                 2
TC03001 1 0 0                 1
TC03002 1 0 0                 1
TC03004 1 0 0                 1
TC03007 1 0 0                 1
TC03009 1 0 0                 1
TC03010 1 0 0                 1
TC03011 1 0 0                 1
TC03012 1 0 0                 1
TC03014 1 0 0                 1
TC03015 1 0 0                 1
TC03016 1 0 0                 1
TC03017 1 0 0                 1
TC03021 1 0 0                 1
TC00372 0 1 0                 2
TC00373 0 1 0                 2
TC00381 0 1 0                 2

Cheers

Thibaut
________________________________________
From: Thomas, Evert (Bioversity-Colombia) [E.Thomas at CGIAR.ORG]
Sent: 18 November 2011 15:23
To: Jombart, Thibaut
Subject: RE: predict.dapc

Hi Thibaut

I was just working with a smaller dataset and here the problem is even more apparent, eg  for the following individuals

IND                       memb1 memb2                       memb3       assigned clus
TC03011 1.07E-147       6.75881803510825e-321   1       1
TC00620 1.22E-146       4.2082298298664e-317                    1       1
TC00695 2.29E-141       3.77102055648128e-314   1       1
TC00931 2.90E-149       2.52159178892682e-316   1       1
TC02990 1.95E-142       2.05900236721301e-312   1       1
TC02997 3.07E-135       1.32558306255215e-310   1       1
TC02987 2.22E-146       1.06619366372541e-320   1       1

I used the following code

<<
clus6<-cacao[cacao[,2] == 6,1:ncol(cacao)]
clus8<-cacao[cacao[,2] == 8,1:ncol(cacao)]
clus6genind <- df2genind2(clus6[,5:ncol(clus6)], sep="/",ind.names=clus6[,1], loc.names=NULL, pop=1:139, missing=NA, ploidy=2, type="codom")
clus8genind <- df2genind2(clus8[,5:ncol(clus8)], sep="/",ind.names=clus8[,1], loc.names=NULL, pop=1:158, missing=NA, ploidy=2, type="codom")


# find.clusters cluster 6
grpclus6<-find.clusters(clus6genind, max.n.clust=40) #140 axes retained, 3 clusters
dapc_clus6<-dapc(clus6genind,grpclus6$grp) #axes retained=80, discr retained=2
write.table(dapc_clus6$posterior, file="membvaluessubclus6.txt")
write.table(dapc_clus6$assign, file="assignsubclus6.txt")

>>
and the datafiles are attached...


Hopefully I did not do anything wrong...
many thanks for your help/advise

Evert


-----Original Message-----
From: Jombart, Thibaut [mailto:t.jombart at imperial.ac.uk]
Sent: viernes, 18 de noviembre de 2011 10:01 a.m.
To: Thomas, Evert (Bioversity-Colombia); adegenet-forum at r-forge.wu-wien.ac.at
Subject: RE: predict.dapc

Hello,

about the assignment inconsistency: can you send a reproducible example please?

Cheers

Thibaut

________________________________________
From: Thomas, Evert (Bioversity-Colombia) [E.Thomas at CGIAR.ORG]
Sent: 18 November 2011 13:53
To: Jombart, Thibaut; adegenet-forum at r-forge.wu-wien.ac.at
Subject: RE: predict.dapc

Dear Thibaut,

I had problems with R studio - the program froze each time I opened it, even after uninstalling and removing everything and then reinstalling... weird... but the below problem seemed to have been related to this because now it works... However the result is highly unexpected (several of the individuals are assigned to a cluster that is highly unlikely...). On another note: I have noticed that there are some inconsistencies between the cluster assignment and the cluster 'membership values (in the 'posterior' slot) . eg membership values of 0.2 for clus1 and 0.7 for clus 3, but the assignment slot says that the individual belongs to clus1...

kind regards and have an excellent WE

Evert

-----Original Message-----
From: Jombart, Thibaut [mailto:t.jombart at imperial.ac.uk]
Sent: lunes, 14 de noviembre de 2011 05:32 a.m.
To: Thomas, Evert (Bioversity-Colombia); adegenet-forum at r-forge.wu-wien.ac.at
Subject: RE: predict.dapc

Hello,

can you please send code / dummy data to reproduce this error?

Cheers

Thibaut
________________________________________
From: adegenet-forum-bounces at r-forge.wu-wien.ac.at [adegenet-forum-bounces at r-forge.wu-wien.ac.at] on behalf of Thomas, Evert (Bioversity-Colombia) [E.Thomas at CGIAR.ORG]
Sent: 13 November 2011 22:38
To: adegenet-forum at r-forge.wu-wien.ac.at
Subject: [adegenet-forum] predict.dapc

Dear Thibaut,


I tried to apply the "predict.dapc" function but get an error message as follows: Error en predict.lda(x, XU, prior, dimen, method, ...) : subíndice fuera de  los límites (error in predict.lda(x, XU, prior, dimen, method, ...): subindex outside of limits). Any idea what could be the problem?



Many thanks in advance!



Cheers evert



More information about the adegenet-forum mailing list