Re: [R] barplot and pca plot in mvpart/rpart

From: Gavin Simpson <>
Date: Fri, 29 Feb 2008 22:14:50 +0000

On Fri, 2008-02-29 at 16:46 -0500, shu zhang wrote:
> Hello,
> I'm using the R package called mvpart, which is about the multivariate
> regression trees.
> The function I wrote is:
> mrt1<- mvpart(coefmat~sChip+sScreen+sMem,data=mixdata, xv="pick",
> plot.add=TRUE,uniform=TRUE,which=4,all=TRUE,xadj=2,yadj=2,rsq=TRUE,big.pts=TRUE,wgt.ave.pca=TRUE,legend=TRUE,bars=F,
> pca=TRUE)
> where "coefmat" is a matrix(of dimension N*K) to store the coefficients of
> my functional data object; and the predictors in the formula are all
> vectors of length N.
> Since I set the option "bars=T" and "pca = T", I get the barplot at the
> node of each leaves on my tree, and a pca plot. My question is that what
> is the barplot about? Is it the histogram of the rows of "coefmat" in the
> node, or the value for any predictor?

The barplots represent the mean "value" for each of the responses in the given node.

> Also I get a messy pca plot. I guess each "square" (it's not quite square)
> in the pca plot represents a node in the tree; but what are the squres
> representing?

I have no idea what you are plotting, the mvpart wrapper is very complicated as it tries to do so much and I don't have your data and so can't run your exact call. I have run the examples to try to see what sort of things you are talking about with the PCA plots.

The large points are the node centroids in the PCA space displayed (i.e. the mean of the PCA axis 1 and axis 2 scores of the observations in that node. These are joined by a spanning tree that represent the heights on the tree itself - the longer the line the more important the split.

The smaller points that are enclosed by the coloured polygons represent the observations in each node. The coloured polygons are convex hulls, which enclose the observations in a give node.

Does this answer your question?


> Many thanks for any help on this.
> -Shu
> ______________________________________________
> mailing list
> PLEASE do read the posting guide
> and provide commented, minimal, self-contained, reproducible code.

 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e]
 Gower Street, London          [w]
 UK. WC1E 6BT.                 [w]

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Fri 29 Feb 2008 - 22:22:44 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 29 Feb 2008 - 22:30:17 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive