[R] spectral-decomposition

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Jan 22 16:57:34 CET 2001


On Mon, 22 Jan 2001, Tapio Nummi wrote:

>
> I have the following problem:
>
> I try to make the spectral decomposition
> for the following matrix by utilising the
> function eigen.
>
>   0.4015427  0.08903581 -0.2304132
>   0.08903581 1.60844812  0.9061157
> -0.23041322 0.9061157   2.9692562
>
> When checking the result I was not able
> to produce the original matrix by using
> the decomposition. It also appears that
> the product T'T, where T is a matrix of
> eigenvectors, is not an identity matrix.

Did your version of R pass make check?  Some compilers have trouble with
eigen, so try example(eigen).

And *PLEASE* give your R version and platform.

On mine (1.2.1, Solaris)

> sm <- eigen(m, sym=TRUE)
> sm
$values
[1] 3.4311626 1.1970027 0.3510817

$vectors
            [,1]       [,2]       [,3]
[1,] -0.05508142 -0.2204659  0.9738382
[2,]  0.44231784 -0.8797867 -0.1741557
[3,]  0.89516533  0.4211533  0.1459759

> V <- sm$vectors
> t(V) %*% V
              [,1]          [,2]          [,3]
[1,]  1.000000e+00 -1.665335e-16 -5.551115e-17
[2,] -1.665335e-16  1.000000e+00  2.428613e-16
[3,] -5.551115e-17  2.428613e-16  1.000000e+00

> V %*% diag(sm$values) %*% t(V)
            [,1]       [,2]       [,3]
[1,]  0.40154270 0.08903581 -0.2304132
[2,]  0.08903581 1.60844812  0.9061157
[3,] -0.23041320 0.90611570  2.9692562

I reckon you have a broken installation.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list