Dear Friends I am doing a simple matrix analysis to calculate the eigenvalue, eigenvector using R for the below matrix, and comparing the result to those obtained from a projection (using excel) THE MATRIX:> c[,1] [,2] [,3] [1,] 0.0 2.0 2 [2,] 0.8 0.0 0 [3,] 0.0 0.8 0 The dominant eigenvalue comes out comparable to that calculated numerically, but the eigenvectors do not( see below)! EIGENVALUES (calculated by R):> eigen(c)$values [1] 1.5564082+0.000000i -0.7782041+0.465623i -0.7782041-0.465623i EIGENVALUE numerically calculated: 1.556408145 EIGENVECTORS (calculated by R): $vectors [,1] [,2] [,3] [1,] -0.8658084+0i 0.6476861+0.0000000i 0.6476861+0.0000000i [2,] -0.4450290+0i -0.4902997-0.2933611i -0.4902997+0.2933611i [3,] -0.2287467+0i 0.2382837+0.4441499i 0.2382837-0.4441499i Stable age distribution (calculated numerically): 0.562365145 0.289057934 0.148576921 My questions are: 1. Both eigenvalue and eigenvectors are associated with some imaginary value (i). How should I relate to that information? 2. More importantly, a. I presume the 1st eigenvector collumn [,1] should correspond to the dominant eigenvalue. How come then that it comes out different from the one calculated numerically? Is there some conversion I should do? Many thanks Gideon Gideon Wasserberg (Ph.D.) Wildlife research unit, Department of wildlife ecology, University of Wisconsin 218 Russell labs, 1630 Linden dr., Madison, Wisconsin 53706, USA. Tel.:608 265 2130, Fax: 608 262 6099
On Tue, 13 Apr 2004, GIDEON WASSERBERG wrote:> Dear Friends > > I am doing a simple matrix analysis to calculate the eigenvalue, > eigenvector using R for the below matrix, and comparing the result to > those obtained from a projection (using excel) > > THE MATRIX: > > c > [,1] [,2] [,3] > [1,] 0.0 2.0 2 > [2,] 0.8 0.0 0 > [3,] 0.0 0.8 0 > > > The dominant eigenvalue comes out comparable to that calculated > numerically, but the eigenvectors do not( see below)!Yes, they do. Your dominant eigenvector is -0.6495461 times the R dominant eigenvector, and eigenvectors are defined only up to direction. You probably want to rescale the eigenvector so that the sums of entries are 1.> > EIGENVALUES (calculated by R): > > > eigen(c) > $values > [1] 1.5564082+0.000000i -0.7782041+0.465623i -0.7782041-0.465623i > > EIGENVALUE numerically calculated: 1.556408145 > > > EIGENVECTORS (calculated by R): > $vectors > [,1] [,2] [,3] > [1,] -0.8658084+0i 0.6476861+0.0000000i 0.6476861+0.0000000i > [2,] -0.4450290+0i -0.4902997-0.2933611i -0.4902997+0.2933611i > [3,] -0.2287467+0i 0.2382837+0.4441499i 0.2382837-0.4441499i > > Stable age distribution (calculated numerically): > > 0.562365145 > 0.289057934 > 0.148576921 > > > My questions are: 1. Both eigenvalue and eigenvectors are associated > with some imaginary value (i). How should I relate to that information?The first eigenvalue has zero imaginary component, as does its eigenvector, so you may not need to relate to it. -thomas Thomas Lumley Assoc. Professor, Biostatistics tlumley at u.washington.edu University of Washington, Seattle
Gideon, Eigenvectors are normalized to unit length. The first eigenvector calculated by R is equal (ignoring the signs of course) to your stable distribution vector divided by its length. Andy __________________________________ Andy Jaworski 518-1-01 Process Laboratory 3M Corporate Research Laboratory ----- E-mail: apjaworski at mmm.com Tel: (651) 733-6092 Fax: (651) 736-3122 |---------+--------------------------------> | | GIDEON WASSERBERG | | | <wasserberg at wisc.edu>| | | Sent by: | | | r-help-bounces at stat.m| | | ath.ethz.ch | | | | | | | | | 04/13/2004 18:28 | |---------+--------------------------------> >-----------------------------------------------------------------------------------------------------------------------------| | | | To: "R-help at lists.R-project.org" <R-help at stat.math.ethz.ch> | | cc: | | Subject: [R] Matrix question | >-----------------------------------------------------------------------------------------------------------------------------| Dear Friends I am doing a simple matrix analysis to calculate the eigenvalue, eigenvector using R for the below matrix, and comparing the result to those obtained from a projection (using excel) THE MATRIX:> c[,1] [,2] [,3] [1,] 0.0 2.0 2 [2,] 0.8 0.0 0 [3,] 0.0 0.8 0 The dominant eigenvalue comes out comparable to that calculated numerically, but the eigenvectors do not( see below)! EIGENVALUES (calculated by R):> eigen(c)$values [1] 1.5564082+0.000000i -0.7782041+0.465623i -0.7782041-0.465623i EIGENVALUE numerically calculated: 1.556408145 EIGENVECTORS (calculated by R): $vectors [,1] [,2] [,3] [1,] -0.8658084+0i 0.6476861+0.0000000i 0.6476861+0.0000000i [2,] -0.4450290+0i -0.4902997-0.2933611i -0.4902997+0.2933611i [3,] -0.2287467+0i 0.2382837+0.4441499i 0.2382837-0.4441499i Stable age distribution (calculated numerically): 0.562365145 0.289057934 0.148576921 My questions are: 1. Both eigenvalue and eigenvectors are associated with some imaginary value (i). How should I relate to that information? 2. More importantly, a. I presume the 1st eigenvector collumn [,1] should correspond to the dominant eigenvalue. How come then that it comes out different from the one calculated numerically? Is there some conversion I should do? Many thanks Gideon Gideon Wasserberg (Ph.D.) Wildlife research unit, Department of wildlife ecology, University of Wisconsin 218 Russell labs, 1630 Linden dr., Madison, Wisconsin 53706, USA. Tel.:608 265 2130, Fax: 608 262 6099 ______________________________________________ R-help at stat.math.ethz.ch mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html