Residuallimit: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
imported>Jeremy
(Importing text file)
imported>Chuck
No edit summary
Line 1: Line 1:
===Purpose===
===Purpose===


Line 8: Line 7:
:[rescl,s] = residuallimit(residuals,cl,''options'')
:[rescl,s] = residuallimit(residuals,cl,''options'')
:[rescl,s] = residuallimit(model,cl,''options'')
:[rescl,s] = residuallimit(model,cl,''options'')
:rescl    = residuallimit(s,cl,''options'')
:rescl    = residuallimit(s,cl,''options'') %fast new limits


===Description===
===Description===


Inputs are a matrix of residuals, residuals, and a frational confidence limit, cl, where 0<cl<1 {default = 0.95}. For example, for a PCA model '''X''' = '''TP'''<sup>T</sup> + '''E''', the input residuals is the matrix '''E '''which can be calculated using the datahat function or a standard model structure (model). Optional input ''options'' is discussed below. To calculate multiple confidence limits, cl can be a vector of fractional confidence limits.
This function is used to calculate confidence limits for the sum of squared residuals of a model <tt>rescl</tt>, given a user-requested confidence level <tt>cl</tt>. There are three methods of calling RESIDUALLIMIT:
 
:(a) Input the model residuals matrix <tt>residuals</tt>,
 
:(b) When using the Jackson-Mudholkar method (see options, below) the eigenvalues of the model residuals, <tt>s</tt>, can be input instead of the model residuals themselves. This is typically a faster option.
 
:(c) A standard model structure, <tt>model</tt>, can be input instead of the residuals. In this case, RESIDUALLIMIT will locate valid residual information within the model structure, and use that to calculate the limit.
 
See Jackson (1991) for details regarding this calculation.


Two alternate methods of calling RESIDUALLIMIT are:
====Inputs====


(a) When using the Jackson-Mudholkar method (see options) the eigenvalues of the residuals, s, can be passed in place of residuals. This is typically faster than passing the residuals themselves.
* '''residuals''' = matrix of model residuals
* '''cl''' = fractional confidence limit, where 0<<tt>cl</tt><1 {default = 0.95}
:* '''Note:''' To calculate multiple confidence limits, cl can be a vector of fractional confidence limits.
* '''model''' = standard model structure, containing relevant residuals information
* '''s''' = eigenvalues of the model residuals


(b) A standard model structure, model, can be passed in place of residuals. In this case, RESIDUALLIMIT will locate valid residual information within the model and use that to calculate the limit.
For example, for a PCA model:


The output is the estimated residual limit rescl. When using the Jackson-Mudholkar algorithm, an additional output, s, is also returned containing eigenvalues of '''E'''. To improve speed, s can be used in place of residuals in subsequent calls to RESIDUALLIMIT for the same data.
: '''X''' = '''TP'''<sup>T</sup> + '''E''',  


See Jackson (1991) for the details of the calculation.
the input residuals is the matrix '''E ''', which can be calculated using the [[datahat]] function. Alternatively, these residuals can be obtained from a standard model structure <tt>model</tt>.


===Options===
====Optional Inputs====


''options'' = a structure array with the following fields:
* '''options''' = options structure, discussed below.


* '''algorithm''': [ {'jm'} | 'chi2' | 'auto' ], governs choice of algorithm:
====Outputs====


* ''''jm',''' uses Jackson-Mudholkar method (slower, more robust),
* '''rescl''' = the estimated residual limit
* '''s''' = contains the eigenvalues of '''E'''; applies only when using the Jackson-Mudholkar algorithm
:* To improve speed, '''s''' can be used in place of '''residuals''' in subsequent calls to RESIDUALLIMIT for the same data.


*  ''''chi2',''' uses chi-squared moment method (faster, less robust with outliers), and
===Options===


*  ''''auto'''' automatically selects based on data size (<300 rows or columns, use 'jm', otherwise, use 'chi2')
'''options''' =  a structure array with the following fields:
* '''algorithm''': [ {'jm'} | 'chi2' | 'auto' ], governs choice of algorithm:
:*  ''''jm',''' uses Jackson-Mudholkar method (slower, more robust),
:*  ''''chi2',''' uses chi-squared moment method (faster, less robust with outliers), and
:*  ''''auto'''' automatically selects based on data size (<300 rows or columns, use 'jm', otherwise, use 'chi2')


