]> git.donarmstrong.com Git - ape.git/blob - man/pic.Rd
b34a7532475eaff7e026497ce03f9f72e80fb147
[ape.git] / man / pic.Rd
1 \name{pic}
2 \alias{pic}
3 \title{Phylogenetically Independent Contrasts}
4 \usage{
5 pic(x, phy, scaled = TRUE, var.contrasts = FALSE)
6 }
7 \arguments{
8   \item{x}{a numeric vector.}
9   \item{phy}{an object of class \code{"phylo"}.}
10   \item{scaled}{logical, indicates whether the contrasts should be
11     scaled with their expected variance (default to \code{TRUE}).}
12   \item{var.contrasts}{logical, indicates whether the expected
13     variance of the contrasts should be returned (default to \code{FALSE}).}
14 }
15 \description{
16   Compute the phylogenetically independent contrasts using the method
17   described by Felsenstein (1985).
18 }
19 \details{
20   If \code{x} has names, its values are matched to the tip labels of
21   \code{phy}, otherwise its values are taken to be in the same order
22   than the tip labels of \code{phy}.
23
24   The user must be careful here since the function requires that both
25   series of names perfectly match, so this operation may fail if there
26   is a typing or syntax error. If both series of names do not match, the
27   values in the \code{x} are taken to be in the same order than the tip
28   labels of \code{phy}, and a warning message is issued.
29 }
30 \value{
31   either a vector of phylogenetically independent contrasts (if
32   \code{var.contrasts = FALSE}), or a two-column matrix with the
33   phylogenetically independent contrasts in the first column and their
34   expected variance in the second column (if \code{var.contrasts = TRUE}).
35 }
36 \references{
37   Felsenstein, J. (1985) Phylogenies and the comparative method.
38   \emph{American Naturalist}, \bold{125}, 1--15.
39 }
40 \author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}}
41 \seealso{
42   \code{\link{read.tree}}, \code{\link{compar.gee}}, \code{\link{compar.lynch}}
43 }
44 \examples{
45 ### The example in Phylip 3.5c (originally from Lynch 1991)
46 cat("((((Homo:0.21,Pongo:0.21):0.28,",
47    "Macaca:0.49):0.13,Ateles:0.62):0.38,Galago:1.00);",
48    file = "ex.tre", sep = "\n")
49 tree.primates <- read.tree("ex.tre")
50 X <- c(4.09434, 3.61092, 2.37024, 2.02815, -1.46968)
51 Y <- c(4.74493, 3.33220, 3.36730, 2.89037, 2.30259)
52 names(X) <- names(Y) <- c("Homo", "Pongo", "Macaca", "Ateles", "Galago")
53 pic.X <- pic(X, tree.primates)
54 pic.Y <- pic(Y, tree.primates)
55 cor.test(pic.X, pic.Y)
56 lm(pic.Y ~ pic.X - 1) # both regressions
57 lm(pic.X ~ pic.Y - 1) # through the origin
58 unlink("ex.tre") # delete the file "ex.tre"
59 }
60 \keyword{regression}