]> git.donarmstrong.com Git - ape.git/blobdiff - R/ace.R
new image.DNAbin()
[ape.git] / R / ace.R
diff --git a/R/ace.R b/R/ace.R
index 12c5f99f0ec83befd8400dadb3694b0acff7e1ec..b67549f9dccf4cd55b3d68b0fe5bd7ffb3f9ef8b 100644 (file)
--- a/R/ace.R
+++ b/R/ace.R
@@ -1,4 +1,4 @@
-## ace.R (2010-05-12)
+## ace.R (2010-12-08)
 
 ##   Ancestral Character Estimation
 
@@ -174,7 +174,8 @@ as the number of categories in `x'")
                 liks[anc, ] <- v/comp[anc]
             }
             if (output.liks) return(liks[-TIPS, ])
-            -2 * sum(log(comp[-TIPS]))
+            dev <- -2 * sum(log(comp[-TIPS]))
+            if (is.na(dev)) Inf else dev
         }
         out <- nlminb(rep(ip, length.out = np), function(p) dev(p),
                       lower = rep(0, np), upper = rep(1e50, np))
@@ -253,7 +254,7 @@ print.ace <- function(x, digits = 4, ...)
         cat("Parameter estimates:\n")
         names(estim) <- c("rate index", "estimate", "std-err")
         print(estim, row.names = FALSE)
-        cat("\nScaled likelihoods at the root (type 'x$lik.anc' to get them for all nodes):\n")
+        cat("\nScaled likelihoods at the root (type '...$lik.anc' to get them for all nodes):\n")
         print(x$lik.anc[1, ])
     }
 }