cm.nsr: Selecting the best 2-Band combinations for Normalized Simple...

View source: R/cm.nsr.R

cm.nsrR Documentation

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

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 (i, j) of the full spectrum that are most predictive for x.

Usage

cm.nsr(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

For every possible pair of distinct bands (i, j), the function calculates

\mathrm{NSR} = \frac{R_j - R_i}{R_j + R_i}

and then computes the squared Pearson correlation (R^2) between x and the resulting NSR values.

If the two bands are identical or the standard deviation of computed VI (for a given band combination) is zero, the correlation is set to 0, thereby avoiding warnings.

Value

cm

A correlation coefficient matrix with squared Pearson correlation values.

See Also

cor

Examples

## Not run: 
  library(visa)
  data(NSpec.DF)
  X <- NSpec.DF$spectra[, seq(1, ncol(NSpec.DF$spectra), 5)]  # resampled to 5 nm steps
  y <- NSpec.DF$N  # nitrogen
  cm <- cm.nsr(X, y, cm.plot = TRUE)

## End(Not run)


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