[adegenet-forum] Cross validation using xvalDapc
Roman Lustrik
roman.lustrik at biolitika.si
Mon Sep 28 09:38:08 CEST 2015
Hi,
can you make your example reproducible (simulate some data)?
As for the n.pca.max argument. PCA is a dimension reduction technique. Which means it tries to present data of N variables (columns) as as few principal components as possible. If you think of a 3D cloud shaped like a sphere (3 variables describe this, call them x, y and z), PCA will try to show you the data in 2D (two principal components, call them PC1 and PC2). What you expect to see is a circle which explains most of the variation, since circle is quite good approximation of a sphere. If you add data from PC3, you get a sphere again (and all variation explained).
Retaining all components is not practical so the function will retain only `n.pca.max` components.
Cheers,
Roman
----
In god we trust, all others bring data.
----- Original Message -----
From: "Kirsty Medcalf" <kirsty.m.medcalf at gmail.com>
To: adegenet-forum at lists.r-forge.r-project.org
Sent: Monday, September 28, 2015 4:44:06 AM
Subject: [adegenet-forum] Cross validation using xvalDapc
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
_______________________________________________
adegenet-forum mailing list
adegenet-forum at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/adegenet-forum/attachments/20150928/7c3be2aa/attachment.html>
More information about the adegenet-forum
mailing list