Multiple Correspondence Analysis with FactoMineR

The video walks viewers through performing a Multiple Correspondence Analysis (MCA) in R using the FactoMineR package on the built‑in “tea” dataset. It begins by loading the package and data, then defines active, supplementary categorical, and a supplementary continuous variable. The presenter runs MCA, examines the summary output (eigenvalues, variance explained, individual coordinates, contributions, squared cosines, v‑tests, and square correlation ratios for variables), and interprets what each metric indicates about the dimensions. A series of visualizations are demonstrated: correlation circles for the continuous supplement, variable plots, individual plots, and category plots. The tutorial shows how to improve readability by adjusting font size (cx), limiting axes, selecting top‑contributing categories or individuals, applying transparency, and using the `unselect` argument. It also compares MCA based on the indicator matrix versus the Burt matrix, highlighting differences in explained variance and category positioning. Finally, the presenter illustrates coloring individuals by a categorical variable and mentions that hierarchical clustering can be applied to MCA results. The overall aim is to equip survey analysts with practical techniques for interpreting and visualizing MCA outcomes.
Chapters
The purpose of this video is to show how to perform a multiple correspondence analysis with FactoMineR. So I will load the FactoMineR package and I will take an example that is available in the MCA function. So in the bottom we have several examples. I will take an example with a dataset corresponding to tea. So I copy and paste the 2 lines of code. So I load the dataset and then, then I perform the MCA. So the MCA is performed on the dataset tea. I said that the variable number 19 is a continuous supplementary variable, and I said that the variables from 20 to 36 are supplementary categorical variables. We have 36 variables. The first 18 variables are active variables, so the dimensions of the multiple correspondence analysis will be constructed according to these first 18 variables, and then we can use other variables to understand, to interpret the dimensions. So a continuous variable which is used as supplementary and 17 categorical variables that are used as supplementary. So the MCA is performed, we have some graphs. I will interpret the graph later, and first what we can do is to see the outputs of the function. So I can use the summary function. So with the summary functions, I have different results. So first, the lines of code is recalled. Then I have a— we have a table with the eigenvalues and the percentage of variance that is explained by each dimension. So the first dimension explains approximately 10% of the information, the second dimension 8%, And so on. Then we have the results for the individuals. So there is a lot of individuals and we have the results by default with only the 10 first individuals. So on these results we have the coordinate of the individual on the first dimension, then the contribution of the individual to the construction of the first dimension, so This value is explained as a percentage. Then we have a square cosine that corresponds to the quality of representation of the individual on the dimension. So if the square cosine is close to 1, it means that the individual is well projected on the dimension, or well projected on a map if we sum 2 square cosines. Then we have the same result for the second dimension, and then for the third dimension. We have also the results for the categories. So first for the active categories, so the categories of the active categorical variables. So we have the coordinate on the dimension, the contribution to the construction of the dimension, the quality of representation, and a v-test which is between -2 and 2 if the category has a coordinate that is not significantly different from 0, and which is greater than 2 if the category has a coordinate which is significantly greater than 0, and a v-test less than -2 if the category has a coordinate which is significantly less than 0. And we have also the results for the other dimensions, so the 2nd dimension and the 3rd dimension. We have also a measure of the influence of each categorical variable. So this measure corresponds to the square correlation ratio, so it is the measure which is used in a one-way analysis of variance. So if this value is close to 1, it means that there is a strong link between the dimension and the categorical variable. Then we have the results for the supplementary categories. These are the same results as for the active category except that there is no contribution because these categories do not contribute to the construction of the dimension. But we have the coordinate, the square cosine, and the v-test. And we also have the square correlation ratio for the supplementary categorical variables. And for the supplementary continuous variables, we have the coordinate on each dimension. So there is just one continuous variable in this example, and the coordinate is only the correlation coefficient. Between the dimension and the continuous variable. That's all for the summaries of the variables. We can have a look at the graphs now. So we have a graph with the supplementary continuous variable. This graph corresponds to the correlation circle as in PCA. So the arrow is close to the circle if a variable is strongly linked to the 2 dimensions. There is also a graph of the variables. So we can see that, for example, the variable where is linked to the first and to the second dimension. And there is a lot of variables that are not strongly linked to each variable. We have a graph with individuals, so the representation of the individuals. With this graph, we can see that there is no group of individuals, so I think there is not a lot of things to say about this graph. And what is more interesting in multiple correspondence analysis is a graph with categories. But what we can see with this graph is that there is a lot of categories and it is not very easy to interpret this graph. So we will see how we can use the FactoMineR function to better see the information. So I can use the function plotMCA on my output. If I do that, I will have a graph with both the individuals, the active categorical variables, and the supplementary categorical variables. What we can do first is a graph with only the individuals. So as invisible, I will say that I want to have the active categories and the supplementary categories, and I have just a graph with the individuals. I can do the same thing, but as invisible, I can put the individuals and the supplementary categories. So I have just a graph with only the active categories. So with a graph which is higher, I can do the graph again and the graph is more readable now, but some labels overlap. So what we can do is to use a smaller font, so using cx equal to 0.8, for example, and now there is less overlap between the labels. And of course, we can do the same thing with just the supplementary categories. The graph is more readable now. Another trick to have a graph that is more readable is to select the categories, the modalities that contribute the most, the 20 categories who contribute the most. So I have a graph with the labels for the 20 categories that contribute the most, and for the others, there is just the point but not the labels, and the point is drawn with some transparency. So I can change that using, for example, unselect= gray. And then the dots that are not selected, that do not contribute the most, are in gray. So it can be useful to do that if you want to export the graph using PowerPoint, for example, because transparency is not managed with PowerPoint. So you can select the categories using the contribution. You can also use the square cosine. So I will just draw the categories that are the best represented on the map. Or I can just draw the categories that have a square cosine that is higher than 0.1. I can draw a graph with Also the individuals, but I want to select only the individuals that contribute the most, so the 10 individuals that contribute the most. So I have the categories that have a good quality of representation and the 10 individuals that contribute the most. So the other individuals are drawn with some transparency. So it can be very useful when you have a lot of individuals. So we can also plot a graph with the variables. So I can zoom on this graph using lim from 0 to 0.05 and the other limits which belong between 0 and 0.05. So it is quite clearer, but I can use a smaller font and it is better now. So you have in red the active variables, in green the supplementary categorical variables and in blue the supplementary continuous variables. So the coordinate corresponds to the square correlation ratio between the dimension and one qualitative variable for the categorical variables, and for the continuous variables, it is the square correlation coefficient between the dimension and the What you can also do is to perform the MCA using the Burt table. You can perform the multiple correspondence analysis performing a correspondence analysis on the indicator matrix or performing the correspondence analysis on the Burt matrix. So the difference corresponds to the percentage of variance that is explained by each dimension. The representation of the continuous variables is the same. The representation of the categorical variables is the same. The representation of the categories is different. The percentage of variance explained by each dimension is greater when we use the BERT method, and the categories are at the barycenter of the individuals. So there is just a small difference between the graphs that we have done before, there is just a dilatation. What you can also do if you do the graph with the individuals— I will just consider the individuals— is that I can draw the individuals according to a variable. So I will use different colors for individuals who drink tea about 1 time per day, those who drink tea 1 or 2 times a week, more than 2 times per day, and 3 to 6 times a week. So the color is different according to the categories of one categorical variable. Here are some tools to better visualize the information with a multiple correspondence analysis. And this is very useful when you want to analyze a survey. What you can also do after a multiple correspondence analysis is to perform a clustering. So you can see the video on hierarchical clustering because hierarchical clustering can be performed on the results of multiple correspondence analysis.
More from Yamossoun

Algorithme de calcule de la racine carrée par dichotomie #dichotomy #squareroot #algorithm









