From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search


Test regression model for robustness to various effects.


results = testrobustness(model,x,y,testtype,options);


Given a regression model and test data x and y, this function performs one of several tests to assess the effect of different perturbations on the test data x-block. The effect on prediction error, Q and T^2 are mapped as a function of the test parameters.

Test type to perform is specified in the inputs (testtype) and can be one of the following strings:

'interference' : adds a Gaussian peak of varying width and position to the x-block data. Results are mapped by peak width and position.
'shift' : shifts and broadens the x-block data and maps the results relative to shift amount and width of broadening filter. Filter is based on savgol filter of a specified order and width (see options.)


  • model = A standard model structure containing a regression model of type PLS, PCR, MLR, or CLS. Note: Multivariate y-block models will cause the test to return the average error for all y-columns at the given conditions.
  • x = X-block of the test data (can be performed on the calibration data but results should be interpreted as relative to RMSEC rather than RMSEP.
  • y = Y-block values corresponding to the X-block data.
  • testtype = String specifying the type of test to perform (see above)

Optional Inputs

  • options = Options structure containing one or more of the fields specified in the Options section below.


  • results = Structure containing the following fields:
    • rmsep : matrix of RMSEP results for each tested condition
    • q : matrix of Q residuals for each tested condition
    • t2 : matrix of Hotellings T^2 values for each tested condition
    • xaxis : vector of tested value for mode 2 of the above matrices (use on x-axis when producing an image of the results)
    • yaxis : vector of tested value for mode 1 of the above matrices (use on y-axis when producing an image of the results)
    • xaxisname : string label describing xaxis values
    • yaxisname : string label describing yaxis values
    • dso : a DataSet object containing all the above fields with results concatenated in mode 3. Can be used in PlotGUI:
                plotgui(results.dso(:,:,1))  %plots RMSEP


Options can contain one or more of the following fields:

  • display: [ 'off' | {'on'} ] Governs level of display to command window.
  • plots : [ 'none' |{'final'}] Governs the creation of a plot summarizing the RMSEP results.

--- Options used only with test type 'interference' ---

  • peakwidthsteps : [7] Number of peak widths to test between 0 and 20 variables in width. See peakwidths to manually specify peak widths.
  • peakwidths : [] Optional explicit list of peak widths to use for interferent. If supplied, peakwidthsteps is ignored. Empty [] uses peakwidthsteps to determine widths.
  • peakspacing : [2] Spacing of interference peaks in number of variables. A value of one (1) will test the interference peaks centered at every variable. Larger values will test at fewer locations and speed the test but provide less detail for variable sensitivity.

--- Options used only with test type 'shift' ---

  • shiftlimit : [1] Maximum number of variables to test shift (negative and positive direction)
  • shiftstep : [0.05] Step size for each step of the shift test. Each sample is shifted by this number of variables between each step of the shift test.
  • deresolvemax : [21] Maximum width of deresolution filter to test. Shift test will include all odd filter sizes from 3 to this value including an "unbroadened" copy at the start.
  • deresolvewidths : [] Optional explicit list of deresolution filter widths to test. If supplied, deresolvemax is ignored. Empty [] uses deresolvemax to determine widths.
  • deresolveorder : [0] Optional order of the polynomial broadening filter. Value of zero (0) will use an box filter. Higher values will use the specified polynomial filer.

See Also

cls, crossval, mlr, pls, pcr, savgol