random_detach_subtree {ddtlcm}R Documentation

Metropolis-Hasting algorithm for sampling tree topology and branch lengths from the DDT branching process.

Description

Randomly detach a subtree from a given tree

Usage

random_detach_subtree(tree_phylo4)

Arguments

tree_phylo4

a "phylo4" object

Value

a list containing the following elements:

tree_detached

a "phylo" tree detached from the input tree

tree_kept

the remaining "phylo" tree after detachment

pa_detach_node_label

a character label of the parent of the node from which the detachment happens

pa_div_time

a number in (0, 1) indicating the divergence time of the parent of the detached node

detach_div_time

a number in (0, 1) indicating the divergence time of the detached node

detach_node_label

a character label of the parent of the detached node

See Also

Other sample trees: attach_subtree(), reattach_point()

Examples

library(phylobase)
# load the MAP tree structure obtained from the real HCHS/SOL data
data(data_synthetic)
# extract elements into the global environment
list2env(setNames(data_synthetic, names(data_synthetic)), envir = globalenv()) 
detachment <- random_detach_subtree(extractTree(tree_with_parameter)) 

[Package ddtlcm version 0.2.1 Index]