Dear Thibaut,<div>Thanks for the detailed reply!</div><div>Along the same lines, would non-metric multidimensional scaling be another alternative to MCA? Which one (if any) would deal better with admixed individuals??</div>
<div>Best,</div><div>Hugo</div><div><br><br><div class="gmail_quote">On Mon, Apr 18, 2011 at 8:29 PM, Jombart, Thibaut <span dir="ltr">&lt;<a href="mailto:t.jombart@imperial.ac.uk">t.jombart@imperial.ac.uk</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">




<div>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">Hello,
<br>
<br>
DAPC is meant for quantitative data. One workaround is to transform your data first, i.e. using dummy vectors with some centring/scaling. This is done implicitly by the multiple correspondence analysis  (MCA, dudi.acm in ade4), the multivariate analysis dedicated
 to categorical data. For instance:<br>
####<br>
&gt; f1 &lt;- function(){factor(as.vector(replicate(2, sample(letters[1:4],50, p=runif(4), replace=TRUE))))} # generates 100 indiv following two different distributions<br>
&gt; f1()<br>
  [1] b b b b b c d c d a d c b c d b b b c b c c b b b c b d d b d d d b d d d<br>
 [38] c b b b b c d d b d b b c b c d b c c d b d b d c d b a c a b c b b c b b<br>
 [75] b a b b b d d b b b b d b a b b d b c b d b d b c d<br>
Levels: a b c d<br>
<br>
&gt; barplot(unlist(lapply(split(x,rep(1:2,each=50)),table))) # show the differences, for one &#39;loci&#39;<br>
&gt; dat &lt;- data.frame(lapply(1:10, function(i) f1()))<br>
&gt; names(dat) &lt;- paste(&quot;variable&quot;,1:10)<br>
&gt; mca1 &lt;- dudi.acm(dat,scannf=FALSE, nf=10) # replace &quot;nf &quot; by the nb of factors you want<br>
&gt; fac &lt;- factor(rep(1:2, each=50)) # in practice, replace with the groups<br>
&gt; s.class(mca1$li, fac=fac) # to see the MCA results<br>
<br>
## then in find.clusters and dapc, use mca1$tab as the data, and specify dudi=mca1; e.g.:<br>
&gt; grp &lt;- find.clusters(mca1$tab, dudi=mca1, n.iter=1e5, n.start=30, n.pc=10, n.clust=2) # find.clusters<br>
&gt; table(grp$grp, fac) # I find about 90% accurate classification<br>
<br>
&gt; dapc1 &lt;- dapc(mca1$tab, fac, dudi=mca1, n.pca=10, n.da=1) # dapc<br>
&gt; scatter(dapc1) # plot results - here there&#39;s just one dimension<br>
####<br>
<br>
To ensure that the &quot;dudi&quot; argument will be correctly taken into account, you will need to use the devel version of adegenet (see download section on the website).<br>
<br>
Also, be aware that so far uniform weights are used for all variables, meaning that in your analysis factors with more levels will likely be given stronger weight in the analysis.<br>
<br>
All the best,<br>
<br>
Thibaut<br>
<br>
<br>
<div style="font-family:Times New Roman;color:rgb(0, 0, 0);font-size:16px">
<hr>
<div style="direction:ltr"><font color="#000000" face="Tahoma" size="2"><b>From:</b> <a href="mailto:adegenet-forum-bounces@r-forge.wu-wien.ac.at" target="_blank">adegenet-forum-bounces@r-forge.wu-wien.ac.at</a> [<a href="mailto:adegenet-forum-bounces@r-forge.wu-wien.ac.at" target="_blank">adegenet-forum-bounces@r-forge.wu-wien.ac.at</a>] on behalf of Hugo Gante [<a href="mailto:hugo.gante@gmail.com" target="_blank">hugo.gante@gmail.com</a>]<br>

<b>Sent:</b> 18 April 2011 15:24<br>
<b>To:</b> <a href="mailto:adegenet-forum@r-forge.wu-wien.ac.at" target="_blank">adegenet-forum@r-forge.wu-wien.ac.at</a><br>
<b>Subject:</b> [adegenet-forum] Data type/format and admixed individuals using DAPC<br>
</font><br>
</div><div><div></div><div class="h5">
<div></div>
<div><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse">Hi,<br>
Perhaps someone could help me out with a basic file format question?
<div>To run DAPC can I use qualitative (coded) data or do I have to use quantitative data since it first runs a PCA? I found some information about data file format (matrix vs tabular?) and data type (quantitative vs characters) but some clarification on usage
 and where to find more detail (examples?) on file formats would be most appreciated.</div>
<div><br>
</div>
<div>Also, I was wondering how admixed individuals are treated and if they will be identified by DAPC?</div>
<div><br>
Thanks in advance!<br>
Best,<font color="#888888"><br>
</font></div>
<div>Hugo</div>
<div><br>
</div>
</span></div>
</div></div></div>
</div>
</div>

</blockquote></div><br></div>