Options

PCA Eigenvectors?

wileewilee Member Posts: 2 Contributor I
edited November 2019 in Help
Hi,

When I ran PCA, I got a set of eigenvectors that are different from those produced by R's prcomp() with scaling turned on. RapidMiner gave me this:

Global_active_power 0.538 -0.051 0.030 0.045 0.159 -0.426 0.706
Global_reactive_power 0.187 0.670 -0.340 -0.627 -0.026 0.078 0.013
Voltage -0.296 0.142 -0.060 0.049 0.940 -0.056 -0.010
Global_intensity 0.540 -0.032 0.019 0.042 0.141 -0.429 -0.708
Sub_metering_1 0.295 -0.100 -0.741 0.431 0.063 0.405 0.002
Sub_metering_2 0.266 0.573 0.500 0.465 0.026 0.365 0.002
Sub_metering_3 0.372 -0.434 0.283 -0.446 0.259 0.572 -0.011

But R gave me this:

                            PC1        PC2        PC3        PC4        PC5        PC6          PC7
Global_active_power  -0.5381097  0.05112019  0.02978743  0.04476800 -0.15868069  0.42622395 -0.705752668
Global_reactive_power -0.1867954 -0.67037848 -0.34034177 -0.62679327  0.02649741 -0.07819877 -0.013441617
Voltage                0.2961116 -0.14239228 -0.05952547  0.04939298 -0.93956025  0.05646484  0.009883380
Global_intensity      -0.5398184  0.03167064  0.01911187  0.04194898 -0.14069402  0.42915594  0.708165563
Sub_metering_1        -0.2953051  0.10046871 -0.74088814  0.43078174 -0.06308568 -0.40525145 -0.002067051
Sub_metering_2        -0.2660841 -0.57326777  0.50049983  0.46511374 -0.02618255 -0.36474801 -0.002411597
Sub_metering_3        -0.3720936  0.43355614  0.28276549 -0.44611987 -0.25862083 -0.57235055  0.011236558

As you can see, the eigenvectors from RapidMiner and R have the same magnitude but opposite direction. What am I missing?

Thanks,

Will

Answers

  • Options
    MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Hi Will,

    the definition of an eigenvector (taken from wikipedia) is:

    An eigenvector of a square matrix is a non-zero vector that, when multiplied by the matrix, yields a vector that differs from the original vector at most by a multiplicative scalar.

    If I am not mistaken, that should leave room for a multiplication with -1, and both results are correct.

    Best regards,
    Marius
  • Options
    wileewilee Member Posts: 2 Contributor I
    Hi Marius,

    I am new to RapidMiner and even PCA and I still don't understand. So I should have actually always multiply the eigenvector results returned by R with -1?

    Thanks,

    Will
  • Options
    MariusHelfMariusHelf RapidMiner Certified Expert, Member Posts: 1,869 Unicorn
    Actually, I have never worked with R in this area, so I don't know if the observations we made above generalize. But I suppose they do :)

    Best regards,
    Marius
Sign In or Register to comment.