Principle Component Analysis (PCA)

Posted by admin on Sunday Jul 4, 2010 Under Statistics



Performing a PCA after standardizing the variables and obtain estimates for the principal components for the standardized variables.

Reading in athelete’s data
ath.dat <- read.table("athelete.txt")

Standardizing the data
ath.dat.std <- scale(ath.dat)

Correlation matrix (since covariance of standardized data is correlation)
R = cov(ath.dat.std)

Eigen Values
lambda = eigen(R)$val

Eigen values are read to assess which components explain the variance the most. In this case, the first two show values above 1 therefore we will take the first two components.

[1] 1.0900625 1.0290211 0.8809163

Eigen Vector
es= eigen(R)$vec

[,1] [,2] [,3]
[1,] 0.7476122 -0.1215134 -0.6529246
[2,] -0.2827011 0.8313790 -0.4784235
[3,] 0.6009626 0.5422577 0.5871971

Three eigen vectors associated with the labmda values. The three vectors are eigen vectors of the covariance matrix and also the loadings of Principle components.

You can find the loadings (eigen vectors) by obtaining loadings of the princomp output

loadings(ath.pca)

Loadings:
Comp.1 Comp.2 Comp.3
X1 0.748 -0.122 -0.653
X2 -0.283 0.831 -0.478
X3 0.601 0.542 0.587

7 Responses to “Principle Component Analysis (PCA)”

  1. veterinary technician Says:

    Keep posting stuff like this i really like it

  2. don_t_panic Says:

    it was very interesting to read http://www.soisos.com
    I want to quote your post in my blog. It can?
    And you et an account on Twitter?

  3. admin Says:

    Hello don_t_panic, sure you can quote my post. I will be posting more topics and will also write it more descriptively.

  4. Katerjina Says:

    I would like to exchange links with your site http://www.soisos.com
    Is this possible?

  5. financial aid for college Says:

    Great site. A lot of useful information here. I’m sending it to some friends!

  6. admin Says:

    Sure, we can exchange the links.

  7. WP Themes Says:

    Genial post and this enter helped me alot in my college assignement. Gratefulness you on your information.