Implements the PCANOVA method for determining whether a putative group structure is truly reflected in multivariate data set.
1 2 3 4 
data 
either data frame or matrix with numeric values, or an

labels 
character vector used to label points in plots. The
length of the 
classes 
A subset of the 
colors 
character vector containing color names; this should
be the same length as the vector of 
usecor 
logical scalar. If 
x 
object of class 
tag 
character string to name the object, used as part of the plot title. 
mscale 
A real number. This is a hack; for some reason, the projection of the sample vectors into the principal component space computed from the matrix of group means seems to be off by a factor approximately equal to the square root of the average number of samples per group. Until we sort out the correct formula, this term can be adjusted until the group means appear to be in the correct place in the plots. 
cex 
Character expansion factor used only in the plot legend on the plot of PC correlations. 
... 
additional graphical parameters passed on to 
The PCANOVA method was developed as part of the submission that won the award for best presentation at the 2001 conference on the Critical Assessment of Microarray Data Analysis (CAMDA; http://www.camda.duke.edu). The idea is to perform the equivalent of an analysis of variance (ANOVA) in principal component (PC) space. Let X(i,j) denote the jth column vector belonging to the ith group of samples. We can model this as X(i,j) = mu + tau(i) + E(i,j), where mu is the overall mean vector, tau(i) is the “effects” vector for the ith group, and E(i,j) is the vector of residual errors. We can perform principal components analysis on the full matrix X containing all the columns X(i,j), on the matrix containing all the group mean vectors mu + tau(i), and on the residual matrix containing all the E(i,j) vectors. PCANOVA develops a measure (“PC correlation”) for comparing these three sets of principal components. If the PC correlation is close to 1, then two principal component bases are close together; if the PC correlation is close to zero, then two principal components bases are dissimilar. Strong group structures are recognizable because the PC correlation between the totalmatrix PC space and the groupmeans PC space is much larger than the PC correlation between the totalmatrix PC space and the residual PC space. Weak or nonexistent group structures are recognizable because the relative sizes of the PC correlations is reversed.
The PCanova
function returns an object of the PCanova
class.
Objects should be created by calling the PCanova
generator function.
orig.pca
:A matrix
containing the scores
component from PCA performed on the total matrix. All principal
components analyses are performed using the SamplePCA
class.
class.pca
:A matrix
containing the
scores
component from PCA performed on the matrix of
groupmean vectors.
resid.pca
:A matrix
containing the
scores
component from PCA performed on the matrix of
residuals.
mixed.pca
:A matrix
containing the projections
of all the original vectoprs into the principal component space
computed from the matrix of group mean vectors.
xc
:An object produced by performing hierarchical
clustering on the total data matrix, using hclust
with
pearson distance and average linkage.
hc
:An object produced by performing hierarchical
clustering on the matrix of group means, using hclust
with
pearson distance and average linkage.
rc
:An object produced by performing hierarchical
clustering on the matrix of residuals, using hclust
with
pearson distance and average linkage.
n
:An integer; the number of samples.
class2orig
:The numeric
vector of PC
correlations relating the totalmatrix PCA to the groupmeans PCA.
class2resid
:The numeric
vector of PC
correlations relating the residual PCA to the groupmeans PCA.
orig2resid
:The numeric
vector of PC
correlations relating the totalmatrix PCA to the residual PCA.
labels
:A character
vector of plot labels to
indicate the group membership of samples.
classes
:A character
vector of labels
identifying the distinct groups.
colors
:A character vector of color names used to indicate the group membership fo samples in plots.
call
:An object of class call
that records how
the object was constructed.
signature(x = PCanova, y = missing)
: Plot the
results of the PCANOVA test on the data. This uses par
to
set up a 2x2 layout of plots. The first three plots show the
sample vectors (colorcoded and labeled) in the space spanned by
the first two principal components for each of the there PCAs. The
final plot shows the three sets of PC correlations. Colors in the
first three plots are determined by the colors
slot of the
object, which was set when the object was created. Colors in the
PC correlation plot are determined by the current values of
oompaColor$OBSERVED
,
oompaColor$EXPECTED
, and
oompaColor$PERMTEST
signature(x = PCanova)
: Produce dendrograms of
the three hierarchical clusters of the samples, based on all the
data, the group means, and the residuals. Since this method uses
par
to put all three dendrograms in the same window, it
cannot be combined with other plots.
signature(object = PCanova)
: Write out a
summary of the object.
[1] The projection of the sample vectors into the principal component
space of the groupmeans is off by a scale factor. The mscale
parameter provides a workaround.
[2] The pltree method fails if you only supply two groups; this may be
a failure in hclust
if you only provide two objects to cluster.
Kevin R. Coombes krc@silicovore.com
Examples of the output of PCANOVA applied to the NCI60 data set can be found at http://bioinformatics.mdanderson.org/camda01.html. The full description has not been published (out of laziness on the part of the author of this code). The only description that has appeared in print is an extremely brief description that can be found in the proceedings of the CAMDA 2001 conference.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30  showClass("PCanova")
## simulate data from three groups
d1 < matrix(rnorm(100*10, rnorm(100, 0.5)), nrow=100, ncol=10, byrow=FALSE)
d2 < matrix(rnorm(100*10, rnorm(100, 0.5)), nrow=100, ncol=10, byrow=FALSE)
d3 < matrix(rnorm(100*10, rnorm(100, 0.5)), nrow=100, ncol=10, byrow=FALSE)
dd < cbind(d1, d2, d3)
## colors that match the groups
cols < rep(c('red', 'green', 'blue'), each=10)
## compute the PCanova object
pan < PCanova(dd, c('red', 'green', 'blue'), cols, cols)
summary(pan)
## view the PC plots
plot(pan)
## view the dendrograms
pltree(pan, line=0.5)
## compare the results when there is no underlying group structure
dd < matrix(rnorm(100*50, rnorm(100, 0.5)), nrow=100, ncol=50, byrow=FALSE)
cols < rep(c('red', 'green', 'blue', 'orange', 'cyan'), each=10)
pan < PCanova(dd, unique(cols), cols, cols)
plot(pan, mscale=1/sqrt(10))
pltree(pan, line=0.5)
## cleanup
rm(d1, d2, d3, dd, cols, pan)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.