Open Lab/Preprocessing · Method

Multiplicative Scatter Correction

MSC

A reference based spectral preprocessing method that estimates and corrects additive and multiplicative scatter effects.

SpectroscopyNIRScatter CorrectionPythonMATLABTutorial
Wavelength (nm)Intensity
Wavelength (nm)MSC
01

What is MSC?

Multiplicative Scatter Correction is a spectral preprocessing method that estimates and corrects additive and multiplicative effects relative to a reference spectrum.

The method is closely associated with diffuse reflectance spectroscopy and near-infrared preprocessing. In the classical formulation, each spectrum is modelled as approximately related to a reference through an intercept and a slope.

Those parameters are estimated by least squares. The spectrum is then corrected by subtracting the estimated intercept and dividing by the estimated slope.

02

Why use MSC?

Diffuse reflectance spectra can contain variation associated with light scattering and physical sample properties in addition to the chemical absorption information of interest.

The original MSC work proposed a multi-wavelength correction that estimates an additive term and a multiplicative term for each spectrum relative to a reference. Those estimated effects are then removed before further analysis.

MSC does not remove all physical variation, and it does not isolate pure chemical information. It should not be assumed to improve every calibration or prediction task. Its value depends on the dataset and on the analysis that follows.

03

How does it work?

The operation is row-wise. For a matrix of samples by spectral variables, each spectrum is corrected against the same reference.

  1. Define a reference spectrum.
  2. In the classical implementation, the mean spectrum of the calibration set is commonly used as that reference.
  3. For each spectrum, fit a simple linear regression against the reference.
  4. Estimate an intercept for the additive contribution and a slope for multiplicative scaling.
  5. Subtract the estimated intercept.
  6. Divide by the estimated slope.

The corrected spectrum is then expressed relative to the reference. Other reference choices are possible. The mean spectrum is a common practical choice, not the only one.

04

Mathematics & algorithm

Let be spectrum and let be the reference spectrum. Ordinary least squares is used to estimate the additive and multiplicative coefficients.

Mathematical foundation

(1)
(2)
(3)
spectrum / sample index
number of spectra
measured spectrum i
reference spectrum
estimated additive offset
estimated multiplicative coefficient
vector of ones
residual vector after the fit
MSC-corrected spectrum

Interpretation

Equation 1 is the classical linear model of a spectrum against the reference. Equation 2 is the correction. Equation 3 is the mean spectrum, a common reference for a calibration set, not the only possible choice. A slope near zero cannot be used as a divisor.

Algorithm 1

Multiplicative Scatter Correction

InputSpectral matrix , optional reference

OutputMSC-corrected matrix

  1. 01if no reference spectrum is provided then
  2. 02
  3. 03end if
  4. 04for to do
  5. 05 ← spectrum
  6. 06estimate by least squares
  7. 07
  8. 08if then
  9. 09error("slope near zero")
  10. 10end if
  11. 11
  12. 12end for
  13. 13return

This pseudocode is a SPARKS representation of Equations 1 to 3. It is not a verbatim extract from the cited papers. If no reference is supplied, the mean spectrum of X is used.

05

Visual example

The traces differ by additive offset and a global multiplicative scale relative to the mean spectrum (dashed). MSC regresses each row on that reference and removes the fitted intercept and slope.

Wavelength (nm)IntensityBefore
Wavelength (nm)MSCAfter
Controlled scatter model. Dashed: mean reference. Left: raw traces. Right: MSC-corrected rows.
06

Code

The functions below are SPARKS implementations of Equations 1 and 2. They are not copied from the cited papers. Both operate on a matrix with rows as samples and columns as spectral variables. Each spectrum is regressed on the reference, so the dependent variable is the measured spectrum and the independent variable is . If no reference is supplied, the mean spectrum of the supplied matrix is used. A slope near zero is rejected.

import numpy as np def msc(X, reference=None):    X = np.asarray(X, dtype=float)     # reference=None uses mean(X) of the supplied matrix. Pass the    # calibration mean explicitly when transforming new spectra.    if reference is None:        reference = X.mean(axis=0)     reference = np.asarray(reference, dtype=float)    X_msc = np.empty_like(X)     for i, spectrum in enumerate(X):        slope, intercept = np.polyfit(reference, spectrum, 1)         if np.isclose(slope, 0.0):            raise ValueError(                "MSC cannot correct a spectrum with an estimated slope near zero."            )         X_msc[i] = (spectrum - intercept) / slope     return X_msc 
07

Practical notes

  • MSC estimates additive and multiplicative effects relative to a reference spectrum.
  • The selected reference influences the correction. The mean spectrum of the calibration set is commonly used.
  • MSC and SNV can give similar looking corrected spectra, but they are not geometrically identical and should not be treated as strictly interchangeable.
  • MSC should not be assumed to improve every downstream model. Preprocessing should be chosen with the dataset and the analysis in mind.
  • If the reference is a mean spectrum, estimate it from the calibration set only. Apply that same reference to validation or test spectra. Do not recompute the mean independently on the test set in a predictive workflow.
08

References

  1. 1.

    Geladi, P., MacDougall, D., & Martens, H. (1985). Linearization and Scatter-Correction for Near-Infrared Reflectance Spectra of Meat. Applied Spectroscopy, 39(3), 491-500.

    doi:10.1366/0003702854248656
  2. 2.

    Rinnan, Å., van den Berg, F. W. J., & Engelsen, S. B. (2009). Review of the most common pre-processing techniques for near-infrared spectra. TrAC Trends in Analytical Chemistry, 28(10), 1201-1222.

    doi:10.1016/j.trac.2009.07.007
  3. 3.

    Fearn, T., Riccioli, C., Garrido-Varo, A., & Guerrero-Ginel, J. E. (2009). On the geometry of SNV and MSC. Chemometrics and Intelligent Laboratory Systems, 96(1), 22-26.

    doi:10.1016/j.chemolab.2008.11.006