<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>