chol
Choleski Decomposition of Symmetric Matrix
Description
Returns an upper-triangular matrix, which is the Choleski decomposition
of a (hermitian) symmetric, positive definite (or positive semi-definite) matrix.
This function is generic and only the default method is implemented now.
Usage
# Generic function
chol(x, ...)
## Default S3 method:
chol(x, pivot = FALSE, LINPACK = pivot, ...)
Arguments
x |
a symmetric, positive semi-definite numeric matrix (for example, a correlation
matrix or a cross-product matrix).
Missing values are not accepted.
Complex matrices are not accepted yet.
|
pivot |
a logical value. If TRUE, pivot. The default is FALSE.
This argument is useful to see if x is of full rank, or to
decompose a matrix that might not be of full rank.
|
LINPACK |
This argument is ignored unless pivot=TRUE, in which case
you can choose between the Linpack dchdc and the Lapack dpstf2.
The Lapack code fails if x is numerically indefinite, but the
Linpack code does not fail. Rather, the Linpack code does what it can,
putting the linearly-independent columns at the front of the result and
giving you an estimate of the rank (that is, the number of linearly independent columns).
The rank estimate is often an overestimate: use qr, svd, or eigen
to get a better estimate.
When no no pivoting is specified, chol uses the Lapack dpotrf.
|
... |
other arguments to pass to or from function/methods.
|
Details
If pivot is TRUE, the result contains attributes rank and
pivot. These attributes contain, respectively, the index of the last positive
computed diagonal element, and the pivoting of the columns.
For y <- chol(x,TRUE), column i of y corresponds to row/column
attr(y,"pivot")[i] of x.
Value
returns an upper-triangular matrix, y, such that t(y) %*% y equals x.
# if x is numeric or such that t(Conj(y) %*% y equals x if
# x is complex.
If pivot=TRUE was given, then the matrix has the extra attributes
pivot and rank, giving the permutation of the columns and the
estimated rank, respectively.
Background
A positive definite matrix is decomposed into a triangular matrix that
is a "square root" of the original. That is, the (conjugate) transpose of the
triangular matrix multiplied by the triangular matrix equals the original
matrix.
Systems of equations can be solved efficiently using this decomposition.
As a historical note, Andre-Louis Choleski (1875-1918) was
attached primarily to the Geodetic Section of the French government and was involved
in several large scale-surveys (Maindonald, 1984, pp 346-348).
References
Thisted, R. A. 1988. Elements of Statistical Computing. New York, NY: Chapman and Hall.
Dongarra, J. J., et al. 1979. LINPACK Users' Guide. Philadelphia, PA: SIAM Publications.
Golub, G. H. and Van Loan, C. F. 1983. Matrix Computations. Baltimore, MD: Johns Hopkins University Press.
Maindonald, J. H. 1984. Statistical Computation. New York, NY: Wiley.
See Also
Examples
v <- var(Sdatasets::fuel.frame[,1:3])
chol(v)
chol(v, pivot = TRUE)