View source: R/aov_pcaSpectra.R
aov_pcaSpectra | R Documentation |
ANOVA-PCA is a combination of both methods developed by Harrington. The data is partitioned into submatrices corresponding to each experimental factor, which are then subjected to PCA separately after adding the residual error back. If the effect of a factor is large compared to the residual error, separation along the 1st PC in the score plot should be evident. With this method, the significance of a factor can be visually determined (ANOVA-PCA is not blind to group membership). ANOVA-PCA with only one factor is the same as standard PCA and gives no additional separation.
aov_pcaSpectra(spectra, fac, type = "class", choice = NULL, showNames = TRUE)
spectra |
An object of S3 class |
fac |
A vector of character strings giving the factors to be used in
the analysis. These should be elements of |
type |
Either classical ("cls") or robust ("rob"); Results in either
|
choice |
The type of scaling to be performed. See
|
showNames |
Logical. Show the names of the submatrices in the console. |
A list of PCA results, one for each computed submatrix.
Bryan A. Hanson (DePauw University), Matthew J. Keinsley.
Pinto, Bosc, Nocairi, Barros, and Rutledge. "Using ANOVA-PCA for Discriminant Analysis: ..." Analytica Chimica Acta 629.1-2 (2008): 47-55.
Harrington, Vieira, Espinoza, Nien, Romero, and Yergey. "Analysis of Variance–Principal Component Analysis: ..." Analytica Chimica Acta 544.1-2 (2005): 118-27.
The output of this function is used in
used in aovPCAscores
and aovPCAloadings
.
Additional documentation at https://bryanhanson.github.io/ChemoSpec/
## Not run:
# This example assumes the graphics output is set to ggplot2 (see ?GraphicsOptions).
library("ggplot2")
data(metMUD2)
# Original factor encoding:
levels(metMUD2$groups)
# Split those original levels into 2 new ones (re-code them)
new.grps <- list(geneBb = c("B", "b"), geneCc = c("C", "c"))
mM3 <- splitSpectraGroups(metMUD2, new.grps)
# run aov_pcaSpectra
PCAs <- aov_pcaSpectra(mM3, fac = c("geneBb", "geneCc"))
p1 <- aovPCAscores(mM3, PCAs, submat = 1, ellipse = "cls")
p1 <- p1 + ggtitle("aovPCA: B vs b")
p1
p2 <- aovPCAscores(mM3, PCAs, submat = 2)
p2 <- p2 + ggtitle("aovPCA: C vs c")
p2
p3 <- aovPCAscores(mM3, PCAs, submat = 3)
p3 <- p3 + ggtitle("aovPCA: Interaction Term")
p3
p4 <- aovPCAloadings(spectra = mM3, PCA = PCAs)
p4 <- p4 + ggtitle("aov_pcaSpectra: Bb Loadings")
p4
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.