]> git.donarmstrong.com Git - ape.git/blob - man/pic.Rd
new code for reading FASTA files
[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     rescaled.tree = FALSE)
7 }
8 \arguments{
9   \item{x}{a numeric vector.}
10   \item{phy}{an object of class \code{"phylo"}.}
11   \item{scaled}{logical, indicates whether the contrasts should be
12     scaled with their expected variances (default to \code{TRUE}).}
13   \item{var.contrasts}{logical, indicates whether the expected
14     variances of the contrasts should be returned (default to
15     \code{FALSE}).}
16   \item{rescaled.tree}{logical, if \code{TRUE} the rescaled tree is
17     returned together with the main results.}
18 }
19 \description{
20   Compute the phylogenetically independent contrasts using the method
21   described by Felsenstein (1985).
22 }
23 \details{
24   If \code{x} has names, its values are matched to the tip labels of
25   \code{phy}, otherwise its values are taken to be in the same order
26   than the tip labels of \code{phy}.
27
28   The user must be careful here since the function requires that both
29   series of names perfectly match. If both series of names do not match,
30   the values in the \code{x} are taken to be in the same order than the
31   tip labels of \code{phy}, and a warning message is issued.
32 }
33 \value{
34   either a vector of phylogenetically independent contrasts (if
35   \code{var.contrasts = FALSE}), or a two-column matrix with the
36   phylogenetically independent contrasts in the first column and their
37   expected variance in the second column (if \code{var.contrasts =
38   TRUE}). If the tree has node labels, these are used as labels of the
39   returned object.
40
41   If \code{rescaled.tree = TRUE}, a list is returned with two elements
42   named ``contr'' with the above results and ``rescaled.tree'' with the
43   tree and its rescaled branch lengths (see Felsenstein 1985).
44 }
45 \references{
46   Felsenstein, J. (1985) Phylogenies and the comparative method.
47   \emph{American Naturalist}, \bold{125}, 1--15.
48 }
49 \author{Emmanuel Paradis}
50 \seealso{
51   \code{\link{read.tree}}, \code{\link{compar.gee}},
52   \code{\link{compar.lynch}}, \code{\link{pic.ortho}},
53   \code{\link{varCompPhylip}}
54 }
55 \examples{
56 ### The example in Phylip 3.5c (originally from Lynch 1991)
57 cat("((((Homo:0.21,Pongo:0.21):0.28,",
58    "Macaca:0.49):0.13,Ateles:0.62):0.38,Galago:1.00);",
59    file = "ex.tre", sep = "\n")
60 tree.primates <- read.tree("ex.tre")
61 X <- c(4.09434, 3.61092, 2.37024, 2.02815, -1.46968)
62 Y <- c(4.74493, 3.33220, 3.36730, 2.89037, 2.30259)
63 names(X) <- names(Y) <- c("Homo", "Pongo", "Macaca", "Ateles", "Galago")
64 pic.X <- pic(X, tree.primates)
65 pic.Y <- pic(Y, tree.primates)
66 cor.test(pic.X, pic.Y)
67 lm(pic.Y ~ pic.X - 1) # both regressions
68 lm(pic.X ~ pic.Y - 1) # through the origin
69 unlink("ex.tre") # delete the file "ex.tre"
70 }
71 \keyword{regression}