Rebecca
2012-Apr-27 15:41 UTC
[R] find the eigenvector corresponding to the largest eigenvalue
Hi, If I use the eigen() function to find the eigenvalues of a matrix, how can I find the eigenvector corresponding to the largest eigen value? Thanks! [[alternative HTML version deleted]]
Berend Hasselman
2012-Apr-27 17:25 UTC
[R] find the eigenvector corresponding to the largest eigenvalue
On 27-04-2012, at 17:41, Rebecca wrote:> Hi, > If I use the eigen() function to find the eigenvalues of a matrix, how can I find the eigenvector corresponding to the largest eigen value?What does the documentation of eigen() say in the Value section for values? Sorted in decreasing order. So the first item of ..$values is the largest eigenvalue and thus the first column of ..$vectors is the corresponding eigenvector. Example n <- 3 A <- matrix(round(runif(n*n),2),nrow=n) A evv.A <- eigen(A) evv.A k <- which(abs(evv.A$values)==max(abs(evv.A$values))) evv.A$vectors[,k] k Berend
David Winsemius
2012-Apr-27 17:39 UTC
[R] find the eigenvector corresponding to the largest eigenvalue
On Apr 27, 2012, at 11:41 AM, Rebecca wrote:> Hi, > If I use the eigen() function to find the eigenvalues of a matrix, > how can I find the eigenvector corresponding to the largest eigen > value?After reading the help page, I would have assumed that since the eigenvalues are sorted, that the eigenvectors would be sorted in the same order. Do you have reasons to doubt that they are not? -- David Winsemius, MD West Hartford, CT