]> git.donarmstrong.com Git - ape.git/commitdiff
fixes in mantel.test() and extract.clade()
authorparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Tue, 22 Nov 2011 07:38:09 +0000 (07:38 +0000)
committerparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Tue, 22 Nov 2011 07:38:09 +0000 (07:38 +0000)
git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@173 6e262413-ae40-0410-9e79-b911bd7a66b7

DESCRIPTION
NEWS
R/drop.tip.R
R/mantel.test.R
Thanks
man/mantel.test.Rd

index 2ac8960c33904955267526d779d6f07bab819089..2aec280e55a090b5a88affdc69dbeae897ad16d5 100644 (file)
@@ -1,6 +1,6 @@
 Package: ape
 Version: 2.8-1
-Date: 2011-11-10
+Date: 2011-11-11
 Title: Analyses of Phylogenetics and Evolution
 Author: Emmanuel Paradis, Ben Bolker, Julien Claude, Hoa Sien Cuong, Richard Desper, Benoit Durand, Julien Dutheil, Olivier Gascuel, Christoph Heibl, Daniel Lawson, Vincent Lefort, Pierre Legendre, Jim Lemon, Yvonnick Noel, Johan Nylander, Rainer Opgen-Rhein, Andrei-Alin Popescu, Klaus Schliep, Korbinian Strimmer, Damien de Vienne
 Maintainer: Emmanuel Paradis <Emmanuel.Paradis@ird.fr>
diff --git a/NEWS b/NEWS
index 39b3905d1c4262bba55feec7f7fcf65f471c5ca6..223169c57b1ff73d0570cb0d5c62f033d8900881 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,12 +6,18 @@ BUG FIXES
     o mantel.test() could return P-values > 1 with the default
       two-tailed test.
 
+    o extract.clade() sometimes shuffled some tip labels (thanks to
+      Ludovic Mallet and Mahendra Mariadassou for the fix).
+
 
 OTHER CHANGES
 
     o The code of yule() has been simplified and is now much faster for
       big trees.
 
+    o The code of mantel.test() has been adjusted to be consistent
+      with common permutation tests.
+
 
 
                CHANGES IN APE VERSION 2.8
index b339578abf490ab764704257d05cff6ee92a842f..5b635f680f4459a579242dfc4fdf2c549d9b5f22 100644 (file)
@@ -1,4 +1,4 @@
-## drop.tip.R (2011-05-19)
+## drop.tip.R (2011-11-21)
 
 ##   Remove Tips in a Phylogenetic Tree
 
@@ -54,7 +54,11 @@ extract.clade <- function(phy, node, root.edge = 0, interactive = FALSE)
     if (wbl) phy$edge.length <- phy$edge.length[keep]
     TIPS <- phy$edge[, 2] <= Ntip
     tip <- phy$edge[TIPS, 2]
-    phy$tip.label <- phy$tip.label[sort(tip)] # <- added sort to avoid shuffling of tip labels (2010-07-21)
+    ## Fix by Ludovic Mallet and Mahendra Mariadassou (2011-11-21):
+    name <- vector("character", length(tip))
+    name[order(tip)] <- phy$tip.label[tip]
+    phy$tip.label <- name
+    ## End of fix
     ## keep the ordering so no need to reorder tip.label:
     phy$edge[TIPS, 2] <- order(tip)
     if (!is.null(phy$node.label))
index a23bc324de8af19ff2a84dacf0478908633e5714..c5c1da21455718d6224468795dc5e3f66ece1e81 100644 (file)
@@ -1,8 +1,8 @@
-## mantel.test.R (2011-11-10)
+## mantel.test.R (2011-11-11)
 
 ##   Mantel Test for Similarity of Two Matrices
 
-## Copyright 2002-2006 Ben Bolker and Julien Claude
+## Copyright 2002-2011 Ben Bolker and Julien Claude
 
 ## This file is part of the R-package `ape'.
 ## See the file ../COPYING for licensing issues.
@@ -22,7 +22,7 @@ lower.triang <- function(m)
     m[col(m) <= row(m)]
 }
 
-mantel.test <- function(m1, m2, nperm = 1000, graph = FALSE,
+mantel.test <- function(m1, m2, nperm = 999, graph = FALSE,
                         alternative = "two.sided", ...)
 {
     alternative <- match.arg(alternative, c("two.sided", "less", "greater"))
@@ -30,10 +30,10 @@ mantel.test <- function(m1, m2, nperm = 1000, graph = FALSE,
     realz <- mant.zstat(m1, m2)
     nullstats <- replicate(nperm, mant.zstat(m1, perm.rowscols(m2, n)))
     pval <- switch(alternative,
-                   "two.sided" =  2 * min(sum(nullstats > realz), sum(nullstats < realz)),
-                   "less" = sum(nullstats < realz),
-                   "greater" = sum(nullstats > realz))
-    pval <- pval / nperm
+                   "two.sided" =  2 * min(sum(nullstats >= realz), sum(nullstats <= realz)),
+                   "less" = sum(nullstats <= realz),
+                   "greater" = sum(nullstats >= realz))
+    pval <- (pval + 1) / (nperm + 1) # 'realz' is included in 'nullstats'
     if (graph) {
         plot(density(nullstats), type = "l", ...)
         abline(v = realz)
diff --git a/Thanks b/Thanks
index 98cf2534da381a957c4bc220f4ded42fd065c8a4..c16ee8253847a786da8cc00eee0312ca2b3268b1 100644 (file)
--- a/Thanks
+++ b/Thanks
@@ -6,10 +6,11 @@ comments, or bug reports: thanks to all of you!
 
 Significant bug fixes were provided by Cécile Ané, Jeremy Beaulieu,
 James Bullard, Otto Cordero, Éric Durand, Olivier François, Rich
-FitzJohn, Jos Käfer, Bret Larget, Naim Matasci, Nick Matzke, Michael
-Phelan, Elizabeth Purdom, Dan Rabosky, Filipe Vieira, Tim Wallstrom,
-Li-San Wang, Yan Wong, Peter Wragg, Janet Young, and Jinlong Zhang.
-Contact me if I forgot someone.
+FitzJohn, Jos Käfer, Bret Larget, Ludovic Mallet, Mahendra
+Mariadassou, Naim Matasci, Nick Matzke, Michael Phelan, Elizabeth
+Purdom, Dan Rabosky, Filipe Vieira, Tim Wallstrom, Li-San Wang, Yan
+Wong, Peter Wragg, Janet Young, and Jinlong Zhang.  Contact me if I
+forgot someone.
 
 Kurt Hornik, of the R Core Team, helped in several occasions to
 fix some problems and bugs.
index babb82c194bf783a43de102aeeaedba42790e96c..949678e7021bfb94f1ee378f1925600b67a3a134 100644 (file)
@@ -2,7 +2,7 @@
 \alias{mantel.test}
 \title{Mantel Test for Similarity of Two Matrices}
 \usage{
-mantel.test(m1, m2, nperm = 1000, graph = FALSE,
+mantel.test(m1, m2, nperm = 999, graph = FALSE,
             alternative = "two.sided",  ...)
 }
 \arguments{