eigen
Eigenvalues and Eigenvectors of a Matrix
Description
Calculates the eigenvalues and eigenvectors of a square matrix.
The eigen function is generic.
Usage
eigen(x, symmetric, only.values = FALSE, EISPACK = FALSE)
Arguments
x |
a square matrix to decompose. The matrix must not contain missing
values (NAs) or any special values of IEEE floating point
arithmetic.
For more information about IEEE special values, see IEEE Standard
for Floating-Point Arithmetic
(http://standards.ieee.org/findstds/standard/754-2008.html).
|
symmetric |
a logical value. If TRUE, x is considered symmetric, and
the algorithm examines only the lower triangle of x.
If this argument is not supplied, isSymmetric(x) is used.
|
only.values |
a logical value. If FALSE (the default) or not present, computes
both eigenvalues and eigenvectors. If TRUE, eigenvalues are
computed but the value for eigenvectors is NULL.
|
EISPACK |
a logical value. If TRUE, EISPACK is called instead of LAPACK. The default is
FALSE.
|
Details
Different algorithms are used in the symmetric and non-symmetric cases,
so the eigenvectors might not change smoothly from a symmetric matrix to
a near-by, nearly symmetric matrix.
In the case of a non-symmetric real matrix, the eigenvalues and
eigenvectors might be complex.
Eigenvalues occur frequently in statistics (especially in multivariate
analysis) as well as in other fields.
The EXAMPLES section shows a function that uses eigen
to compute determinants.
Value
returns a list containing the eigenvalues and eigenvectors of x.
values |
a list of nrow(x) eigenvalues in descending order of modulus.
|
vectors |
a matrix with the same dimension as x that returns the
eigenvectors corresponding to the eigenvalues in values.
- The jth column is the eigenvector for the jth element of
values.
- If symmetric = TRUE, then each vector has norm 1.
- If only.values = TRUE, then each vector is NULL.
If y <- eigen(x), and if x is symmetric and real, then the following
holds to numerical error:
| | x == y$vectors %*% diag(y$values) %*% t(y$vectors)
|
If y <- eigen(x), and if x is symmetric and complex, then the following
holds to numerical error:
| | x == y$vectors %*% diag(y$values) %*% t(Conj(y$vectors)) |
|
Note Any dimnames included in the input matrix x are not
included in the returned vectors matrix.
|
Background
If A is a square matrix and Ax == gx,
where g is a numeric value and x is a vector,
then g is an eigenvalue of A
and x is an eigenvector of A.
References
Maindonald, J. H. (1984).
Statistical Computation.
Wiley, New York.
Mardia, K. V., Kent, J. T. and Bibby, J. M. (1979).
Multivariate Analysis.
Academic Press, London.
Smith, B. T., Boyle, J. M., Dongarra, J. J., et al.
(1976).
Lecture Notes in Computer Science, Vol. 6, 2nd Edition.
Eigensystem Routines - EISPACK Guide.
Springer-Verlag, New York.
Thisted, R. A. (1988).
Elements of Statistical Computing.
Chapman and Hall, New York.
See Also
Examples
amat <- matrix(c(19,8,11,2,18,17,15,19,10), nrow = 3)
eigen(amat)
eigen(amat, EISPACK = TRUE)
x<-matrix(1:12, ncol =2)
pprcom <- eigen(cov(x)) # robust principal components
# compute determinant using eigenvalues:
det <- function(x) prod(eigen(x)$values)
det(amat)