Test the effect of phylogenetic uncertainty on rate shifts found at a particular node
The function uses a number of alternative phylogenies with
altered (as compared to the reference tree) topology and branch lengths
tests whether the tips descending from the specified node (node
)
have statistically different rates from the rest of the tree. A phenotypic
vector y
must be supplied. Eventually, the effect of a covariate
could be included.
swap.phylo(tree,si=0.5,si2=0.5,node,y,rts,nrep=100,cov=NULL,clus=0.5)
tree |
a phylogenetic tree. The tree needs not to be ultrametric or fully dichotomous. |
si |
the proportion of tips whose topologic arrangement will be swapped. |
si2 |
the proportion of nodes whose age will be changed. |
node |
the focal node to be tested. |
y |
the phenotype under testing. |
rts |
the rates found by |
nrep |
the number of simulated trees to be produced. |
cov |
the covariate to be indicated if its effect on rate values must be
accounted for. Contrary to |
clus |
the proportion of clusters to be used in parallel computing (only
if |
swap.phylo
changes the tree topology and branch lengths to a
level specified by the user. Up to half of the tips, and half of the branch
lengths can be changed randomly. The function provides a 'swapped' tree,
yet, importantly, once a shift in the rate of evolution has been found by
RRphylo
, this function can be used to test whether the shift
depends on the tree topology and branch lengths. It runs RRphylo
on
swapped trees (default is 100) and then calculates the absolute rate
difference between all the branches of the shifted node and the rest of the
tree. A t-test is eventually performed to assess significance.
The function returns a 'list' object containing:
$p.swap the probability that the rates at node
are
different from rates at the rest of the tree.
$rates the distribution of rates per branch as calculated by
RRphylo
on 'swapped' phylogenies.
## Not run: data("DataApes") DataApes$PCstage->PCstage DataApes$Tstage->Tstage DataApes$CentroidSize->CS cc<- 2/parallel::detectCores() # Case 1. swap.phylo without accounting for the effect of a covariate RRphylo(tree=Tstage,y=PCstage,clus=cc)->RR RR$rates->rr swap.phylo(Tstage,node=61,y=PCstage,rts=rr,clus=cc) # Case 2. swap.phylo accounting for the effect of a covariate RRphylo(tree=Tstage,y=CS,clus=cc)->RRcova c(RRcova$aces,CS)->cov.values c(rownames(RRcova$aces),names(CS))->names(cov.values) RRphylo(tree=Tstage,y=PCstage,cov=cov.values,clus=cc)->RR RR$rates->rr swap.phylo(Tstage,node=61,y=PCstage,rts=rr,cov=CS,clus=cc) ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.