I'm trying to use the get_mca_ind()
function from FactoExtra
to extract individual contributions to each dimension in an MCA
(from FactoMiner
package) so that I can use it in further analysis. Instead of getting info on all of the dimensions so I can decide how many I need (using i.e. the scree plot
or some other threshold), I get only the first 5 Dimensions.
#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)
and I get:
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
from new$contrib
I expect to get a matrix with one row for each individual and one column for each dimension-- 68. Instead, I get a matrix with one row for each individual and one column for each of only the first 5 dimensions.
Note: there's no tag for mca
so I used pca
-- FactoExtra
has a similar function for pca
as well.
You can specify the number of dimensions to keep in the results using ncp =
in the mca call (default is 5). See under "MCA" in the documentation: https://cran.r-project.org/web/packages/FactoMineR/FactoMineR.pdf.