cm.sr: Selecting the best 2-Band combinations for Simple Ratio (SR)

View source: R/cm.sr.R

cm.srR Documentation

Selecting the best 2-Band combinations for Simple Ratio (SR)

Description

This function develops an optimization algorithm based on correlation analysis between the spectral matrix spectra and the vegetation variable of interest x. It determines the best spectral band combinations of the full spectrum that are most predictive for x.

Usage

cm.sr(S, x, w = wavelength(S), w.unit = NULL, cm.plot = FALSE)

Arguments

S

A matrix of spectral data, where each row is a spectrum across all spectral bands.

x

A numeric vector (e.g., a vegetation variable).

w

A numeric vector of wavelengths; by default it is derived using wavelength(S).

w.unit

A character string specifying the unit of wavelengths (default is NULL).

cm.plot

Logical. If TRUE, the correlation coefficient matrix is plotted.

Details

This function runs a calculation of

SR = \lambda_i / \lambda_j

using the spectra data for all the possible pairs/combinations of any two bands (i, j) within the full spectrum range. Next, correlation analysis is then performed between all possible SR values and another vector variable y, and it returns the squared Pearson correlation (R^2) which indicates the predictive performance of each SR and its corresponding two-band combination. The output is the wavelength (nm) indicating the best two bands that produce the highest value of R^2.

Value

cm

Returns a correlation coefficients matrix.

See Also

cm.nsr

Examples

## Not run: 
  library(visa)
  data(NSpec.DF)
  # Using the example spectra matrix of the spectra.dataframe
  X <- NSpec.DF$spectra[, seq(1, ncol(NSpec.DF$spectra), 10)]  # resampled to 10 nm steps
  y <- NSpec.DF$N  # nitrogen
  cm <- cm.sr(X, y, cm.plot = FALSE)

## End(Not run)


visa documentation built on April 4, 2025, 5:40 a.m.