我试图使用来自FactoExtra的FactoExtra函数来提取对MCA中每个维度的单独贡献(来自FactoMiner包),以便在进一步的分析中使用它。而不是获得所有维度的信息,以便我可以决定我需要多少(即使用scree plot或其他阈值),我只得到前5维。
#this should get indiv data (coordinates, contributions, and cos2) from an MCA into a new variable called Reduced.
new <- get_mca_ind(MCA)
#I want to look at it to make sure i've got what I need
summary(new$contrib)我得到了:
Dim 1 Dim 2 Dim 3 Dim 4 Dim 5
Min. :0.0000192 Min. :0.000147 Min. : 0.000009 Min. : 0.000001 Min. : 0.000001
1st Qu.:0.0482985 1st Qu.:0.057176 1st Qu.: 0.030022 1st Qu.: 0.029323 1st Qu.: 0.027998
Median :0.1935074 Median :0.245580 Median : 0.115066 Median : 0.116379 Median : 0.134186
Mean :0.4081633 Mean :0.408163 Mean : 0.408163 Mean : 0.408163 Mean : 0.408163
3rd Qu.:0.6126128 3rd Qu.:0.562426 3rd Qu.: 0.325514 3rd Qu.: 0.366664 3rd Qu.: 0.433879
Max. :3.0747167 Max. :5.355167 Max. :14.168752 Max. :16.762048 Max. :11.495243 从new$contrib中,我希望得到一个矩阵,每个个体有一行,每个维度有一列- 68。相反,我得到了一个矩阵,每个个体有一行,前5个维度中的每一个都有一列。
注意:mca没有标记,所以我使用了pca -- FactoExtra也为pca提供了类似的函数。
发布于 2019-08-05 19:37:36
您可以在mca调用中使用ncp =指定要在结果中保留的维度数(默认为5)。请参阅文档:https://cran.r-project.org/web/packages/FactoMineR/FactoMineR.pdf中的"MCA“。
https://stackoverflow.com/questions/57364575
复制相似问题