# cospeciation: Conducts a statistical test of cospeciation between two trees In phytools: Phylogenetic Tools for Comparative Biology (and Other Things)

 cospeciation R Documentation

## Conducts a statistical test of cospeciation between two trees

### Description

Test for cospeciation based on tree distance.

### Usage

``````cospeciation(t1, t2, distance=c("RF","SPR"),
method=c("simulation","permutation"), assoc=NULL,
nsim=100, ...)
## S3 method for class 'cospeciation'
plot(x, ...)
## S3 method for class '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.

### Details

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 whatsoever between the two trees!

### 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.

### Author(s)

Liam Revell liam.revell@umb.edu

### References

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

`cophylo`

### Examples

``````## 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)
``````

phytools documentation built on Nov. 10, 2023, 1:08 a.m.