Home > Mobile >  In R factoextra ,the result of 'fviz_ellipses' and 'facto_summarize' not match
In R factoextra ,the result of 'fviz_ellipses' and 'facto_summarize' not match

Time:10-11

When using function 'fviz_ellipses' from 'factoextra' package ,it show variable 'Age' and 'Time' is the top 2 variables which have huge influence for Dim1/Dim2,but 'Age' and 'Time' not in the result of 'facto_summarize'. Anyone can help to clear this ? or I misunderstanding something. Thanks

library(tidyverse)
library(factoextra)
library(FactoMineR)
res.mca <- MCA(poison,quanti.sup = 1:2,
               quali.sup=3:4,
              graph=FALSE)



fviz_ellipses(res.mca,1:2,geom="point")

facto_summarize(res.mca,'var',axes=1:2) %>% filter(name %in% c('Age','Time') )

enter image description here

i have addition question :when using 'facto_summarize(res.mca,'var',axes=1:2)' ,it show the content of original data not the variable name ,how can it show variable names? thanks enter image description here

CodePudding user response:

Since you specify the first two variables as supplementary quantitative vars, you will get their results by accessing the corresponding result 'quanti.sup':

facto_summarize(res.mca,'quanti.sup',axes=1:2) %>% filter(name %in% c('Age','Time') )

Returns:

     name       Dim 1       Dim 2       Dim 3       Dim 4      Dim 5
Age   Age -0.01198562 -0.02141403 -0.25866390  0.20587533 0.01725215
Time Time -0.84214754 -0.03894016 -0.05226732 -0.04636355 0.02743571
  •  Tags:  
  • r
  • Related