[R] Finding the principal components

David L Carlson dcarlson at tamu.edu
Fri May 18 17:58:07 CEST 2012


Check the posting guidelines and give us a small reproducible example using
dput(). It is here
http://www.R-project.org/posting-guide.html

You say you want "PCs of a spatial data set (single variable)", but you must
mean something else. It sounds like your variables are highly correlated
with one another or you have more variables than cases. The function prcomp
also computes PCs but it uses singular value decomposition rather than
matrix inversion.

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of dileep kunjaai
> Sent: Friday, May 18, 2012 8:01 AM
> To: r-help at r-project.org
> Subject: [R] Finding the principal components
> 
> Dear all,
> 
>        I am trying to find  the PCs of a spatial data set (single
> variable).  I want to calculate the PCs at each Lat-Lon location.
> 
>         The* 'princomp'* command gives the approximate standardized
> data,
> (i.e* pca$scores*), stranded deviation ..etc. I tried*
> 'pca$loadings'*also,  but it giving value 1 all time.
> 
>           Then I tried manually*(* First calculate correlation matrix
> (X*X^T), then arranged it's eigen value in descending order, and chose
> the
> corresponding eigenvectors (Q_j's),  then pc=X^(T)* Q_j , it will give
> a
> single value called first PC as j=1 *)*, and found PCs but this value
> is
> different from *'pca$loadings'*.
> 
>            But I can find the approximate standardized data, (pc1*Q_1)
> which is similar to *pca$scores*.   But this method is time consuming.
> 
>           Please help me to tackle this problem.
> 
> 
> 
> 
> Thank you for all  in advance
> 
> 
> 
> 
> --
> DILEEPKUMAR. R
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list