The default options can be retreived using: options = residuallimit('options');.
The default options can be retrieved using:
:options = residuallimit('options');.


===Examples===
===Examples===


The following example will calculate the 95Found residuals confidence limit for a model, model, using the residual eigenvalues stored in the model:
The following example will calculate the 95 percent confidence limit for the sum of squared residuals of a model, model, using the residual eigenvalues stored in the model structure <tt>model</tt>:


:rescl = residuallimit(model,0.95);
:rescl = residuallimit(model,0.95);
 
Found residuals
The following example will also calculate the 95Found residuals confidence limit for a model, model, but by using the actual residuals calculated from the calibration data, data, using the datahat function:
The following example will also calculate the 95 percent confidence limit for the sum of squared residuals of a model, but by using the actual residuals calculated from the calibration data, <tt>data</tt>, using the [[datahat]] function:


:[xhat,residuals] = datahat(model,data);
:[xhat,residuals] = datahat(model,data);
Line 52: Line 70:
===See Also===
===See Also===


[[chilimit]], [[analysis]], [[datahat]], [[pca]]
[[chilimit]], [[analysis]], [[datahat]], [[jmlimit]], [[pca]]

Revision as of 13:12, 9 October 2008

Purpose

Esitmates confidence limits for sum squared residuals.

Synopsis

[rescl,s] = residuallimit(residuals,cl,options)
[rescl,s] = residuallimit(model,cl,options)
rescl = residuallimit(s,cl,options) %fast new limits

Description

This function is used to calculate confidence limits for the sum of squared residuals of a model rescl, given a user-requested confidence level cl. There are three methods of calling RESIDUALLIMIT:

(a) Input the model residuals matrix residuals,
(b) When using the Jackson-Mudholkar method (see options, below) the eigenvalues of the model residuals, s, can be input instead of the model residuals themselves. This is typically a faster option.
(c) A standard model structure, model, can be input instead of the residuals. In this case, RESIDUALLIMIT will locate valid residual information within the model structure, and use that to calculate the limit.

See Jackson (1991) for details regarding this calculation.

Inputs

  • residuals = matrix of model residuals
  • cl = fractional confidence limit, where 0<cl<1 {default = 0.95}
  • Note: To calculate multiple confidence limits, cl can be a vector of fractional confidence limits.
  • model = standard model structure, containing relevant residuals information
  • s = eigenvalues of the model residuals

For example, for a PCA model:

X = TPT + E,

the input residuals is the matrix E , which can be calculated using the datahat function. Alternatively, these residuals can be obtained from a standard model structure model.

Optional Inputs

  • options = options structure, discussed below.

Outputs

  • rescl = the estimated residual limit
  • s = contains the eigenvalues of E; applies only when using the Jackson-Mudholkar algorithm
  • To improve speed, s can be used in place of residuals in subsequent calls to RESIDUALLIMIT for the same data.

Options

options = a structure array with the following fields:

  • algorithm: [ {'jm'} | 'chi2' | 'auto' ], governs choice of algorithm:
  • 'jm', uses Jackson-Mudholkar method (slower, more robust),
  • 'chi2', uses chi-squared moment method (faster, less robust with outliers), and
  • 'auto' automatically selects based on data size (<300 rows or columns, use 'jm', otherwise, use 'chi2')

The default options can be retrieved using:

options = residuallimit('options');.

Examples

The following example will calculate the 95 percent confidence limit for the sum of squared residuals of a model, model, using the residual eigenvalues stored in the model structure model:

rescl = residuallimit(model,0.95);

Found residuals The following example will also calculate the 95 percent confidence limit for the sum of squared residuals of a model, but by using the actual residuals calculated from the calibration data, data, using the datahat function:

[xhat,residuals] = datahat(model,data);
rescl = residuallimit(residuals,0.95);

See Also

chilimit, analysis, datahat, jmlimit, pca