Learn R Programming

ape (version 5.8-1)

varCompPhylip: Variance Components with Orthonormal Contrasts

Description

This function calls Phylip's contrast program and returns the phylogenetic and phenotypic variance-covariance components for one or several traits. There can be several observations per species.

Usage

varCompPhylip(x, phy, exec = NULL)

Value

a list with elements varA and varE with the phylogenetic (additive) and phenotypic (environmental) variance-covariance matrices. If a single trait is analyzed, these contains its variances.

Arguments

x

a numeric vector, a matrix (or data frame), or a list.

phy

an object of class "phylo".

exec

a character string giving the name of the executable contrast program (see details).

Author

Emmanuel Paradis

Details

The data x can be in several forms: (i) a numeric vector if there is single trait and one observation per species; (ii) a matrix or data frame if there are several traits (as columns) and a single observation of each trait for each species; (iii) a list of vectors if there is a single trait and several observations per species; (iv) a list of matrices or data frames: same than (ii) but with several traits and the rows are individuals.

If x has names, its values are matched to the tip labels of phy, otherwise its values are taken to be in the same order than the tip labels of phy.

Phylip (version 3.68 or higher) must be accessible on your computer. If you have a Unix-like operating system, the executable name is assumed to be "phylip contrast" (as in Debian); otherwise it is set to "contrast". If this doesn't suit your system, use the option exec accordingly. If the executable is not in the path, you may need to specify it, e.g., exec = "C:/Program Files/Phylip/contrast".

References

Felsenstein, J. (2004) Phylip (Phylogeny Inference Package) version 3.68. Department of Genetics, University of Washington, Seattle, USA. http://evolution.genetics.washington.edu/phylip/phylip.html.

Felsenstein, J. (2008) Comparative methods with sampling error and within-species variation: Contrasts revisited and revised. American Naturalist, 171, 713--725.

See Also

pic, pic.ortho, compar.lynch

Examples

Run this code
if (FALSE) {
tr <- rcoal(30)
### Five traits, one observation per species:
x <- replicate(5, rTraitCont(tr, sigma = 1))
varCompPhylip(x, tr) # varE is small
x <- replicate(5, rnorm(30))
varCompPhylip(x, tr) # varE is large
### Five traits, ten observations per species:
x <- replicate(30, replicate(5, rnorm(10)), simplify = FALSE)
varCompPhylip(x, tr)
}

Run the code above in your browser using DataLab