paint: Painting regimes on a phylogenetic tree

paintR Documentation

Painting regimes on a phylogenetic tree

Description

Function to paint selective regimes on a phylogenetic tree.

Usage

paint(tree, subtree, branch, which = 1)

Arguments

tree

An object of class ouchtree.

subtree

An optional named vector specifying the root nodes of subtrees. Each branch that descends from this node will be painted with the specified regime.

branch

An optional named vector specifying the end nodes of branches. The unique branch that terminates at the named node will be painted with the specified regime.

which

integer; if tree is a hansentree, start not with a blank canvas but with the regime specifications tree contains for the character indicated by which.

Details

The names of subtree and branch must be the names of nodes of tree. The painting proceeds in a particular order: one can overpaint a branch. The subtrees indicated by the elements of subtree are painted first, in order. Then the branches indicated by branch are painted. If tree is of class hansentree, then paint begins with the regimes specified in the regimes slot of tree. Otherwise, paint begins with a blank canvas, i.e., a tree painted with the single regime "nonspec". Note that, if tree is a multivariate hansentree, then there are multiple regime specifications contained in tree. In this case, the argument which lets you pick which one you wish to begin with; by default, the first is used.

Value

A vector of class 'factor' with names corresponding to the nodes in tree, specifying selective regimes.

Author(s)

Aaron A. King

See Also

Other methods for ouch trees: as_data_frame, bootstrap(), coef(), logLik, ouch-package, plot(), print(), simulate(), summary(), update()

Other phylogenetic comparative models: brown(), hansen(), ouch-package, ouchtree

Examples

x <- with(
  bimac,
  ouchtree(nodes=node,times=time/max(time),ancestors=ancestor,labels=species)
)

r <- paint(x,subtree=c("1"="medium","9"="large","2"="small"),
  branch=c("38"="large","2"="medium"))
plot(x,regimes=r,node.names=TRUE)

## compare to bimac['OU.LP']
h5 <- hansen(data=log(bimac['size']),tree=x,regimes=bimac['OU.LP'],
  sqrt.alpha=1,sigma=1,reltol=1e-5)
r <- paint(h5,branch=c("18"="large"),subtree=c("9"="small"))
plot(x,regimes=r,node.names=TRUE)


ouch documentation built on July 4, 2024, 5:08 p.m.

Related to paint in ouch...