+
+print.ace <- function(x, digits = 4, ...)
+{
+ cat("\n Ancestral Character Estimation\n\n")
+ cat("Call: ")
+ print(x$call)
+ cat("\n")
+ if (!is.null(x$loglik))
+ cat(" Log-likelihood:", x$loglik, "\n\n")
+ ratemat <- x$index.matrix
+ if (is.null(ratemat)) { # to be improved
+ class(x) <- NULL
+ x$loglik <- x$call <- NULL
+ print(x)
+ } else {
+ dimnames(ratemat)[1:2] <- dimnames(x$lik.anc)[2]
+ cat("Rate index matrix:\n")
+ print(ratemat, na.print = ".")
+ cat("\n")
+ npar <- length(x$rates)
+ estim <- data.frame(1:npar, round(x$rates, digits), round(x$se, digits))
+ cat("Parameter estimates:\n")
+ names(estim) <- c("rate index", "estimate", "std-err")
+ print(estim, row.names = FALSE)
+ cat("\nScaled likelihoods at the root (type '...$lik.anc' to get them for all nodes):\n")
+ print(x$lik.anc[1, ])
+ }
+}