| mapping.asr | R Documentation |
The function constructs a phylogenetic tree of class simmap that maps ancestral state of discrete characters at the nodes of a phylogenetic tree.
Ancestral character estimates can be obtained from the ace function of the package "ape", or from a set of stochastic mappings summarized by the describe.simmap function.
mapping.asr(tree, ancestral, tips)
tree |
Phylogenetic tree (class |
ancestral |
Ancestral state estimates. Either an object of class |
tips |
Character states at the tips. Either an object of class |
The function follows the structure of the function make.simmap() from the package phytools, adding two elements describing the time spent in each state per edge. A phylogenetic tree with the ancestral state estimate mapped onto it is used to model trait evolution under multiple selective regimes in functions such as mvgls() or mvBM() and mvOU.
A phylogenetic tree of class simmap. Two elements are added:
mapped.edge |
|
maps |
|
Julien Clavel
mvgls
ace
make.simmap
#### Example starts ####
library(mvMORPH)
library(ape)
set.seed(2508)
# Loading the data
data(phyllostomid)
phyllos_tree = phyllostomid$tree
phyllos_trait = phyllostomid$grp1
# The states at the tips should follow the order of the phylogenetic tree
phyllos_trait = phyllos_trait[phyllos_tree$tip.label]
# Estimating the ancestral character states
anc_state = ace(phyllos_trait, phyllos_tree, type="discrete",
model="SYM")
# Mapping the reconstruction on the phylogenetic tree
new_tree = mapping.asr(tree=phyllos_tree, ancestral=anc_state, tips=phyllos_trait)
plot(new_tree)
# Character states estimated by stochastic mapping
simmap_trees = make.simmap(phyllos_tree, phyllos_trait, nsim="10")
simmap_list = describe.simmap(simmap_trees)
# Mapping the reconstruction on the phylogenetic tree
new_tree2 = mapping.asr(tree=phyllos_tree, ancestral=simmap_list, tips=phyllos_trait)
plot(new_tree2)
# For comparison
plot(phyllos_tree)
nodelabels(pie =simmap_list$ace)
#### Example ends ####
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.