Skip to contents

MajorityPlus() returns the majority-rule (+) consensus (Jansson et al. 2016) : a clade is retained when it occurs in more input trees than contradict it – i.e. when the number of trees displaying the clade exceeds the number of trees incompatible with it. A tree that is compatible with a clade without displaying it counts neither for nor against.

Usage

MajorityPlus(trees)

Arguments

trees

A list of trees, or a multiPhylo object; all entries must share the same leaf labels.

Value

MajorityPlus() returns the consensus tree, an object of class phylo, rooted as in the first entry of trees.

Details

Every majority-rule split is retained (a split in more than half the trees is contradicted by fewer than half), so MajorityPlus() contains the majority-rule consensus (Majority()) and may add further splits that are supported more often than they are contradicted. The retained splits are necessarily mutually compatible, so they define a valid tree.

This implementation ports the optimal \(O(kn)\) algorithm of Jansson et al. (2016) from their FACT toolkit (used with permission): each input tree is processed in a single sweep, the candidate clusters are accumulated by an incremental merge, and a clade is kept when it is displayed by strictly more trees than contradict it – a deterministic count rule (no frequency tie-break), so the result is exact. This replaces the previous R pairwise compatibility matrix.

References

Jansson J, Shen C, Sung W (2016). “Improved algorithms for constructing consensus trees.” Journal of the ACM, 63(3), 1–24. doi:10.1145/2925985 .

See also

Examples

trees <- ape::as.phylo(0:5, 8)
MajorityPlus(trees)
#> 
#> Phylogenetic tree with 8 tips and 5 internal nodes.
#> 
#> Tip labels:
#>   t1, t2, t8, t7, t6, t5, ...
#> 
#> Rooted; no branch length.