在FactoMiner R中提取主要成分 [英] Extracting Principal Components in FactoMiner R
问题描述
我正在尝试使用FactoMiner中的PCA提取协方差矩阵的主成分.但是,由于某种原因,我只在var-> coord变量中看到n-1个分量
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)
这将产生100 99的输出.我是这个软件包的新手,希望能获得更多的见解
This leads to an output of 100 99. I am new to this package and hope to get more insights
推荐答案
在对p个变量和n个观察值进行的主成分分析中,最大维数为min(p; n-1).您有一个100x100的矩阵,所以它将是min(100; 99)=1.尝试使用100x101矩阵,您将能够提取100个尺寸:
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
也就是说,PCA的全部目的是将数据缩小到几个维度,因此尝试全部使用它们会破坏其目的.
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.
这篇关于在FactoMiner R中提取主要成分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!