This function performs multiplicative scatter/signal correction (MSC) on an input data of spectra. It corrects for multiplicative and additive effects in the spectral data by regressing against a reference spectrum.
Arguments
- x
A numeric matrix or data frame containing the input spectra. Each row represents a sample, and each column represents a spectral variable.
- xref
An optional numeric vector representing the reference spectrum. If
NULL
(default), the mean or median ofx
is used as the reference.- drop.offset
A logical value indicating whether the offset should be removed from the spectra (default is
TRUE
).- robust
A logical value indicating whether the mean or median of
x
is used asxref
.- window
An optional list of numeric vectors specifying the indices of spectral windows. If provided, MSC is performed separately for each window.
- drop.na
A logical value indicating whether to remove missing values (NA) from the calculations. If
TRUE
(the default), missing values will be removed. IfFALSE
, missing values will be included.