问题
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