<div dir="ltr">Hi Alexandre, <div><br></div><div>I would not trust the automatic selection of the optimal space dimension unless you are looking at simulated data and you need to run the analysis 100s of times. There are 2 questions here:</div><div><br></div><div># stability of xvalDapc output</div><div>As this is a stochastic process, changing results are to be expected. It may be the case that you need to increase the number of replicates for results to stabilise a bit.</div><div><br></div><div>If you haven't yet, check the tutorials for some guidelines on this, but basically you want to select the smallest number of dimensions that gives the best classification outcome (i.e. the 'elbow' in the curve). If there is no elbow, there may be no structure in the data - check that the % successful re-assignment is better than expected at random. If the %  successful re-assignment plateaus, various numbers of PCs might lead to equivalent solutions, but at the very least the structures should remain stable.</div><div><br></div><div># cross validation vs optim.a.score</div><div>Simple: go with cross validation. The 'a-score' was meant as a crude measure of goodness of fit of DAPC results, but cross-validation makes more sense.</div><div><br></div><div>Hope this helps</div><div><br></div><div>Thibaut</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div><div><br>--<br>Dr Thibaut Jombart<br>Lecturer, Department of Infectious Disease Epidemiology, <span style="font-size:12.8px">Imperial College London</span></div></div><div><span style="font-size:12.8px">Head of RECON: </span><span style="font-size:12.8px"><a href="https://repidemicsconsortium.org" target="_blank">https://repidemicsconsortium.org</a></span><br></div></div><div><a href="https://sites.google.com/site/thibautjombart/" style="font-size:12.8px" target="_blank">https://sites.google.com/site/thibautjombart/</a><br></div><div><a href="https://github.com/thibautjombart" target="_blank">https://github.com/thibautjombart<br></a></div>Twitter: <a href="https://twitter.com/TeebzR" target="_blank">@TeebzR</a><br></div></div></div></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">On 29 September 2016 at 10:02, Alexandre Lemo <span dir="ltr"><<a href="mailto:alexandros.lemopoulos@gmail.com" target="_blank">alexandros.lemopoulos@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Dear Dr. Jombart and <i>adegenet</i> users,<br><br></div>I am trying to run a DPCA on a dataset of 3975 SNPS obtained through RAD sequencing. Tere are 11 populations and 306 individuals examined here (minmum 16 ind /pop). Note that I am not using the find.cluster function.<br><br>My problem is that I can't get any consistency in the number of PC that I should use for the DPCA. Actually, everytime I run <i>optim.a.score</i> or <i>xval</i>, I get different results. I tried changing the training set (tried 0.7, 0.8 and 0.9) but still the optimal PC retained change in each run.<br></div><br><br>Here is an example of my script:<br><br></div>#str is a genind object<br><br><div><i>optim_PC <- xvalDapc(tab(str, NA.method = "mean", training.set =0.9), pop(str), <br>                              n.pca = 5:100, n.rep = 1000, <br>                              parallel = "snow", ncpus = 4L</i><br></div><div><i><br><br></i></div><div><i>optim_PC_2<- xvalDapc(tab(str, NA.method = "mean", training.set =0.9), pop(str), <br>                              n.pca = 5:100, n.rep = 1000, <br>                              parallel = "snow", ncpus = 4L<br><br></i>What happens here is that optim_PC will give me an optimal PC of (e.g) 76 while optim_PC_2 will give me 16. I tried running this several times and everytime results are different.<br><br><br></div><div>I also tried using optim.a.score() :<br><i><br>dapc.str <- dapc(str, var.contrib = TRUE, scale = FALSE, n.pca = 100,n.da = NULL)<br><br></i></div><div><i>optim.a.score (dapc.str)</i><br><br></div><div>Here, the number of PC will change everytime I run the function.<br></div><div><br><br></div><div>Does anyone have an idea of why this is happening or had several issues? I am quite confused as results obviously change a lot depending on how many PC are used...<br><br></div><div>Thanks for your help and for this great adegenet package!<br><br></div><div>Best,<br><br></div><div>Alexandre<br></div><div><br></div></div>
<br>______________________________<wbr>_________________<br>
adegenet-forum mailing list<br>
<a href="mailto:adegenet-forum@lists.r-forge.r-project.org">adegenet-forum@lists.r-forge.<wbr>r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum" rel="noreferrer" target="_blank">https://lists.r-forge.r-<wbr>project.org/cgi-bin/mailman/<wbr>listinfo/adegenet-forum</a><br></blockquote></div><br></div>