@@ -453,14 +453,29 @@ predict_pre_order.aphylo <- function(x, psi, mu_d, mu_s, eta, Pi, ...) {
453
453
}
454
454
455
455
# ' @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.
456
471
# ' @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 ) {
458
473
459
474
# Should be aphylo
460
475
if (! inherits(atree , " aphylo" ))
461
476
stop(" `atree` must be of class `aphylo` (it is of class " , class(atree ), " ." )
462
477
463
- if (length(atree $ offspring ) > 7 )
478
+ if (! force && length(atree $ offspring ) > 7 )
464
479
stop(" In the case of the brute-force calculations, trees with more than 7 nodes becomes burdensome." )
465
480
466
481
# Coercing into the true class
0 commit comments