Conduct MANOVA using PCA Scores and Factors in a Spectra Object
This function provides a convenient interface for carrying out manova using
the scores from PCA and the factors (groups) stored in a
Spectra
object. The function will do anova as well, if you
only provide one vector of scores, though this is probably of limited use.
A Spectra
object contains group information stored in its
spectra$groups
element, but you can also use
splitSpectraGroups
to generate additional groups/factors that
might be more useful than the original.
hypTestScores(spectra, pca, pcs = 1:3, fac = NULL, ...)
spectra |
An object of S3 class |
pca |
An object of class |
pcs |
An integer vector giving the PCA scores to use as the response in the manova analysis. |
fac |
A character vector giving the factors to be used in the manova.
They will be searched for within the |
... |
Additional arguments to be passed downstream, in this case to
|
This function is an extraordinarily thin wrapper which helps the user to
avoid writing a very tedious formula
specification.
The results of the analysis print to the console unless assigned.
If assigned, the object class is one of several described in
aov
depending upon the data passed to it.
Bryan A. Hanson, DePauw University.
splitSpectraGroups
which can be used to create
additional factor elements in the Spectra
object, which can then be
used with this function. Additional documentation at
https://bryanhanson.github.io/ChemoSpec/
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) # Now do the PCA and anova, with 3 ways to see the results pca <- c_pcaSpectra(mM3) res <- hypTestScores(mM3, pca, fac = c("geneBb", "geneCc")) res summary(res) summary.aov(res) # You can also call this function on the existing groups: res <- hypTestScores(metMUD2, pca, fac = "groups")
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.