[Adephylo-commits] r137 - in pkg: man src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Jan 5 15:32:58 CET 2010


Author: sdray
Date: 2010-01-05 15:32:58 +0100 (Tue, 05 Jan 2010)
New Revision: 137

Modified:
   pkg/man/abouheif.Rd
   pkg/src/phylog.c
Log:
correct a bug in the standardization of variables (now we use the uniform weights) and add an example

Modified: pkg/man/abouheif.Rd
===================================================================
--- pkg/man/abouheif.Rd	2009-11-05 16:09:11 UTC (rev 136)
+++ pkg/man/abouheif.Rd	2010-01-05 14:32:58 UTC (rev 137)
@@ -81,6 +81,22 @@
 
 ## a variant using another proximity
 plot(abouheif.moran(x, method="nNodes") )
+
+## Another example
+
+data(maples)
+tre <- read.tree(text=maples$tre)
+dom <- maples$tab$Dom
+
+## Abouheif's tests for each trait (equivalent to Cmean)
+W1 <- proxTips(tre,method="oriAbouheif")
+abouheif.moran(dom,W1)
+
+## Equivalence with moran.idx
+
+W2 <- proxTips(tre,method="Abouheif")
+abouheif.moran(dom,W2)
+moran.idx(dom,W2) 
 }
 }
 

Modified: pkg/src/phylog.c
===================================================================
--- pkg/src/phylog.c	2009-11-05 16:09:11 UTC (rev 136)
+++ pkg/src/phylog.c	2010-01-05 14:32:58 UTC (rev 137)
@@ -64,22 +64,12 @@
     }
     /* mat contient une distribution de fréquence bivariée */
     for (j=1; j<=nobs; j++) {
-        provi = 0;
-        for (i=1; i<=nobs; i++) {
-            provi = provi + mat[i][j] ;
-        }
-        poili[j] = provi;
+      poili[j] = 1/(double)(nobs);
     }
-    /* poili contient la distribution marginale
-    le test sera du type xtPx avec x centré normé pour la pondération
-    marginale et A = QtFQ soit la matrice des pij-pi.p.j */
+    /* poili contains uniform weights*/
     matmodifcn(tab,poili);
-    /* le tableau est normalisé pour la pondération marginale de la forme*/
-    for (j=1; j<=nobs; j++) {
-        for (i=1; i<=nobs; i++) {
-            mat[i][j] = mat[i][j] -poili[i]*poili[j] ;
-        }
-    }
+    /* data are standardized using uniform weights */
+   
     for (kvar=1; kvar<=nvar; kvar++) {
         provi = 0;
         for (j=1; j<=nobs; j++) {
@@ -94,7 +84,7 @@
     for (krepet=1; krepet<=nrepet; krepet++) {
         getpermutation (numero, krepet);
         matpermut (tab, numero, tabperm);
-        matmodifcn (tabperm,poili);
+       
         for (kvar=1; kvar<=nvar; kvar++) {
             provi = 0;
             for (j=1; j<=nobs; j++) {



More information about the Adephylo-commits mailing list