MCR Contrast Constraint and Stepwise regrcls: Difference between pages

From Eigenvector Research Documentation Wiki
(Difference between pages)
Jump to navigation Jump to search
imported>Jeremy
 
imported>Donal
(Created page with "===Purpose=== STEPWISE_REGRCLS Step-wise regression for CLS models. ===Synopsis=== :[c,ikeep,res] = stepwise_regrcls(x,targspec,options); :options = stepwise_regrcls('options'...")
 
Line 1: Line 1:
This page discusses use of the contrast constraint for Multivariate Curve Resolution ([[Mcr|MCR]]) by Alternating Least Squares ([[als|ALS]]). More information on MCR can be found on the function pages discussing [[mcr|MCR]] and [[als|ALS]] as well as in the chemometrics tutorial.
===Purpose===
STEPWISE_REGRCLS Step-wise regression for CLS models.


===Introduction===
===Synopsis===
:[c,ikeep,res] = stepwise_regrcls(x,targspec,options);
:options  = stepwise_regrcls('options');


When resolving mixture data into pure component spectra and their contributions, a range of solutions are possible. In order to narrow down or eliminate some solutions, constraints are used in MCR. The requirement of positivity (non-negativity) is the most widely used constraint.
===Description===
For a given set of measured spectra (x), STEPWISE_REGRCLS finds the subset of target spectra (targspec) that best fit each measured spectrum in (x). This can be used for classification i.e. an analyte identification algorithm. The model is:
    x(i,:) = c(i,:)*targspec(ikeep{i},:)
where c(i,:) can be determined using non-negative least-squares
[see optional input (options)].


The solution obtained from MCR is also influenced by the starting estimate. For example, when samples of the expected pure components are likely present in the data set, you initialize the MCR process with the "most pure" spectra available in the data set. This is done by having the MCR option "initmode" set to 1, for rows (the default). This selects the most pure samples to initialize the algorithm. In this way, you obtain resolved spectra with a maximum contrast.
===Inputs===
* '''x''' = MxN matrix of measured spectra (each row corresponds to a measured spectrum).
* '''targspec ''' = KxN matrix of target (candidate) spectra.


Conversely, when pure variables (variables with contributions from only one of the components in the mixtures) are likely, for example in mass spectrometry, the option "initmode" can be changed to 2 (columns), leading to selection of more pure variables as an initial guess and, thus, maximum contrast in the spectra.
===Outputs===
* '''c''' = MxK matrix of concentrations / contributions, c is non-zero only if a corresponding target spectrum is retained. If (options.p) is not empty, then (c) is Mx(Kp+K) where the first Kp rows correspond to the spectra in (options.p).
* '''ikeep ''' = Mx1 cell array of indices, each cell corresponds to a row of input (x) and includes the indices of retained target spectra.
* '''res ''' = Mx1 vector of mean sum-squared-residuals.


The problem is that, even with the proper initialization and non-negativity constraints, the solution often does not show expected maximum contrast (in spectra or contributions). This is because there are still many possible solutions which meet the required criteria. This is often described as saying that the feasiable bounds of the problem are large. The "contrast" constraint can be used to help solve this problem and provide a more desired solution.
===Options===
''options'' =  an optional options structure containing one or more of the following fields:


===Example of Use===
* '''display''': [ 'off' | {'on'} ], governs level of display to command window,
* '''automate''': [ {'yes'} | 'no' ], automate the algorithm?
:automate = 'yes', makes no plots, and the step-wise regression stops when the fit improvement is not sigificant in an F Test at the probability level given in options.fstat.
:automate = 'no', requires interactive user input for each of the M spectra in (x).


The contrast constraint can be demonstrated with energy dispersive X-ray spectrometry (EDS) of a sample described in Figure 1. For complete details about the new constraint and the data analysis example shown below (fully discussed in reference '''(1)''').


:[[File:c:\data\image\Picture1.jpg]]
        fstat: 0.95, probability level the F test that determines the
:'''Figure 1.''' (a) An SEM image of the wires sample consisting of metal wires embedded in an epoxy matrix, together with the composition key. (b) The mean EDS spectrum computed from the data set. A 1024-channel spectrum was acquired each pixel in the 128-pixel x 128-pixel image (c) A single-pixel spectrum from the Cu/Mn/Ni wire.
                significance of fit improvement.
 
          ccon: [ 'none' | {'nnls'} ], uses non-negativity on concentrations,
In order to reduce to the noise and speed up calculations the data set was reduced image was calculated by averaging 3×3 block of pixels. The goal of MCR analysis is to discriminate the six alloys, which should lead to six resolved components with each a row of replicate samples. In other words, we want images (contributions with maximum contrast).  Analysis of this sample with MCR with its default settings results in 8 components: in addition to the six components there are two background components, see Figure 2 under MCR.  
                in the concentration estimates.
 
          ccov: [], sqrt inverse noise/clutter covariance matrix,
