Chilimit

From Eigenvector Research Documentation Wiki
Jump to navigation Jump to search

Purpose

Chi-squared confidence limits from sum-of-squares residuals.

Synopsis

[lim,scl,dof] = chilimit(ssqr,cl)
lim = chilimit(scl,dof,cl)
cl = chilimit(scl,dof,ssqr,2) %calculate conf. level for ssqr
cl = chilimit(ssqr,new_ssqr,[],2) %calculate conf. level for new_ssqr

Description

CHILIMIT determines a confidence limit for sum-of-squares residuals by fitting the residuals to the g Chi-squared h distribution. If the sum-squared residuals are reasonably approximated by a Chi-squared distribution this gives a very good estimate of the confidence level. However, it has been observed that outliers can significantly bias the estimate.

CHILIMIT can also calculate the confidence level corresponding to a given sum squared residual value (see flag and Calculating Confidence Level below)

Inputs

  • ssqr = sum-of-squares residuals (a.k.a. Q)

Optional Inputs

  • cl = confidence level (0<cl<1) {default = 0.95}
  • flag = indicates if the inverse calculation should be done (=2) or the standard calculation should be done (=1) {default = 1}

Outputs

  • lim = calculated limit.
  • scl = scaling determined from the residuals.
  • dof = degrees of freedom determined from the residuals.

The scaling, (scl), and number of degrees of freedom, (dof), returned from a previous call to CHILIMIT can be used in subsequent calls to CHILIMIT to obtain new limits without the original residuals.

Calculating Confidence Level

To calculate the confidence level (the inverse of the standard calculation), CHILIMIT can be called either with the scaling, degrees of freedom, ssqr, and a flag indicating that the inverse calculation should be done:

cl = chilimit(scl,dof,ssqr,2);

or by passing a vector of ssqr values representing the distribution to estimate from and the new ssqr value(s) to calculate confidence levels for:

cl = chilimit(ssqr,new_ssqr,[],2)

In this second case, the ssqr values are used to estimate the scaling and degrees of freedom and then this is applied to the new_ssqr values to calculate the corresponding confidence levels.

See Also

chitest, distfit, jmlimit, pca, pcr, plotqq, pls, residuallimit