data = read.table("file", header=TRUE)
R commands for PCA
Here are some R commands for PCA
pcdat = princomp(data) - It does actual job and put the results to pcdat. It will use covariance matrix
pcdat = princomp(data,cor=TRUE) - It will use correlation matrix
summary(pcdat) - It will print standard deviation and proportion of variances for each component
screeplot(pcdat) - It will plot screeplt
biplot(pcdat) or biplot.princomp(pcdat,scale=1) - It will give you biplot
loadings(pcdat) - it will give information how much each variable contribute to each component. For principal components you can ignore
loading subsection of the output from this command
pcdat$scores - It will plot scores of each observation for each variable
For further details about this and other R commands type
help.start()
PCA百科地址(附Matlab例子)http://baike.baidu.com/view/852194.htm#1
|
请发表评论