See also

  • As we mentioned earlier, PCA can be regarded as a specific case of SVD. Here, we generate the orthogonal vector from the swiss data from SVD and obtain the rotation from prcomp. We can see that the two generated matrices are the same:
        > svd.m = svd(scale(swiss))
        > svd.m$v
        Output
                    [,1]        [,2]         [,3]       [,4]        [,5]
        [1,]  0.52396452 -0.25834215  0.003003672 -0.8090741  0.06411415
        [2,] -0.57185792 -0.01145981 -0.039840522 -0.4224580 -0.70198942
        [3,] -0.49150243  0.19028476  0.539337412 -0.3321615  0.56656945
        [4,]  0.38530580  0.36956307  0.725888143  0.1007965 -0.42176895
        [5,]  0.09167606  0.87197641 -0.424976789 -0.2154928  0.06488642
        > pca.m = prcomp(swiss,scale=TRUE)
       > pca.m$rotation
         Output
                             PC1         PC2          PC3        PC4  
PC5 Agriculture 0.52396452 -0.25834215 0.003003672 -0.8090741
0.06411415 Examination -0.57185792 -0.01145981 -0.039840522 -0.4224580
-0.70198942 Education -0.49150243 0.19028476 0.539337412 -0.3321615
0.56656945 Catholic 0.38530580 0.36956307 0.725888143 0.1007965
-0.42176895 Infant.Mortality 0.09167606 0.87197641 -0.424976789 -0.2154928
0.06488642
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset