Description Usage Arguments Details Value See Also Examples
This function calculates the coancestry matrix of the subpopulations which are tip nodes in the input tree. The edges of this tree are coancestry values relative to the parent node of each child node.
1 | coanc_tree(tree)
|
tree |
The coancestry tree relating the |
The calculation takes into account that total coancestries are non-linear functions of the per-edge coancestries.
Interestingly, the calculation can be simplified by a simple transformation performed by tree_additive()
, see that for more information.
The self-coancestry (diagonal values) are the total coancestries of the tip nodes.
The coancestry between different subpopulations is the total coancestry of their last common ancestor node.
The k_subpops
-by-k_subpops
coancestry matrix.
The order of subpopulations along the rows and columns of this matrix matches tree$tip.label
.
The tip labels of the tree are copied to the row and column names of this matrix.
fit_tree()
for the inverse function (when applied to coancestry matrices generated by a tree without noise).
tree_additive()
for calculating the additive edges.
This function is called internally by coanc_tree
but the additive edges are not returned here, so call tree_additive()
if you desired them.
1 2 3 4 5 6 7 8 9 10 | # for simulating a tree with `rtree`
library(ape)
# a typical, non-trivial example
# number of tip subpopulations
k_subpops <- 3
# simulate a random tree
tree_subpops <- rtree( k_subpops )
# coancestry matrix of subpopulations
coancestry <- coanc_tree( tree_subpops )
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.