[adegenet-forum] Cross validation using xvalDapc

Kirsty Medcalf kirsty.m.medcalf at gmail.com
Mon Sep 28 04:44:06 CEST 2015


Hi

I am attempting to cross validate my results from DAPC analysis with a 70 %
training set using the function xvalDapc (code below).  My data frame is
called LDA.scores. If this is possible, I was wondering if anyone had a
solution to this error message (below).  I have looked online and through
available tutorials and still cannot
solve this issue.

Error in sort.list(y) : 'x' must be atomic for 'sort.list'
Have you called 'sort' on a list?

 Also, I have confusion regarding the argument n.pca.max.  My data frame
has two grouping dependent factors, 12 predictor values and 80
observations.  Would n.pca.max=80 be correct?

If it is possible to help me, then thank you

Best wishes,
Kirsty

CODE

#Permute the data
set.seed(999)

#DAPC analysis

windows(width=10, height=7)
x<-LDA.scores[,2:13]
grp1<-find.clusters(x, max.n.clust=12)
dapc1<-dapc(x, grp1$grp)
dapc1

windows(width=10, height=7)
x1 <- LDA.scores
mat <- as.matrix(x1, method="mean")
grp2 <- x1
xval <- xvalDapc(mat, grp2, n.pca.max = 80, training.set = 0.7,
                 result = "groupMean", center = TRUE, scale = FALSE,
                 n.pca = NULL, n.rep = 30, xval.plot = TRUE)


Error in sort.list(y) : 'x' must be atomic for 'sort.list'
Have you called 'sort' on a list?


Kirsty Medcalf

kirsty.m.medcalf at gmail.com

+447963374030

skype contact: kirsty.medcalf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20150927/97eccd28/attachment.html>


More information about the adegenet-forum mailing list