Learn R Programming

ape (version 5.8)

pic: Phylogenetically Independent Contrasts

Description

Compute the phylogenetically independent contrasts using the method described by Felsenstein (1985).

Usage

pic(x, phy, scaled = TRUE, var.contrasts = FALSE,
    rescaled.tree = FALSE)

Value

either a vector of phylogenetically independent contrasts (if

var.contrasts = FALSE), or a two-column matrix with the phylogenetically independent contrasts in the first column and their expected variance in the second column (if var.contrasts = TRUE). If the tree has node labels, these are used as labels of the returned object.

If rescaled.tree = TRUE, a list is returned with two elements named ``contr'' with the above results and ``rescaled.tree'' with the tree and its rescaled branch lengths (see Felsenstein 1985).

Arguments

x

a numeric vector.

phy

an object of class "phylo".

scaled

logical, indicates whether the contrasts should be scaled with their expected variances (default to TRUE).

var.contrasts

logical, indicates whether the expected variances of the contrasts should be returned (default to FALSE).

rescaled.tree

logical, if TRUE the rescaled tree is returned together with the main results.

Author

Emmanuel Paradis

Details

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.

The user must be careful here since the function requires that both series of names perfectly match. If both series of names do not match, the values in the x are taken to be in the same order than the tip labels of phy, and a warning message is issued.

References

Felsenstein, J. (1985) Phylogenies and the comparative method. American Naturalist, 125, 1--15.

See Also

read.tree, compar.gee, compar.lynch, pic.ortho, varCompPhylip

Examples

Run this code
### The example in Phylip 3.5c (originally from Lynch 1991)
x <- "((((Homo:0.21,Pongo:0.21):0.28,Macaca:0.49):0.13,Ateles:0.62):0.38,Galago:1.00);"
tree.primates <- read.tree(text = x)
X <- c(4.09434, 3.61092, 2.37024, 2.02815, -1.46968)
Y <- c(4.74493, 3.33220, 3.36730, 2.89037, 2.30259)
names(X) <- names(Y) <- c("Homo", "Pongo", "Macaca", "Ateles", "Galago")
pic.X <- pic(X, tree.primates)
pic.Y <- pic(Y, tree.primates)
cor.test(pic.X, pic.Y)
lm(pic.Y ~ pic.X - 1) # both regressions
lm(pic.X ~ pic.Y - 1) # through the origin

Run the code above in your browser using DataLab