hypTestScores {ChemoSpec}R Documentation

Conduct MANOVA using PCA Scores and Factors in a Spectra Object

Description

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.

Usage

hypTestScores(spectra, pca, pcs = 1:3, fac = NULL, ...)

Arguments

spectra

An object of S3 class Spectra().

pca

An object of class prcomp.

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 Spectra object.

...

Additional arguments to be passed downstream, in this case to aov. Untested.

Details

This function is an extraordinarily thin wrapper which helps the user to avoid writing a very tedious formula specification.

Value

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.

Author(s)

Bryan A. Hanson (DePauw University).

See Also

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/

Examples


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")


[Package ChemoSpec version 6.1.10 Index]