R: Conduct MANOVA using PCA Scores and Factors in a Spectra...

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.

### References

https://github.com/bryanhanson/ChemoSpec

### See Also

`splitSpectraGroups` which can be used to create additional factor elements in the `Spectra` object, which can then be used with this function.

### 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
    pca <- c_pcaSpectra(mM3)
    hypTestScores(mM3, pca, fac = c("geneBb", "geneCc"))

[Package ChemoSpec version 4.4.97 Index]