.BG
.VE $Header: /usr3/s/current/s/.help/RCS/mstree,v 1.2 83/12/30 19:31:03 rab Exp $
.FN mstree
.TL
mstree: Minimal Spanning Tree and Multivariate Planing
.CS
mstree(x, plane)
.PP
.AG x
matrix of data where rows correspond to observations,
columns to variables.  Should be scaled so that values on
all variables are roughly comparable (the algorithm computes
Euclidean distances from one observation to another).
.AG plane
logical, should multivariate planing and lining information be
returned?  If TRUE (the default), all components listed below
are returned; if FALSE, only the minimum spanning tree `mst'
is returned.
.RT
structure with components `x', `y', `mst', and `order',
describing the planing, minimal spanning tree, and two
versions of lining.  If `plane' is FALSE,
only the `mst' vector is returned.
.RC x,y
coordinates of the observations computed by the Friedman-Rafsky algorithm.
.RC mst
vector of length `nrow(x)\-1' describing the edges in the
minimal spanning tree.  The `i'th value in this vector is an
observation number, indicating that this observation and the
`i'th observation should be linked in the minimal spanning
tree.
.RC order
matrix, `nrow(x)' by 2, giving two types of ordering: The
first column presents the standard ordering from one extreme
of the MST to the other.  The second column presents the
radial ordering, based on distance from the center of the
MST.
.SH REFERENCE
J. H. Friedman and L. C. Rafsky,
"Graphics for the Multivariate Two-Sample Problem",
.ul
Stanford Linear Accelerator Corp.,
SLAC PUB-2193, 1978.
.EX
plot(x,y)   # plot original data
   # compute minimal spanning tree
mst <- mstree(cbind(x,y),plot=F)  
   # show tree on plot
segments(x[seq(mst)],y[seq(mst)],x[mst],y[mst])  

i <- rbind( iris[,,1],iris[,,2],iris[,,3])
tree <- mstree(i)   # multivariate planing
plot(tree,type="n")  # plot data in plane
text(tree,seq(nrow(i)))   # identify points
.KW array*
.KW multivariate
.KW multi-dimensional scaling
.KW scaling
.KW dplot*
.WR
