if (FALSE) {
require(phytools)
require(Morpho)
require(ape)
cc<- 2/parallel::detectCores()
DataFelids$treefel->treefel
DataFelids$statefel->statefel
DataFelids$landfel->feldata
# perform data reduction via Procrustes superimposition (in this case) and RRphylo
procSym(feldata)->pcafel
pcafel$PCscores->PCscoresfel
RRphylo(treefel,PCscoresfel,clus=cc)->RRfelids
# apply search.conv under nodes and state condition
search.conv(RR=RRfelids, y=PCscoresfel, min.dim=5, min.dist="time38", clus=cc)->sc.clade.time
search.conv(tree=treefel, y=PCscoresfel, state=statefel, declust=TRUE, clus=cc)->sc.state
# select converging clades returned in sc.clade.time
felnods<-rbind(c(85,155),c(85,145))
## overfitSC routine
# generate a list of subsampled and swapped phylogenies to test for search.conv
# robustness. Use as reference tree the phylogeny returned by RRphylo.
# Set the nodes and the categories under testing as arguments of
# resampleTree so that it maintains no less than 5 species at least in each
# clade/state.
treefel.list<-resampleTree(RRfelids$tree,s=0.15,nodes=unique(c(felnods)),categories=statefel,
nsim=15,swap.si=0.1,swap.si2=0.1)
# match the original data with each subsampled-swapped phylogeny in treefel.list
# and repeat data reduction
y.list<-lapply(treefel.list,function(k){
treedataMatch(k,feldata)[[1]]->ynew
procSym(ynew)$PCscores
})
# test for robustness of search.conv results by overfitSC
oSC<-overfitSC(RR=RRfelids,phylo.list=treefel.list,y.list=y.list,
nodes = felnods,state=statefel,clus=cc)
}
Run the code above in your browser using DataLab