[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(without using* princomb* command), and found PCs but this value is different from *'pca$loadings'*. But I can find the approximate standardized data, 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 J R F, IIT DELHI [[alternative HTML version deleted]] __ R-help@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.
[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@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.
Re: [R] Finding the principal components
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 AM University College Station, TX 77843-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of dileep kunjaai Sent: Friday, May 18, 2012 8:01 AM To: r-help@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@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. __ R-help@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.
Re: [R] Finding the principal components
Dear David, Thank you for your time and consideration, My data set is Sea Surface temperature (sst) of 50 year monthly global data (1x1 degree resolution ). My goal is to calculate the EOF1 , EOF2 EOF3 at each Lat-Lon location. How to use 'princomp' command usefully to calculate these values. Thanking you all in advance On Fri, May 18, 2012 at 9:28 PM, David L Carlson dcarl...@tamu.edu wrote: 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 AM University College Station, TX 77843-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of dileep kunjaai Sent: Friday, May 18, 2012 8:01 AM To: r-help@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@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. -- DILEEPKUMAR. R J R F, IIT DELHI [[alternative HTML version deleted]] __ R-help@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.