# Msc settings gui

The MSC Settings GUI allows you to select options relevant to the use of applying Multiplicative Scatter Correction (MSC) to your data.

Multiplicative scatter correction (a.k.a. multiplicative signal correction) on an input matrix of spectra x (class "double") regressed against a reference spectra xref (class "double"). If (xref) is empty or omitted, the mean of (x) is used as the reference (or median of (x) if options.algorithm = 'median').

If the optional input mc is 1 {default} then an intercept is used. If mc is set to 0 (zero) then a force fit through zero is used.

Optional input win is a NK element cell array of indices corresponding to windows to perform MSC, i.e. MSC is performed in each window win{i} for i=1:NK. In this case, (alpha and beta are not assigned). Optional input (specmode) defines which mode of the data is the spectral mode (default = 2) and is only used when (x) contains 3 or more modes. Optional input (subind) specifies the indices within the included spectral variables that are used to calculate the MSC correction factors (alpha and beta); default is that ALL included spectral variables are used.

Outputs are the corrected spectra sx, the intercepts/offsets alpha, the multiplicative scatter factor/slope beta, and the reference spectrum xref.

Note: the 'median' method does not work well if there are many negative values in xref or x samples.

**Reference Data**:

Reference or "target" spectrum that the data is regressed against. Default is to use the mean of the data (If the **median** algorithm is selected then the median of the data is used as the reference and not the mean). Use the **Load** button to load a reference vector of type double.

**Use Intercept**:

This is a flag indicating if an offset should be removed from the spectra in addition to correcting scaling. If checked then the offset is corrected, if unchecked then the offset is not removed. Default is to correct for offset.

**Spectral Mode**:

Defines which mode of the data is the spectral mode (default = 2) and is only used when the data contains 3 or more modes.

**Window**:

Allows for scatter correction in spectral "windows" that can be of different widths. Use the **Select** button to enter variable index values or to graphically select regions. Use the **All Variables** button to reset the window selection to use all variables. MSC is will be performed in each of the windows (alpha and beta are not assigned). The standard approach is to use the entire spectrum.

**Subindices**:

Specifies the indices within the included spectral variables that are used to calculate the MSC correction. The default is that ALL included spectral variables are used. Correction is always applied to the entire spectrum even if subindices are used to calculate the correction factors.

**Algorithm**:

Specifies how the spectrum scale factors are determined. The default is by **least squares** regression between between each spectrum and the reference spectrum. If **median** is selected then the median of the ratio between a spectrum and the reference. If median is used the offset is not removed (**Use Intercept** becomes unchecked), and if no reference is given then the median of the data is used as the reference. Median is only appropriate if most values are non-negative.