Multivariate data are frequently decomposed by methods like principal
component analysis, partial least squares, linear discriminant analysis, and
the like. These methods yield latent spectra (or latent variables,
loadings, components, …) that are linear combination coefficients
along the wavelength axis and scores for each spectrum and loading.
The loadings matrix gives a coordinate transformation, and the scores are
values in that new coordinate system.
The obtained latent variables are spectra-like objects: a latent variable
has a coefficient for each wavelength. If such a matrix (with the same
number of columns as object
has wavelengths) is given to
decomposition
(also setting scores = FALSE
), the spectra
matrix is replaced by x
. Moreover, all columns of object@data
that did not contain the same value for all spectra are set to NA
.
Thus, for the resulting hyperSpec
object, plotspc
and
related functions are meaningful. plotmap
cannot be
applied as the loadings are not laterally resolved.
The scores matrix needs to have the same number of rows as object
has
spectra. If such a matrix is given, decomposition
will replace the
spectra matrix is replaced by x
and object@wavelength
by
wavelength
. The information related to each of the spectra is
retained. For such a hyperSpec
object, plotmap
and
plotc
and the like can be applied. It is also possible to use
the spectra plotting, but the interpretation is not that of the spectrum any
longer.