<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;"><font size="2">Hi Kirsty,
<br>
<br>
if you have N individuals and P variables, the maximum number of PCs of a PCA is at most min(N,P): in your case, you cannot have more than 12 PCs associated to non-null eigenvalues.<br>
<br>
Otherwise, regarding the quoted code, I don't know what this is:</font><br>
<font size="2"><font face="trebuchet ms,sans-serif" color="black" size="3"><span style="font-size:12pt;"><font face="Helvetica,Arial,sans-serif"><span style="font-weight:normal;"><span dir="ltr">
<div>mat <- as.matrix(x1, <b>method="mean"</b>)</div>
</span></span></font></span></font><br>
Also grp2 does not look like a factor at all to me. <br>
<br>
The input for xvalDapc should mimic the input of a dapc. Please check the examples.<br>
<br>
Cheers<br>
Thibaut<br>
<br>
<br>
</font>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF701207"><font face="Tahoma" color="#000000" size="2"><b>From:</b> adegenet-forum-bounces@lists.r-forge.r-project.org [adegenet-forum-bounces@lists.r-forge.r-project.org] on behalf of Roman Lustrik [roman.lustrik@biolitika.si]<br>
<b>Sent:</b> 28 September 2015 08:38<br>
<b>To:</b> Kirsty Medcalf<br>
<b>Cc:</b> adegenet-forum@lists.r-forge.r-project.org<br>
<b>Subject:</b> Re: [adegenet-forum] Cross validation using xvalDapc<br>
</font><br>
</div>
<div></div>
<div>
<div style="font-family:trebuchet ms,sans-serif; font-size:12pt; color:#000000">
<div>Hi,</div>
<div><br>
</div>
<div>can you make your example reproducible (simulate some data)?</div>
<div><br>
</div>
<div>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). </div>
<div><br>
</div>
<div>Retaining all components is not practical so the function will retain only `n.pca.max` components.</div>
<div><br>
</div>
<div>Cheers,</div>
<div>Roman</div>
<div><br>
</div>
<div><span name="x"></span>----<br>
In god we trust, all others bring data.<span name="x"></span><br>
</div>
<div><br>
</div>
<hr id="zwchr">
<div style="color:#000; font-weight:normal; font-style:normal; text-decoration:none; font-family:Helvetica,Arial,sans-serif; font-size:12pt">
<b>From: </b>"Kirsty Medcalf" <kirsty.m.medcalf@gmail.com><br>
<b>To: </b>adegenet-forum@lists.r-forge.r-project.org<br>
<b>Sent: </b>Monday, September 28, 2015 4:44:06 AM<br>
<b>Subject: </b>[adegenet-forum] Cross validation using xvalDapc<br>
<div><br>
</div>
<div dir="ltr">Hi
<div><br>
</div>
<div>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 </div>
<div>solve this issue.</div>
<div><br>
</div>
<div>
<div>Error in sort.list(y) : 'x' must be atomic for 'sort.list'<br>
</div>
<div>Have you called 'sort' on a list?</div>
</div>
<div><br>
</div>
<div> 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? <br>
</div>
<div><br>
</div>
<div>If it is possible to help me, then thank you</div>
<div><br>
</div>
<div>Best wishes,</div>
<div>Kirsty</div>
<div><br>
</div>
<div>CODE</div>
<div><br>
</div>
<div>#Permute the data<br>
</div>
<div>set.seed(999) </div>
<div><br>
</div>
<div>#DAPC analysis</div>
<div><br>
</div>
<div>
<div>windows(width=10, height=7)</div>
<div>x<-LDA.scores[,2:13]</div>
<div>grp1<-find.clusters(x, max.n.clust=12)</div>
<div>dapc1<-dapc(x, grp1$grp)</div>
<div>dapc1</div>
<div><br>
</div>
<div>windows(width=10, height=7)<br>
</div>
</div>
<div>
<div>
<div>
<div>
<div>x1 <- LDA.scores</div>
<div>mat <- as.matrix(x1, method="mean")</div>
<div>grp2 <- x1</div>
<div>xval <- xvalDapc(mat, grp2, n.pca.max = 80, training.set = 0.7,</div>
<div> result = "groupMean", center = TRUE, scale = FALSE,</div>
<div> n.pca = NULL, n.rep = 30, xval.plot = TRUE)</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>
<div>Error in sort.list(y) : 'x' must be atomic for 'sort.list'</div>
<div>Have you called 'sort' on a list?</div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Kirsty Medcalf</div>
<div> </div>
<div><a href="mailto:kirsty.m.medcalf@gmail.com" target="_blank">kirsty.m.medcalf@gmail.com</a></div>
<div> </div>
<div><a href="tel:%2B447963374030" target="_blank">+447963374030</a></div>
<div> </div>
<div>skype contact: kirsty.medcalf</div>
</div>
</div>
</div>
</div>
<br>
_______________________________________________<br>
adegenet-forum mailing list<br>
adegenet-forum@lists.r-forge.r-project.org<br>
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum</div>
<div><br>
</div>
</div>
</div>
</div>
</div>
</body>
</html>