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

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to