# \donttest{
#### 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 ####
# }
Run the code above in your browser using DataLab