Extracting Principal Components in FactoMiner R

安稳与你 提交于 2020-01-06 19:58:19

问题


I am trying to extract the principal components for a covariance matrix using PCA in FactoMiner. However, for some reason , I only see n-1 components in the var-->coord variable

library(FactoMineR)
x = matrix(rnorm(10000),nrow = 100,ncol = 100)
y = PCA(x,ncp = 100,graph = FALSE)
dim(y$var$coord)

This leads to an output of 100 99. I am new to this package and hope to get more insights


回答1:


The maximum number of dimensions in a principal component analysis performed on p variables and n observations is min(p;n-1). You have a matrix of 100x100, so that would be min(100;99) = 1. Try this with a 100x101 matrix and you will be able to extract 100 dimensions:

x = matrix(rnorm(10100),nrow = 101,ncol = 100)
y = PCA(x,ncp = 100,graph = FALSE)
dim(y$var$coord)
[1] 100 100

That said, the whole point of PCA is to reduce your data to a few dimensions, so trying to use them all defeats its purpose.



来源:https://stackoverflow.com/questions/34441193/extracting-principal-components-in-factominer-r

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!