Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

surveySpectra

Plot Measures of Central Tendency and Spread for a Spectra Object


Description

Compute and plot various measures of central tendency and spread for a Spectra object. Several different measures/spreads are available. These are useful as an overview of where a data set varies the most.

Usage

surveySpectra(
  spectra,
  method = c("sd", "sem", "sem95", "mad", "iqr"),
  by.gr = TRUE,
  ...
)

surveySpectra2(
  spectra,
  method = c("sd", "sem", "sem95", "mad", "iqr"),
  lab.pos = 0.9 * max(spectra$freq),
  ...
)

Arguments

spectra

An object of S3 class Spectra to be analyzed.

method

Character. One of c("sd", "sem", "sem95", "mad", "iqr").

by.gr

Logical, indicating if the analysis is to be done by group or not. Applies to surveySpectra only.

...

Additional parameters to be passed to the plotting routines.

lab.pos

Numeric, giving the frequency where the label should be drawn. Applies to surveySpectra2 only.

Details

For surveySpectra the method choice works as follows: sd plots the mean spectrum +/- the standard deviation, sem plots the mean spectrum +/- the standard error of the mean, sem95 plots the mean spectrum +/- the standard error at the 95 percent confidence interval, mad plots the median spectrum +/- the median absolute deviation, and finally, iqr plots the median spectrum + the upper hinge and - the lower hinge.

For surveySpectra2, the spectra are mean centered and plotted. Below that, the relative summary statistic is plotted, offset, but on the same scale.

Value

None; side effect is a plot

Functions

  • surveySpectra: Spectral survey emphasizing mean or median spectrum, optionally by group.

  • surveySpectra2: Spectral survey emphasizing variation among spectra.

Author(s)

Bryan A. Hanson, DePauw University.

See Also

Additional documentation at https://bryanhanson.github.io/ChemoSpec/

Examples

data(SrE.IR)
myt <- expression(bolditalic(Serenoa) ~ bolditalic(repens) ~ bold(Extract ~ IR ~ Spectra))
surveySpectra(SrE.IR, method = "iqr", main = myt)
surveySpectra2(SrE.IR, method = "iqr", main = myt)

ChemoSpec

Exploratory Chemometrics for Spectroscopy

v5.3.11
GPL-3
Authors
Bryan A. Hanson [aut, cre] (<https://orcid.org/0000-0003-3536-8246>), Mike Bostock [cph, ctb] (author of the d3.js library used by plotSpectraJS, http://d3js.org), Matt Keinsley [ctb] (author of initial AOV-PCA code)
Initial release
2021-03-24

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.