Learn R Programming

phytools (version 0.7-70)

cospeciation: Conducts a statistical test of cospeciation between two trees

Description

This function conducts a test for cospeciation based on tree distance, applying a distance metric selected by the user.

Note that this method should be prone to be quite liberal as the null hypothesis is no similarity between trees!

Usage

cospeciation(t1, t2, distance=c("RF","SPR"),
   method=c("simulation","permutation"), assoc=NULL,
   nsim=100, ...)
# S3 method for cospeciation
plot(x, ...)
# S3 method for cospeciation
print(x, ...)

Arguments

t1

object of class "phylo".

t2

object of class "phylo".

distance

distance method to compare trees.

method

method to use (simulation of pure-birth trees, or permutation of tip labels on a fixed tree) to obtain a null distribution of tree distances via distance.

assoc

matrix containing the tip labels in t1 to match to the tip labels in t2. Note that not all labels in either tree need to be included; however, unlike cophylo, one label in t1 cannot be matched with more than one label in t2, nor vice versa. If NULL then an exact match of tip labels will be sought.

nsim

number of simulations or permutations.

x

for plot and print methods, an object of class "cospeciation".

...

optional arguments.

Value

An object of class "cospeciation", which includes the test-statistic, the null distribution, and a p-value for the test of the null hypothesis of no topological similarity between the two trees.

References

Revell, L. J. (2012) phytools: An R package for phylogenetic comparative biology (and other things). Methods Ecol. Evol., 3, 217-223.

See Also

cophylo

Examples

Run this code
# NOT RUN {
## load data from Lopez-Vaamonde et al. (2001)
data(wasp.trees)
data(wasp.data)
## test for cospeciation
wasp.cosp<-cospeciation(wasp.trees[[1]],wasp.trees[[2]],
    assoc=wasp.data)
print(wasp.cosp)
plot(wasp.cosp)
title(main=paste("Simulated distribution of RF distances\n",
    "between unassociated trees"),font.main=3)
# }

Run the code above in your browser using DataLab