Learn R Programming

spacodiR (version 0.13.0115)

resamp.phy: partial phylogeny randomization for tips

Description

resamp.phy is used to shuffle tips subtended by a set of internal nodes determining by divergence time or specified by the user

Usage

resamp.phy(phy, node = NULL, time.threshold = 1, proportion = TRUE)

Arguments

phy
a phylogenetic tree of class phylo
node
numeric value(s), specifying the internal node(s) whose tips to shuffle; see nodelabels
time.threshold
either absolute or relative divergence times, used to define clades within which tips will be shuffled
proportion
if TRUE, divergence times are treated as relative (0: present; 1: root)

Value

Details

Either a numeric vector is supplied for node or a time.threshold. If given a set of nodes, this function will naively shuffle tips descended from the nodes in the order supplied (without regard to whether any internal node in the vector is a descendant of any other node in the node vector). If given a time.threshold, tips will be reshuffled within non-nested clades that have a rootmost node that occurs within the range [0, time.threshold]. Note that regard to absolute divergence times can be enforced with proportion=FALSE. Note further that resamp.phy(phy=phy, node=NULL, node.threshold=1, proportion=TRUE) achieves the same effect as resamp.1s.

References

HARDY OJ. 2008. Testing the spatial phylogenetic structure of local communities: statistical performances of different null models and test statistics on a locally neutral community. Journal of Ecology 96:914-926.

See Also

see nodelabels for values given for internal nodes and how these are retrieved

Examples

Run this code
# load a tree
data(sp.example)
attach(sp.example)
plot(phy)
mtext("original phylogeny")

# reshuffle within a time range
time=1/3
bb=branching.times(phy)
bb=bb/max(bb)
nodes=(Ntip(phy)+1):max(phy$edge)
nodes[bb<=time]=1

dev.new()
plot(resamp.phy(phy, time.threshold=time, proportion=TRUE))
mtext("reshuffled phylogeny showing affected nodes")
nodelabels(cex=ifelse(nodes==1, 2, NA), col=ifelse(nodes==1, 1, NA), pch=19)

Run the code above in your browser using DataLab