Learn R Programming

ChemoSpec (version 4.0.6)

getMaxCovByFreq: Order Rows of a Covariance Matrix by Absolute Value

Description

Given a covariance matrix, the maximum absolute value of each row is computed. The results are ordered, and optionally, limited to values greater than a particular value.

Usage

getMaxCovByFreq(spectra, V = NULL, Quan = NULL)

Arguments

spectra
An object of S3 class Spectra.
V
A numeric covariance matrix.
Quan
Numeric. A value in the interval (0...1) giving the quantile to be selected. For instance, Quan = 0.1 selects the top 10 percent of the absolute covariance values.

Value

  • A data frame containing the frequencies from the Spectra object, the covariance at that frequency, the absolute value of the covariance, and the relative covariance. Sorted by absolute covariance in descending order.

Details

IMPORTANT: The current version includes the variances along the diagonal and thus the answers are skewed. A future version will include the ability to exclude these values from the analysis.

References

https://github.com/bryanhanson/ChemoSpec

Examples

Run this code
data(metMUD1)
V <- cov(metMUD1$data)
# Look at the top 1%
res <- getMaxCovByFreq(metMUD1, V, Quan = 0.01)
res

Run the code above in your browser using DataLab