1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Principal component analysis and greatest variation

  1. Nov 26, 2011 #1
    Problem - Given the following table
    x y
    15 50
    26 46
    32 44
    48 43
    57 40

    a) Find the sample mean
    b) Find the covarince matrix
    c) Perform principal component analysis and find a size index which explains the greatest variation.

    My attempt
    a) n = 5
    xbar = Sum(x)/n = 35.6
    ybar = Sum(y)/n = 44.6
    Sample mean = [35.6 44.6]

    b) I calculated Var(X) = 1/n * Sum(X-Xbar)^2 = 228.24
    Var(Y) = 1/n * Sum(Y-Ybar)^2 = 11.04
    COV(X,Y) = 1/n * Sum[(X-Xbar)(Y-Ybar)] = -48.16

    I made a 2x2 matrix in which principal diagonal elements are Var(X) and Var(Y). Each of the other two elements equals COV(X, Y)

    Please see if there is any mistake in my solutions to parts a and b.
    I have no idea how to answer part c. Could you help?
     
    Last edited by a moderator: Nov 30, 2011
  2. jcsd
  3. Nov 27, 2011 #2
    To get your covariance matrix, I assume you subtracted the means of x and y. Once you have this matrix, you need to find the two eigenvectors and their eigenvalues. The vector with largest eigenvalue will be your principle component vector. From your data, I can tell which one that is. Can you? Note the eigenvectors are mutually orthogonal, which is the goal of PCA. You want to extract the independent vectors that describe the data. The data can be compressed by simply eliminating any vectors whose eigenvalues are too small to make much difference on your analysis. You don't need to do this here IMO.

    The next step is to create a feature matrix where your eigenvectors are the row vectors. The transpose of this is your solution. Note that x accounts for over 95% of the total variance in your two component system, so I think your teacher would want you to discard y and retain x in a reduced 1 component system (your size index). I just wanted to take you through the final steps as if you had more than one component.
     
    Last edited: Nov 27, 2011
  4. Nov 28, 2011 #3

    Bacle2

    User Avatar
    Science Advisor

    Don't you mean the eigenvectors/eigenvalues of MTM , where M is the matrix with the x,y entries? Sorry, I am kind of rusty; I have not seen this in a while.
     
  5. Nov 28, 2011 #4

    Bacle2

    User Avatar
    Science Advisor

  6. Nov 28, 2011 #5
    It's the variance-covariance matrix (usually just called the covariance matrix). The trace of this matrix is the total variance. What matrices were you referring to? The new matrices are constructed from the eigenvectors obtained from the original covariance matrix.
     
    Last edited: Nov 28, 2011
  7. Nov 30, 2011 #6

    Bacle2

    User Avatar
    Science Advisor

    Yes, I was referring to the variance-covariance matrix. The way I remembered it, we did m tests on n subjects, and then calculated mean, then adjusted/normalized, then we calculated the variance-covariance matrix, which we then applied the whole process to. Thanks for the refresher.
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook