]> git.donarmstrong.com Git - ape.git/blobdiff - R/birthdeath.R
a few changes and one bug fix
[ape.git] / R / birthdeath.R
index 82decda388a03454f9b988e1f5dd9f39de834846..4c65ecd9248e1b1ca497bdc16957f4bcbc208e4e 100644 (file)
@@ -1,4 +1,4 @@
-## birthdeath.R (2009-05-10)
+## birthdeath.R (2010-10-17)
 
 ##   Estimation of Speciation and Extinction Rates
 ##             with Birth-Death Models
@@ -6,7 +6,7 @@
 ## birthdeath: standard model
 ## bd.ext: extended version
 
-## Copyright 2002-2009 Emmanuel Paradis
+## Copyright 2002-2010 Emmanuel Paradis
 
 ## This file is part of the R-package `ape'.
 ## See the file ../COPYING for licensing issues.
@@ -17,6 +17,7 @@ birthdeath <- function(phy)
     N <- length(phy$tip.label)
     x <- c(NA, branching.times(phy))
     dev <- function(a, r) {
+        if (r <= 0) return(1e50)
         -2 * (lfactorial(N - 1)
               + (N - 2) * log(r)
               + r * sum(x[3:N])