Skip to content

Commit 884bc67

Browse files
committed
Adding documentation on brute force calculations
1 parent 7bac334 commit 884bc67

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

R/predict.R

+17-2
Original file line numberDiff line numberDiff line change
@@ -453,14 +453,29 @@ predict_pre_order.aphylo <- function(x, psi, mu_d, mu_s, eta, Pi, ...) {
453453
}
454454

455455
#' @rdname posterior-probabilities
456+
#' @param force Logical scalar. When `TRUE` it will try to compute the brute-force
457+
#' probabilities for trees with more than 7 nodes.
458+
#' @details The `predict_brute_force` function makes the (obviously) brute force
459+
#' calculation of the probabilities. It will perform
460+
#' It returns a list with the following:
461+
#' - `Pr` The conditional probabilities of observing a tree given a particular state
462+
#' of the leave nodes. The size is given by (2^nnodes x 2^nleaves), each entry is
463+
#' read as "The probability of observing scenario i (row) given that the leaves have
464+
#' state j (colum)." The scenarios are specified in the `row` matrix returned by the
465+
#' function.
466+
#'
467+
#' - `row` Indicates the state of each node (columns) per scenario (row).
468+
#'
469+
#' - `col` Indicates the state of each leaf node (columns) per potential leaf
470+
#' scenario.
456471
#' @export
457-
predict_brute_force <- function(atree, psi, mu_d, mu_s, Pi) {
472+
predict_brute_force <- function(atree, psi, mu_d, mu_s, Pi, force = FALSE) {
458473

459474
# Should be aphylo
460475
if (!inherits(atree, "aphylo"))
461476
stop("`atree` must be of class `aphylo` (it is of class ", class(atree), ".")
462477

463-
if (length(atree$offspring) > 7)
478+
if (!force && length(atree$offspring) > 7)
464479
stop("In the case of the brute-force calculations, trees with more than 7 nodes becomes burdensome.")
465480

466481
# Coercing into the true class

man/posterior-probabilities.Rd

+18-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)