kappa
Compute the Exact or Estimated Condition Number

Description

Computethe exact or estimated condition number of a matrixbased on various norms.
Thisfunction is an S Version 3 generic. One can write methods handlenew classes of data. Classes that already have methods includematrix, lm, and qr.

Usage

#Generic function 
kappa(z,...) 

## Default S3 method: kappa(z,exact = FALSE, norm = NULL, method = c("qr", "direct"), ...) ## S3 method for class 'lm': kappa(z,...) ## S3 method for class 'qr': kappa(z,...)

.kappa_tri(z,exact = FALSE, LINPACK = TRUE, norm = NULL, ...)

Arguments

z amatrix or an object, like a fitted model, thatcontains information from a decomposition of some matrix.
exact logicalvalue. If TRUE, the exact 2-norm condition number, basedon the extrema of the singular values, is returned. Otherwisea more quickly computed approximate condition number is returned.
norm characterstring specifying the norm type of matrix. It is one of"2", "1", "O" or "I". See the help file norm fordetails. Thedefault NULL is interpreted as 2-norm type in kappa.default, or1-norm type in .kappa_tri.
method Either"qr" or "direct". If "direct" the matrix zwill be assumed to be upper triangular -- the values in its lowertriangle will be taken to be 0. If"qr", the default, then the condition number will be computed fromthe the (upper triangula) R matrix of the QR decompostion of z. Thisargument is ignored when exact is TRUE: only the approximatemethods require an upper triangular matrix.
LINPACK Thisargument is ignored and is here only for compatibility with R 2.15.1.
... other arguments are ignored by the methods described above. Methods defined inother packages may use more arguments.

Details

Thecondition number of a matrix is the product of the matrix and the norm of itsinverse (or pseudo-inverse if the matrix is not square). Sinceit can take on values between 1 and infinity, inclusive, itcan be viewed as a measure of how close a matrix is to being rank deficient. Itcan also be viewed as a factor by which errors in solving linear systems withthis matrix as coefficient matrix could be magnified.
Conditionnumbers are usually approximate, since exact computation is costly interms of floating-point operations. The exact condition number of 2-norm type matrix isthe ratio of the largest to the smallest non-zero singular value decomposition of the matrix(callfunction svd) .
Methodsfor kappa generally use a cheap approximation to this. Theycall the "internal" function .kappa_tri directly or indirectly to do the linear algebra. .kappa_tricomputes the approximate condition number of a triangular square matrix byusing the LINPACK subroutine "dtrco" ("ztrco" for complex matrices) for the 2-norm and theLAPACK subroutine "dtrcon" ("ztrcon" for complex matrices) for the 1- and Infinity-norms. (Whenexact is TRUE it uses svd to compute the 2-norm condition number.)
Value
anestimate of the condition number (large values indicate near-singularity ofthe matrix) if exact is FALSE, or an exact condition number of 2-norm typematrix if exact is TRUE.
SNextSpec
[xipan,2011-04-18]: Review and update the most of content to be compatible with R.
SNextS-PLUS Diff
[xipan,2011-04-18]: kappa.qr() and .kappa.tri() are not implemented in S-PLUS. Arguments"exact", "norm", "method" and "LINPACK" are not supported in S-PLUS. kappa.upper()and kappa.svd.righ() are removed from TIBCO Enterprise Runtime for R.
FileInfo
$Rev: 17391 $ $Date: 2014-05-12 11:18:31 -0700 (Mon, 12 May 2014) $ $Id: kappa.Rd 17391 2014-05-12 18:18:31Z skaluzny $
RVersion
R-2.13.0or earlier
References
Chambers, J. M. (1992) Linear models. Chapter 4 of Statistical Models in S eds J. M. Chambers and T. J. Hastie, Wadsworth & Brooks/Cole.
Anderson. E. and ten others (1999) LAPACK Users' Guide. Third Edition. SIAM.
Available on-line at http://www.netlib.org/lapack/lug/lapack_lug.html.
See Also
norm,rcond, qr
Examples
kappa(var(Sdatasets::fuel.frame[,1:4]))
kappa(var(Sdatasets::fuel.frame[,1:4]), norm = "I")

fitMpg <- lm(Fuel ~ Weight + Type, data=Sdatasets::fuel.frame) kappa(fitMpg) kappa(fitMpg, exact=TRUE)

Package base version 4.0.0-28
Package Index