Different result from SAS/IML and R, in SVD decomposition -


shortly, i'm translating r package iml languageand i'm totally struggling myself svd decomposition result between r , iml.

r code:

s <- svd(mat)  s$v 

sas/iml code:

call svd (u, d, v, mat); print v; 

v in both sides matrix containing right singular vectors svd decomposition, here, please take @ these results r:

             [,1]         [,2]         [,3]        [,4]        [,5]         [,6]         [,7] [1,] -2.625059e-02  0.029572211 -0.006491235 0.015622547  0.01553215 -0.003882378  0.007250290 [2,] -4.762146e-06 -0.030403155 -0.016635218 0.024949110 -0.01238686  0.001334805  0.041902431 [3,] -8.460010e-02  0.025365547  0.006657322 0.020129575 -0.02312842  0.038366880  0.054249177 [4,] -1.368302e-02  0.029621706  0.005462163 0.017887163  0.02605000 -0.002546119 -0.001913554 [5,] -3.326751e-02  0.003552646  0.003634580 0.065277891 -0.01218518 -0.026305833  0.029209961 [6,] -1.451836e-02  0.089992653 -0.012355758 0.009777273 -0.07790069 -0.044679172 -0.028174261 

and these result sas/iml:

            col1      col2      col3      col4      col5      col6      col7      col8      col9   row1   0.0262506 -0.029572 -0.006491 0.0156225 0.0155322 -0.003882  -0.00725  0.040721 -0.000566  row2   4.7621e-6 0.0304032 -0.016635 0.0249491 -0.012387 0.0013348 -0.041902 0.0225321 0.0070566  row3   0.0846001 -0.025366 0.0066573 0.0201296 -0.023128 0.0383669 -0.054249 0.0305745 -0.041534  row4    0.013683 -0.029622 0.0054622 0.0178872   0.02605 -0.002546 0.0019136 0.0168932 0.0229999  row5   0.0332675 -0.003553 0.0036346 0.0652779 -0.012185 -0.026306  -0.02921 -0.029533 0.0145009  row6   0.0145184 -0.089993 -0.012356 0.0097773 -0.077901 -0.044679 0.0281743 -0.025475 -0.036881  row7   -0.012385 0.0295035 0.0051056   -0.0007 0.0025335 -0.009391 -0.045927 -0.054661 -0.029963 

the values same can see, signs same , different. can't find reason why happening , totally driving me crazy. give me solution, or @ least hint or anything. appreciated, if won't solve problem.

many thanks.

edit: obviosly, results posted portion of total matrix.

in short, svd decomposition not unique.

the singular vectors of m eigenvectors of m`m. eigenvectors not unique. when matrix full rank, eigenvectors defined sign: if v eigenvector of matrix eigenvalue lambda, -v because a*(-v) = -(av) = -(lambda v) = lambda (-v).

different svd (and eigenvalue) algorithms can lead different decompositions. long m = udv`, decomposition valid. d matrix of singular values same across software packages, u , v matrices can different.

incidentally, if matrix not full rank, "uniqueness sign" breaks down. the wikipedia article on svd has example of 2 different svds same rank-deficient matrix.


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

How to use Authorization & Authentication in Asp.net, C#? -