]> git.donarmstrong.com Git - ape.git/blobdiff - R/CDF.birth.death.R
final commit for ape 3.0-8
[ape.git] / R / CDF.birth.death.R
index 3608a35f1d08b3bb1a63232cf54b25de1ef464bc..7ba5f5eb175d078472c6a8c7ccc1a818c1c67d57 100644 (file)
@@ -1,9 +1,9 @@
-## CDF.birth.death.R (2010-09-27)
+## CDF.birth.death.R (2012-09-14)
 
-##    Functions to simulate and fit
+##    Functions to Simulate and Fit
 ##  Time-Dependent Birth-Death Models
 
-## Copyright 2010 Emmanuel Paradis
+## Copyright 2010-2012 Emmanuel Paradis
 
 ## This file is part of the R-package `ape'.
 ## See the file ../COPYING for licensing issues.
@@ -158,7 +158,9 @@ CDF.birth.death <-
 
     if (!case %in% c(1, 3, 6)) Pi <- Vectorize(Pi)
 
-    denom <- if (fast) integrateTrapeze(Pi, 0, Tmax) else integrate(Pi, 0, Tmax)$value
+    denom <-
+        if (fast) integrateTrapeze(Pi, 0, Tmax)
+        else integrate(Pi, 0, Tmax)$value
     n <- length(x)
     p <- numeric(n)
     if (fast) {
@@ -178,6 +180,7 @@ CDF.birth.death <-
     phy <- list(edge = edge, edge.length = edge.length,
                 tip.label = paste("t", 1:(i + 1), sep = ""), Nnode = i)
     class(phy) <- "phylo"
+    attr(phy, "order") <- "cladewise"
     phy
 }
 
@@ -287,7 +290,7 @@ rlineage <-
     .makePhylo(edge[1:j, ], edge.length[1:j], i)
 }
 
-drop.fossil <- function(phy, tol = 0)
+drop.fossil <- function(phy, tol = 1e-8)
 {
     n <- Ntip(phy)
     x <- dist.nodes(phy)[n + 1, ][1:n]
@@ -468,7 +471,7 @@ bd.time <- function(phy, birth, death, BIRTH = NULL, DEATH = NULL,
         PAR <- matrix(NA, boot, np)
         i <- 1L
         while (i <= boot) {
-            cat("i =", i, "\n")
+            cat("\rDoing bootstrap no.", i, "\n")
             x <- sort(sample(x, replace = TRUE))
             o <- try(nlminb(ip, foo, control = list(trace = 0, eval.max = 500),
                             upper = upper, lower = lower))