Dear Simon (et al.), <br><br>I apologize - my formula was incorrect and I
 can now confirm that the hand calculation of Ka and Ks both yield the 
same answer as calling up $Ka and $Ks from the KaKs function - I 
confirmed this with system.file data you mentioned.  Sorry for the confusion. <br>
<br>Thank you!<br><br>Trevor<br><br><br><br><div class="gmail_quote">On Thu, Nov 22, 2012 at 2:30 AM, Simon Penel <span dir="ltr"><<a href="mailto:simon.penel@univ-lyon1.fr" target="_blank">simon.penel@univ-lyon1.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>Dear Trevor,<br>
      <br>
      I am not using seqinr on a regular basis,  so I am not sur I can
      help about this problem.<br>
      <br>
      Concerning the way ka ks is calculated you may find the
      information here:<br>
      <br>
<a href="https://r-forge.r-project.org/scm/viewvc.php/pkg/src/kaks.c?view=markup&root=seqinr" target="_blank">https://r-forge.r-project.org/scm/viewvc.php/pkg/src/kaks.c?view=markup&root=seqinr</a><br>
      <br>
      (or directely in the sources of seqinr if you download it at
      <a href="http://cran.r-project.org/web/packages/seqinr/index.html" target="_blank">http://cran.r-project.org/web/packages/seqinr/index.html</a>)<br>
      <br>
      Does the problem occurs with the example given in seqinr :<br>
      <br>
      <font face="Courier New, Courier, monospace">s <-
        read.alignment(file = system.file("sequences/test.phylip",
        package = "seqinr"), format = "phylip")
        <br>
        kaks(s)<br>
      </font><br>
      <br>
      All the best,<br>
      <br>
      Simon<br>
      <br>
      <br>
      <br>
      Le 21/11/12 20:24, Trevor Krabbenhoft a écrit :<br>
    </div>
    <blockquote type="cite">
      <pre>Hello,

I am looking for clarification on how Ka and Ks are calculated in the kaks
function.  If I calculate by hand using formulas from Li 1993, i.e.:

Ka = (Ao + (LoBo + L2B2))/(Lo + L2)

Ks = (L2A2 + L4A4)/(L2 + L4) + B4

I obtain different answers than if I pull out ka and ks using $ka and $ks

e.g.,

test.k<-kaks(myalignment)
test.k$ka        #ka is different here than what I calculate by hand using
$A0, $L0, $B0, etc.

#The details are buried in the kaks function in C - is there a way to 'see'
how it is calculating these?  Which should I use if I want to follow Li's
method?

#Thank you for any insight.

#Trevor

</pre>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
Seqinr-forum mailing list
<a href="mailto:Seqinr-forum@lists.r-forge.r-project.org" target="_blank">Seqinr-forum@lists.r-forge.r-project.org</a>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/seqinr-forum" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/seqinr-forum</a></pre><span class="HOEnZb"><font color="#888888">
    </font></span></blockquote><span class="HOEnZb"><font color="#888888">
    <br>
    <br>
    <pre cols="72">-- 
Simon Penel
Laboratoire de Biometrie et Biologie Evolutive           
Bat 711 - CNRS UMR 5558 - Universite Lyon 1
43 bd du 11 novembre 1918 69622 Villeurbanne Cedex       
Tel:   04 72 43 29 04      Fax:  04 72 43 13 88
<a href="http://lbbe.univ-lyon1.fr/-Penel-Simon-.html?lang=fr" target="_blank">http://lbbe.univ-lyon1.fr/-Penel-Simon-.html?lang=fr</a>

ATTENTION NOUVELLE ADRESSE:
<a href="mailto:simon.penel@univ-lyon1.fr" target="_blank">simon.penel@univ-lyon1.fr</a>
      
</pre>
  </font></span></div>

<br>_______________________________________________<br>
Seqinr-forum mailing list<br>
<a href="mailto:Seqinr-forum@lists.r-forge.r-project.org">Seqinr-forum@lists.r-forge.r-project.org</a><br>
<a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/seqinr-forum" target="_blank">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/seqinr-forum</a><br></blockquote></div><br>