# [R] Matrix question

Thomas Lumley tlumley at u.washington.edu
Wed Apr 14 02:41:11 CEST 2004

```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

```