PCA principal component analysis

Alexander Schmolck a.schmolck at gmx.net
Thu Apr 10 14:55:22 CEST 2003


s.thuriez at laposte.net (sebastien) writes:

> Alexander Schmolck <a.schmolck at gmx.net> wrote in message news:<yfs7ka3iom2.fsf at black132.ex.ac.uk>...
> Thanks for the program. I have tested it with a test matrix that I
> have and that I took from IDL help (Interactive data language).
> 
> The matrix is :
> 
> ((2,1,3),
> (4,2,3),
> (4,1,0),
> (2,3,3),
> (5,1,9))
> 
> 
> The principal component given by IDL is 
> 
> ((0.87, -0.7, 0.69),
> (0.01, -0.64, -0.66),
> (0.49, 0.32, -0.30))
> 
> Runnnig the same matrix with the program that you have kindly provided
> gives :
> 
> ((-0.58, -0.67, 0.45),
> (-0.23, -0.40, -0.88),
> (-0.77, -0.62, -0.074))
> 
> Do you know why is there such a difference ??

I'm not sure what you computed with IDL but it sure doesn't look like
principal components of anything to me (the result matrix you quote is not
even orthogonal).

Matlab's svd (with [U,S,V] = svd(your_matrix)) gives pretty much the same V as
what I posted (you didn't by any chance just truncate (rather than round) the
values gave above?):

  -0.5812   -0.6728    0.4577
  -0.2346   -0.4001   -0.8859
  -0.7792    0.6223   -0.0747


'as





More information about the Python-list mailing list