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