]> git.donarmstrong.com Git - ape.git/blob - man/boot.phylo.Rd
6869f6724ced01aefe71cee3741b98f3f5463973
[ape.git] / man / boot.phylo.Rd
1 \name{boot.phylo}
2 \alias{boot.phylo}
3 \alias{prop.part}
4 \alias{prop.clades}
5 \alias{print.prop.part}
6 \alias{summary.prop.part}
7 \alias{plot.prop.part}
8 \title{Tree Bipartition and Bootstrapping Phylogenies}
9 \usage{
10 boot.phylo(phy, x, FUN, B = 100, block = 1,
11            trees = FALSE, quiet = FALSE)
12 prop.part(..., check.labels = TRUE)
13 prop.clades(phy, ..., part = NULL)
14 \method{print}{prop.part}(x, ...)
15 \method{summary}{prop.part}(object, ...)
16 \method{plot}{prop.part}(x, barcol = "blue", leftmar = 4, ...)
17 }
18 \arguments{
19   \item{phy}{an object of class \code{"phylo"}.}
20   \item{x}{in the case of \code{boot.phylo}: a taxa (rows) by characters
21     (columns) matrix; this may be presented as a list; in the case of
22     \code{print} and \code{plot}: an object of class \code{"prop.part"}.}
23   \item{FUN}{the function used to estimate \code{phy} (see details).}
24   \item{B}{the number of bootstrap replicates.}
25   \item{block}{the number of columns in \code{x} that will be resampled
26     together (see details).}
27   \item{trees}{a logical specifying whether to return the bootstraped
28     trees (\code{FALSE} by default).}
29   \item{quiet}{a logical: a progress bar is displayed by default.}
30   \item{\dots}{either (i) a single object of class \code{"phylo"}, (ii) a
31     series of such objects separated by commas, or (iii) a list
32     containing such objects. In the case of \code{plot} further
33     arguments for the plot (see details).}
34   \item{check.labels}{a logical specifying whether to check the labels
35     of each tree. If \code{FALSE}, it is assumed that all trees have the
36     same tip labels, and that they are in the same order (see details).}
37   \item{part}{a list of partitions as returned by \code{prop.part}; if
38     this is used then \code{\dots} is ignored.}
39   \item{object}{an object of class \code{"prop.part"}.}
40   \item{barcol}{the colour used for the bars displaying the number of
41     partitions in the upper panel.}
42   \item{leftmar}{the size of the margin on the left to display the tip
43     labels.}
44 }
45 \description{
46   These functions analyse bipartitions found in a series of trees.
47
48   \code{prop.part} counts the number of bipartitions found in a series
49   of trees given as \code{\dots}. If a single tree is passed, the
50   returned object is a list of vectors with the tips descending from
51   each node (i.e., clade compositions indexed by node number).
52
53   \code{prop.clades} counts the number of times the bipartitions present
54   in \code{phy} are present in a series of trees given as \code{\dots} or
55   in the list previously computed and given with \code{part}.
56
57   \code{boot.phylo} performs a bootstrap analysis.
58 }
59 \details{
60   The argument \code{FUN} in \code{boot.phylo} must be the function used
61   to estimate the tree from the original data matrix. Thus, if the tree
62   was estimated with neighbor-joining (see \code{nj}), one maybe wants
63   something like \code{FUN = function(xx) nj(dist.dna(xx))}.
64
65   \code{block} in \code{boot.phylo} specifies the number of columns to
66   be resampled altogether. For instance, if one wants to resample at the
67   codon-level, then \code{block = 3} must be used.
68
69   Using \code{check.labels = FALSE} in \code{prop.part} decreases
70   computing times. This requires that (i) all trees have the same tip
71   labels, \emph{and} (ii) these labels are ordered similarly in all
72   trees (in other words, the element \code{tip.label} are identical in
73   all trees).
74
75   The plot function represents a contingency table of the different
76   partitions (on the \emph{x}-axis) in the lower panel, and their observed
77   numbers in the upper panel. Any further arguments (\dots) are used to
78   change the aspects of the points in the lower panel: these may be
79   \code{pch}, \code{col}, \code{bg}, \code{cex}, etc. This function
80   works only if there is an attribute \code{labels} in the object.
81
82   The print method displays the partitions and their numbers. The
83   summary method extracts the numbers only.
84 }
85 \note{
86   \code{prop.clades} calls internally \code{prop.part} with the option
87   \code{check.labels = TRUE}, which may be very slow. If the trees
88   passed as \code{\dots} fulfills conditions (i) and (ii) above, then it
89   might be faster to first call, e.g., \code{pp <- prop.part(...)}, then
90   use the option \code{part}: \code{prop.clades(phy, part = pp)}.
91 }
92 \value{
93   \code{prop.part} returns an object of class \code{"prop.part"} which
94   is a list with an attribute \code{"number"}. The elements of this list
95   are the observed clades, and the attribute their respective
96   numbers. If the default \code{check.labels = FALSE} is used, an
97   attribute \code{"labels"} is added, and the vectors of the returned
98   object contains the indices of these labels instead of the labels
99   themselves.
100
101   \code{prop.clades} and \code{boot.phylo} return a numeric vector
102   which \emph{i}th element is the number associated to the \emph{i}th
103   node of \code{phy}. If \code{trees = TRUE}, \code{boot.phylo} returns
104   a list whose first element (named \code{"BP"}) is like before, and the
105   second element (\code{"trees"}) is a list with the bootstraped
106   trees.
107
108   \code{summary} returns a numeric vector.
109 }
110 \references{
111   Efron, B., Halloran, E. and Holmes, S. (1996) Bootstrap confidence
112   levels for phylogenetic trees. \emph{Proceedings of the National
113     Academy of Sciences USA}, \bold{93}, 13429--13434.
114
115   Felsenstein, J. (1985) Confidence limits on phylogenies: an approach
116   using the bootstrap. \emph{Evolution}, \bold{39}, 783--791.
117 }
118 \author{Emmanuel Paradis}
119 \seealso{
120   \code{\link{dist.topo}}, \code{\link{consensus}}, \code{\link{nodelabels}}
121 }
122 \examples{
123 data(woodmouse)
124 f <- function(x) nj(dist.dna(x))
125 tr <- f(woodmouse)
126 ### Are bootstrap values stable?
127 for (i in 1:5)
128   print(boot.phylo(tr, woodmouse, f, quiet = TRUE))
129 ### How many partitions in 100 random trees of 10 labels?...
130 TR <- replicate(100, rtree(10), FALSE)
131 pp10 <- prop.part(TR)
132 length(pp10)
133 ### ... and in 100 random trees of 20 labels?
134 TR <- replicate(100, rtree(20), FALSE)
135 pp20 <- prop.part(TR)
136 length(pp20)
137 plot(pp10, pch = "x", col = 2)
138 plot(pp20, pch = "x", col = 2)
139 }
140 \keyword{manip}
141 \keyword{htest}