Mscorr

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search

Purpose

Multiplicative scatter/signal correction (MSC).

Synopsis

[sx,alpha,beta,xref] = mscorr(x,xref)
[sx,alpha,beta,xref] = mscorr(x,options)
[sx,alpha,beta,xref] = mscorr(x,xref,options)
[sx,alpha,beta,xref] = mscorr(x,xref,mc,win,specmode,subind)

Description

MSCORR performs 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.

Inputs

  • x = input spectra (class double).

Optional Inputs

  • xref = reference or "target" spectrum. If empty, mean of (x) is used.,
  • mc = flag indicating if an offset should be removed from the spectra in addition to correcting scaling. 1 = correct for offset, 0 = do not remove offset. Default is 1,
  • win = allows for scatter correction in spectral "windows" that can be of different widths. Input (win) is a cell array with NK elements corresponding to the number of windows desired. Each cell of (win) contains the indices corresponding to each window (i.e. this is not a moving window approach - see STDFIR). MSC is then performed in each of the NK windows. (alpha and beta are not assigned). If (win) is empty, the entire spectrum is treated at once (standard approach),
  • specmode = defines which mode of the data is the spectral mode (default = 2) and is only used when (x) contains 3 or more modes.
  • subind = specifies the indices within the included spectral variables that are used to calculate the MSC correction; default is that ALL included spectral variables are used. Correction is always applied to the entire spectrum even if subind indicates that only a sub-portion should be used to calculate correction factors.

Outputs

  • sx = corrected spectra,
  • alpha = the intercepts/offsets,
  • beta = the multiplicative scatter factor/slope,
  • xref = the reference spectrum used.

Options

options = structure array with the following fields :

  • algorithm: [ {'leastsquares'} | 'median' ] Specifies spectrum scale factors are determined. Default by least squares regression between between each spectrum and the reference spectrumj. 'median' uses the median of the ratio between a spectrum and the reference. Thus median is only appropriate if most values are non-negative. If algorithm = 'median' then mc is set = 0,
  • mc: [{1} | 0] See description above,
  • win: [{[]} | cell array] See description above,
  • specmode: [{2}] See description above,
  • subind: [vector] See description above.

Algorithm

For input spectra x (1xN) and reference spectra xref (1xN) the model is:

and the corrected spectra xs (1xN) is given by:


See Also

frpcr, stdfir, stdgen