Residuallimit: Difference between revisions

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search
imported>Jeremy
(Importing text file)
 
imported>Jeremy
 
(9 intermediate revisions by 3 users not shown)
Line 1: Line 1:
===Purpose===
===Purpose===
Esitmates confidence limits for sum squared residuals.
 
Esitmates confidence limits for the sum of squared residuals.
 
===Synopsis===
===Synopsis===
:[rescl,s] = residuallimit(residuals,cl,''options'')
 
:[rescl,s] = residuallimit(model,cl,''options'')
:[rescl,s] = residuallimit(residuals,cl,options)
:rescl    = residuallimit(s,cl,''options'')
:[rescl,s] = residuallimit(model,cl,options)
:options = residuallimit('options');.
:rescl    = residuallimit(s,cl,options)  
:cl        = residuallimit(model,q,options)
 
===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.
 
Two alternate methods of calling RESIDUALLIMIT are:
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) 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.
 
(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.
:(a) Input the model residuals matrix <tt>residuals</tt>,
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.
 
See Jackson (1991) for the details of the calculation.
:(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.
 
A fourth method using input model and confidence interval value, <tt>q</tt>, returns a confidence level value.
 
See Jackson (1991) for details regarding this calculation.
 
====Inputs====
 
* '''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
 
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. Alternatively, these residuals can be obtained from a standard model structure <tt>model</tt>.
 
====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===
* ''options'' =  a structure array with the following fields:
 
* algorithm: [ {'jm'} | 'chi2' | 'auto' ], governs choice of algorithm:
'''options''' =  a structure array with the following fields:
*  'jm', uses Jackson-Mudholkar method (slower, more robust),
* '''algorithm''': [ {'jm'} | 'chi2' | 'auto' ], governs choice of algorithm:
*  'chi2', uses chi-squared moment method (faster, less robust with outliers), and
:''''jm',''' uses Jackson-Mudholkar method (slower, more robust),
*  'auto' automatically selects based on data size (<300 rows or columns, use 'jm', otherwise, use 'chi2')
:''''invjm',''' uses Jackson-Mudholkar method (slower, more robust) to calculate a confidence limit from a given sum of squares residual. Output is a confidence limit.
The default options can be retreived using: options = residuallimit('options');.
:*  ''''chi2',''' uses chi-squared moment method (faster, less robust with outliers),
:*  ''''invchi2',''' uses chi^2 moment method to calculate a confidence limit from a given sum square residual. Output is a confidence limit, 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===
===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);
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);
:rescl = residuallimit(residuals,0.95);
:rescl = residuallimit(residuals,0.95);
===See Also===
===See Also===
[[chilimit]], [[analysis]], [[datahat]], [[pca]]
 
[[chitest]], [[chilimit]], [[analysis]], [[datahat]], [[jmlimit]], [[pca]]

Latest revision as of 14:14, 30 May 2012

Purpose

Esitmates confidence limits for the sum of squared residuals.

Synopsis

[rescl,s] = residuallimit(residuals,cl,options)
[rescl,s] = residuallimit(model,cl,options)
rescl = residuallimit(s,cl,options)
cl = residuallimit(model,q,options)

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.

A fourth method using input model and confidence interval value, q, returns a confidence level value.

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),
  • 'invjm', uses Jackson-Mudholkar method (slower, more robust) to calculate a confidence limit from a given sum of squares residual. Output is a confidence limit.
  • 'chi2', uses chi-squared moment method (faster, less robust with outliers),
  • 'invchi2', uses chi^2 moment method to calculate a confidence limit from a given sum square residual. Output is a confidence limit, 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);

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

chitest, chilimit, analysis, datahat, jmlimit, pca