Residuallimit

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search

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