Reputation: 99
I calculated the eigen of a matrix:
e <- eigen(t)
Now I need to get the dominant eigenvalue and dominant eigenvector
Is the dominant eigenvalue calculated:
e$values[1]
And what about the dominant eigenvector? Is it extracted by:
e$vectors[,1]
I am asking since I thought that e$values will give me the eigenvalues from largest to smallest...but I am getting these results:
[1] 1.000000e+00 3.751736e-01 3.751736e-01 -4.143304e-01 -4.143304e-01
[6] -4.330604e-01 -4.330604e-01 -7.921977e-02 -7.921977e-02 5.948138e-02
[11] 5.948138e-02 6.969758e-04 6.969758e-04 -4.057858e-02 -4.057858e-02
[16] 3.039333e-02 3.039333e-02 8.007672e-03 8.007672e-03 -2.005426e-02
[21] -2.005426e-02 2.361154e-02 2.361154e-02 1.023211e-02 1.023211e-02
[26] 1.099767e-02 1.099767e-02 -9.547037e-03 -9.547037e-03 1.070972e-02
[31] 1.070972e-02 -1.925037e-03 -1.925037e-03 -2.908073e-03 -2.908073e-03
[36] 1.517843e-04 1.517843e-04 -1.088992e-04 -3.070693e-10 3.070676e-10
Upvotes: 0
Views: 1720
Reputation: 5673
from the help function:
values
a vector containing the (p) eigenvalues of x, sorted in decreasing order, according to Mod(values) in the asymmetric case when they might be complex (even for real matrices). For real asymmetric matrices the vector will be complex only if complex conjugate pairs of eigenvalues are detected. vectors
either a (p\times p) matrix whose columns contain the eigenvectors of x, or NULL if only.values is TRUE. The vectors are normalized to unit length.
It says decreasing order, and a matrix whose column contain the vectors, so yes it would be
e$values[1]
e$vectors[,1]
Dont't forget that if you want more help, you should provide an reproducible example in order us to understand what's wrong
Upvotes: 3