]> git.donarmstrong.com Git - ape.git/blob - man/pic.Rd
new pic.ortho() and varCompPhylip() + fix in dist.nodes()
[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 variances (default to \code{TRUE}).}
12   \item{var.contrasts}{logical, indicates whether the expected
13     variances 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 =
35   TRUE}). If the tree has node labels, these are used as labels of the
36   returned object.
37 }
38 \references{
39   Felsenstein, J. (1985) Phylogenies and the comparative method.
40   \emph{American Naturalist}, \bold{125}, 1--15.
41 }
42 \author{Emmanuel Paradis}
43 \seealso{
44   \code{\link{read.tree}}, \code{\link{compar.gee}},
45   \code{\link{compar.lynch}}, \code{\link{pic.ortho}},
46   \code{\link{varCompPhylip}}
47 }
48 \examples{
49 ### The example in Phylip 3.5c (originally from Lynch 1991)
50 cat("((((Homo:0.21,Pongo:0.21):0.28,",
51    "Macaca:0.49):0.13,Ateles:0.62):0.38,Galago:1.00);",
52    file = "ex.tre", sep = "\n")
53 tree.primates <- read.tree("ex.tre")
54 X <- c(4.09434, 3.61092, 2.37024, 2.02815, -1.46968)
55 Y <- c(4.74493, 3.33220, 3.36730, 2.89037, 2.30259)
56 names(X) <- names(Y) <- c("Homo", "Pongo", "Macaca", "Ateles", "Galago")
57 pic.X <- pic(X, tree.primates)
58 pic.Y <- pic(Y, tree.primates)
59 cor.test(pic.X, pic.Y)
60 lm(pic.Y ~ pic.X - 1) # both regressions
61 lm(pic.X ~ pic.Y - 1) # through the origin
62 unlink("ex.tre") # delete the file "ex.tre"
63 }
64 \keyword{regression}