Zunqiu Chen
2011-Jan-28 19:16 UTC
[R] how to get coefficient and scores of Principal component analysis in R?
Dear All, It might be a simple question. But I could not find the answer from function “prcomp” or “princomp”. Does anyone know what are the codes to get coefficient and scores of Principal component analysis in R? Your reply will be appreciated! Best Zunqiu [[alternative HTML version deleted]]
Sarah Goslee
2011-Jan-28 19:31 UTC
[R] how to get coefficient and scores of Principal component analysis in R?
By coefficients do you mean loadings? Anyway, if you read the help for princomp -- ?princomp -- will get that, you'll see that it says, in part: ?princomp? returns a list with class ?"princomp"? containing the following components: sdev: the standard deviations of the principal components. loadings: the matrix of variable loadings (i.e., a matrix whose columns contain the eigenvectors). This is of class ?"loadings"?: see ?loadings? for its ?print? method. scores: if ?scores = TRUE?, the scores of the supplied data on the principal components. These are non-null only if ?x? was supplied, and if ?covmat? was also supplied if it was a covariance list. For the formula method, ?napredict()? is applied to handle the treatment of values omitted by the ?na.action?. So for instance, myprincomp <- princomp(mydata) myprincomp$scores # shows the scores Sarah On Fri, Jan 28, 2011 at 2:16 PM, Zunqiu Chen <chener at ohsu.edu> wrote:> Dear All, > > It might be a simple question. But I could not find the answer from function ?prcomp? or ?princomp?. Does anyone know what are the codes to get coefficient and scores of Principal component analysis in R? > > Your reply will be appreciated! > > Best > Zunqiu >-- Sarah Goslee http://www.functionaldiversity.org
Liviu Andronic
2011-Jan-28 19:45 UTC
[R] how to get coefficient and scores of Principal component analysis in R?
Hello On Fri, Jan 28, 2011 at 8:16 PM, Zunqiu Chen <chener at ohsu.edu> wrote:> It might be a simple question. But I could not find the answer from function ?prcomp? or ?princomp?. Does anyone know what are the codes to get coefficient and scores of Principal component analysis in R? >Try these: https://stat.ethz.ch/pipermail/r-help/2010-November/261719.html http://www.statmethods.net/advstats/factor.html http://www.unt.edu/rss/class/Jon/R_SC/Module7/M7_PCAandFA.R http://stats.stackexchange.com/questions/612/is-psychprincipal-function-still-pca-when-using-rotation http://zoonek2.free.fr/UNIX/48_R/05.html#1 Liviu
smb123
2015-Mar-19 06:02 UTC
[R] how to get coefficient and scores of Principal component analysis in R?
Actually, the loadings are quite different from the coefficients. The loadings are simply correlations of the original values to the scores for a PCA factor. The coefficients, on the other hand, allow one to compute the scores. There is a coefficient for each variable. The coefficient is multiplied with the standardized variable and then added to the next coefficient multiplied by its standardized variable ets. The general formula <http://r.789695.n4.nabble.com/file/n4704832/PCA_formula.jpg> -- View this message in context: http://r.789695.n4.nabble.com/how-to-get-coefficient-and-scores-of-Principal-component-analysis-in-R-tp3245198p4704832.html Sent from the R help mailing list archive at Nabble.com.
Possibly Parallel Threads
- any similiar R fuction for matlab function 'fprintf'?
- Factor analysis
- Principal comp. scores in R
- In factor analysis in the psych package, how can I work out which factors the columns in $scores relate to? How do I know what each of the scores is scoring?
- Adjusting scores