aovPCAscores {ChemoSpec}R Documentation

Plot ANOVA-PCA Scores from a Spectra Object

Description

Uses the results from aov_pcaSpectra to plot the scores. Argument submat is used to select PCA results from among those stored in argument PCA.

Usage

aovPCAscores(
  spectra,
  so,
  submat = 1,
  ellipse = "none",
  tol = "none",
  use.sym = FALSE,
  leg.loc = "topright",
  ...
)

Arguments

spectra

An object of S3 class Spectra.

so

List of pca results created by aov_pcaSpectra.

submat

Integer. Selects list element submat from PCA which is a list of PCA results, each corresponding to the computation in aov_pcaSpectra.

ellipse

A character vector specifying the type of ellipses to be plotted. One of c("both", "none", "cls", "rob"). cls specifies classical confidence ellipses, rob specifies robust confidence ellipses. An ellipse is drawn for each group unless there are three or fewer samples in the group.

tol

A number describing the fraction of points to be labeled. tol = 1.0 labels all the points; tol = 0.05 labels approximately the most extreme 5 percent. Set to "none" to completely suppress labels. Note that a simple approach based upon quantiles is used, assumes that both x and y are each normally distributed, and treats x and y separately. Thus, this is not a formal treatment of outliers, just a means of labeling points. Groups are lumped together.

use.sym

A logical; if TRUE, the color scheme is set to black and the points plotted with symbols. Applies only to Spectra objects.

leg.loc

Character; if "none" no legend will be drawn. Otherwise, any string acceptable to legend.

...

Additional parameters to be passed to plotScores. For example, you can plot confidence ellipses this way. Note that ellipses are drawn based on the groups in spectra$groups, but the separation done by aov_pcaSpectra is based on argument fac. These may not correspond, but you can edit spectra$groups to match if necessary.

Value

The returned value depends on the graphics option selected (see GraphicsOptions).

base:

A data frame or list containing the data plotted. Assign the value and run str() or names() on it to see what it contains. Side effect is a plot.

ggplot2:

The plot is displayed, and a ggplot2 plot object is returned if the value is assigned. The plot can be modified in the usual ggplot2 manner. If you want the plotted values, you can access them via the base graphics mode.

Author(s)

Bryan A. Hanson (DePauw University), Matthew J. Keinsley.

References

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.

See Also

The use of this function can be seen in aov_pcaSpectra. See also plotScores. Additional documentation at https://bryanhanson.github.io/ChemoSpec/


[Package ChemoSpec version 6.0.1 Index]