cm.nsr | R Documentation |
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
.
cm.nsr(S, x, w = wavelength(S), w.unit = NULL, cm.plot = FALSE)
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 |
w.unit |
A character string specifying the unit of wavelengths (default is |
cm.plot |
Logical. If |
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.
cm |
A correlation coefficient matrix with squared Pearson correlation values. |
cor
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.