[R] weird behaviour of eigen() (actual example)

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Nov 10 14:24:00 CET 2003


I agree with Patrick that we should leave the symmetric case alone,
although I did notice that Splus 6.1 says

   values:  vector of nrow(x) eigenvalues in descending order of modulus.

but does sort the symmetric case by value and not modulus, so the code 
that Pat refers to is presuming the documentation to be wrong ....

The asymmetric case is both back-compatible (EISPACK=T) and compatible
with S, so I think the documentation should be clarified---I am about to
do that.

On Mon, 10 Nov 2003, Patrick Burns wrote:

> I think switching the sort order would probably
> break a fair amount of code, and it wouldn't
> necessarily be obvious that it had been broken.
> For example, I suspect that there is a fair amount
> of code that tests if all eigenvalues are positive by
> just looking at the last one.  
> 
> Anyway, consistency is the hobgoblin of small minds.
> 
> 
> Patrick Burns
> 
> Burns Statistics
> patrick at burns-stat.com
> +44 (0)20 8525 0696
> http://www.burns-stat.com
> (home of S Poetry and "A Guide for the Unwilling S User")
> 
> Peter Dalgaard wrote:
> 
> >Prof Brian Ripley <ripley at stats.ox.ac.uk> writes:
> >
> >  
> >
> >>That is not a symmetric matrix so the eigenvalues are potentially complex 
> >>and are sorted by modulus.  There's an ambiguity in the description for 
> >>that case.
> >>    
> >>
> >
> >Ah-ha! Thanks, Brian. 
> >
> >I wonder if we should switch to sorting by absolute value in the real
> >case too, for consistency, and maybe also to avoid silly mistakes
> >caused by people expecting that the first/last eigenvalues are the
> >important ones.
> >
> >  
> >
> 
> 

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list