Skip to contents

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.

Usage

msc(
  x,
  xref = NULL,
  drop.offset = TRUE,
  robust = TRUE,
  window = NULL,
  drop.na = TRUE
)

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 of x 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 as xref.

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. If FALSE, missing values will be included.

Value

A list with the following components:

correction

The corrected spectra.

offset

The intercepts/offsets.

slope

The multiplicative scatter factors/slopes.

Author

Christian L. Goueguel