]> git.donarmstrong.com Git - ape.git/blob - man/mst.Rd
06c9dfabdde237303e3da709fcef6b4746ff7522
[ape.git] / man / mst.Rd
1 \name{mst}
2 \alias{mst}
3 \alias{plot.mst}
4 \title{Minimum Spanning Tree}
5 \usage{
6 mst(X)
7 \method{plot}{mst}(x, graph = "circle", x1 = NULL, x2 = NULL, \dots)
8 }
9 \arguments{
10   \item{X}{either a matrix that can be interpreted as a distance matrix,
11     or an object of class \code{"dist"}.}
12   \item{x}{an object of class \code{"mst"} (e.g. returned by \code{mst()}).}
13   \item{graph}{a character string indicating the type of graph to plot
14     the minimum spanning tree; two choices are possible: \code{"circle"} where
15     the observations are plotted regularly spaced on a circle, and
16     \code{"nsca"} where the two first axes of a non-symmetric correspondence
17     analysis are used to plot the observations (see Details below). If
18     both arguments \code{x1} and \code{x2} are given, the argument
19     \code{graph} is ignored.}
20   \item{x1}{a numeric vector giving the coordinates of the observations
21     on the \emph{x}-axis. Both \code{x1} and \code{x2} must be specified
22     to be used.}
23   \item{x2}{a numeric vector giving the coordinates of the observations
24     on the \emph{y}-axis. Both \code{x1} and \code{x2} must be specified
25     to be used.}
26   \item{\dots}{further arguments to be passed to \code{plot()}.}
27 }
28 \description{
29   The function \code{mst} finds the minimum spanning tree between a set of
30   observations using a matrix of pairwise distances.
31
32   The \code{plot} method plots the minimum spanning tree showing the
33   links where the observations are identified by their numbers.
34 }
35 \details{
36   These functions provide two ways to plot the minimum spanning tree which
37   try to space as much as possible the observations in order to show as
38   clearly as possible the links. The option \code{graph = "circle"}
39   simply plots regularly the observations on a circle, whereas
40   \code{graph = "nsca"} uses a non-symmetric correspondence analysis
41   where each observation is represented at the centroid of its neighbours.
42
43   Alternatively, the user may use any system of coordinates for the
44   obsevations, for instance a principal components analysis (PCA) if the
45   distances were computed from an original matrix of continous variables.
46 }
47 \value{
48   an object of class \code{"mst"} which is a square numeric matrix of size
49   equal to the number of observations with either \code{1} if a link
50   between the corresponding observations was found, or \code{0}
51   otherwise. The names of the rows  and columns of the distance matrix,
52   if available, are given as rownames and colnames to the returned object.
53 }
54 \author{
55   Yvonnick Noel \email{noel@univ-lille3.fr},
56   Julien Claude \email{claude@isem.univ-montp2.fr} and
57   Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}
58 }
59 \seealso{
60   \code{\link{dist.dna}}, \code{\link{dist.gene}},
61   \code{\link[stats]{dist}}, \code{\link[graphics]{plot}}
62 }
63 \examples{
64 require(stats)
65 X <- matrix(runif(200), 20, 10)
66 d <- dist(X)
67 PC <- prcomp(X)
68 M <- mst(d)
69 opar <- par()
70 par(mfcol = c(2, 2))
71 plot(M)
72 plot(M, graph = "nsca")
73 plot(M, x1 = PC$x[, 1], x2 = PC$x[, 2])
74 par(opar)
75 }
76 \keyword{multivariate}