:
                e.g. if Xc is a matrix of measured clutter spectra then
:'''Figure 2.''' The resolved images and spectra of regular MCR and of MCR with contribution contrast. The results are ordered to show the subsequent alloys.
                ccov = inv(sqrt(cov(Xc))) [see COV_CV].
 
            p: KpxN matrix of spectra that are always included in the
Although 5 of the 6 images of the MCR results show single alloys, the first image is more complex. The highest contribution in the first image is Cu, the other two sets of replicates of alloys also contain a high amount of Cu: 83% an70%. Although this obviously reflects the proper relation between the samples it does not show the relation we want: single alloys. In order obtain maximum contrast MCR is called again with contrast option set to "a" (automatic).
                model.
 
          scls: [1:N],   % 1xN spectra scale axis {default = 1:N}.
As the results under image contrast show, this achieves the goal of separating the alloys. For more examples, including enhancing contrast in the resolved spectra, see reference '''(1)'''.
 
:'''(1)''' M.R. Keenan, “Multivariate Analysis of Spectral Images Composed of Count Data” in Techniques and applications of hyperspectral image analysis, H.F. Grahn and P.  Geladi, Eds (Wiley, Chichester, UK, 2007)  , pp. 89-126.
 
===Using Contrast in the Analysis Window===
 
To use the contrast option in the Analysis window, modify the Methods Options (see [[AnalysisWindow_Toolbar]] ) and choose either "s" (spectral contrast), "c" (contributions contrast), or "a" (automatic) for the <tt>alsoptions.contrast</tt> option.
 
===Using Contrast with Command-line Functions===
 
To use the contrast option from the Matlab command line with PLS_Toolbox, use the <tt>alsoptions.contrast</tt> option in [[MCR]] (or the <tt>contrast</tt> option in [[ALS]])
 
<pre>
>> options=mcr('options');
>> options.alsoptions.contrast='a';
</pre>
 
MCR will achieve contrast in the current initmode, which is 1.
 
 
===Algorithm===
 
When maximum contrast in spectra needs to be achieved, the angle between their vectors is maximal. So by manipulating angles, contrast can be achieved. The constraint works by adding small amounts of a unit vector to either the concentrations or the spectra, depending on which mode of contrast is desired. This has the effect of pushing the opposite mode's recovered components to have as big an angle as possilbe (be as different as possible = high contrast).

Revision as of 16:39, 8 March 2011

Purpose

STEPWISE_REGRCLS Step-wise regression for CLS models.

Synopsis

[c,ikeep,res] = stepwise_regrcls(x,targspec,options);
options = stepwise_regrcls('options');

Description

For a given set of measured spectra (x), STEPWISE_REGRCLS finds the subset of target spectra (targspec) that best fit each measured spectrum in (x). This can be used for classification i.e. an analyte identification algorithm. The model is:

    x(i,:) = c(i,:)*targspec(ikeep{i},:)

where c(i,:) can be determined using non-negative least-squares [see optional input (options)].

Inputs

  • x = MxN matrix of measured spectra (each row corresponds to a measured spectrum).
  • targspec = KxN matrix of target (candidate) spectra.

Outputs

  • c = MxK matrix of concentrations / contributions, c is non-zero only if a corresponding target spectrum is retained. If (options.p) is not empty, then (c) is Mx(Kp+K) where the first Kp rows correspond to the spectra in (options.p).
  • ikeep = Mx1 cell array of indices, each cell corresponds to a row of input (x) and includes the indices of retained target spectra.
  • res = Mx1 vector of mean sum-squared-residuals.

Options

options = an optional options structure containing one or more of the following fields:

  • display: [ 'off' | {'on'} ], governs level of display to command window,
  • automate: [ {'yes'} | 'no' ], automate the algorithm?
automate = 'yes', makes no plots, and the step-wise regression stops when the fit improvement is not sigificant in an F Test at the probability level given in options.fstat.
automate = 'no', requires interactive user input for each of the M spectra in (x).


        fstat: 0.95, probability level the F test that determines the
               significance of fit improvement.
         ccon: [ 'none' | {'nnls'} ], uses non-negativity on concentrations,
               in the concentration estimates.
         ccov: [], sqrt inverse noise/clutter covariance matrix,
               e.g. if Xc is a matrix of measured clutter spectra then
               ccov = inv(sqrt(cov(Xc))) [see COV_CV].
            p: KpxN matrix of spectra that are always included in the
               model.
         scls: [1:N],   % 1xN spectra scale axis {default = 1:N}.