resamp.phy: partial phylogeny randomization for tips

Description Usage Arguments Details Value Author(s) References See Also Examples

View source: R/dataResampling.R

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

1
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)

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.

Value

a phylogenetic tree whose tips have been shuffled (without any modification of the underlying topology)

Author(s)

Jonathan Eastman

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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
# 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)

spacodiR documentation built on May 2, 2019, 8:26 a.m.