We’re using the package “FactoMineR”

There’s another package called ADE4 but it is harder to use

You’d better use ADE4 only for advanced techniques

We’ll go through the tutorial produced by M. Husson to demo FactoMineR

install.packages("FactoMineR")
library(FactoMineR)

Multiple Correspondance Analysis

MCA uses qualitative (Factor) Variables

Loading the data

data(tea)

df <- tea

head(df)
##       breakfast     tea.time     evening     lunch     dinner     always
## 1     breakfast Not.tea time Not.evening Not.lunch Not.dinner Not.always
## 2     breakfast Not.tea time Not.evening Not.lunch Not.dinner Not.always
## 3 Not.breakfast     tea time     evening Not.lunch     dinner Not.always
## 4 Not.breakfast Not.tea time Not.evening Not.lunch     dinner Not.always
## 5     breakfast Not.tea time     evening Not.lunch Not.dinner     always
## 6 Not.breakfast Not.tea time Not.evening Not.lunch     dinner Not.always
##   home     work     tearoom     friends     resto     pub       Tea   How
## 1 home Not.work Not.tearoom Not.friends Not.resto Not.pub     black alone
## 2 home Not.work Not.tearoom Not.friends Not.resto Not.pub     black  milk
## 3 home     work Not.tearoom     friends     resto Not.pub Earl Grey alone
## 4 home Not.work Not.tearoom Not.friends Not.resto Not.pub Earl Grey alone
## 5 home Not.work Not.tearoom Not.friends Not.resto Not.pub Earl Grey alone
## 6 home Not.work Not.tearoom Not.friends Not.resto Not.pub Earl Grey alone
##      sugar     how       where           price age sex          SPC
## 1    sugar tea bag chain store       p_unknown  39   M       middle
## 2 No.sugar tea bag chain store      p_variable  45   F       middle
## 3 No.sugar tea bag chain store      p_variable  47   F other worker
## 4    sugar tea bag chain store      p_variable  23   M      student
## 5 No.sugar tea bag chain store      p_variable  48   M     employee
## 6 No.sugar tea bag chain store p_private label  21   M      student
##           Sport age_Q frequency     escape.exoticism     spirituality
## 1     sportsman 35-44     1/day Not.escape-exoticism Not.spirituality
## 2     sportsman 45-59     1/day     escape-exoticism Not.spirituality
## 3     sportsman 45-59    +2/day Not.escape-exoticism Not.spirituality
## 4 Not.sportsman 15-24     1/day     escape-exoticism     spirituality
## 5     sportsman 45-59    +2/day     escape-exoticism     spirituality
## 6     sportsman 15-24     1/day Not.escape-exoticism Not.spirituality
##       healthy     diuretic     friendliness     iron.absorption
## 1     healthy Not.diuretic Not.friendliness Not.iron absorption
## 2     healthy     diuretic Not.friendliness Not.iron absorption
## 3     healthy     diuretic     friendliness Not.iron absorption
## 4     healthy Not.diuretic Not.friendliness Not.iron absorption
## 5 Not.healthy     diuretic     friendliness Not.iron absorption
## 6     healthy Not.diuretic Not.friendliness Not.iron absorption
##       feminine     sophisticated    slimming    exciting    relaxing
## 1 Not.feminine Not.sophisticated No.slimming No.exciting No.relaxing
## 2 Not.feminine Not.sophisticated No.slimming    exciting No.relaxing
## 3 Not.feminine Not.sophisticated No.slimming No.exciting    relaxing
## 4 Not.feminine     sophisticated No.slimming No.exciting    relaxing
## 5 Not.feminine Not.sophisticated No.slimming No.exciting    relaxing
## 6 Not.feminine Not.sophisticated No.slimming No.exciting    relaxing
##      effect.on.health
## 1 No.effect on health
## 2 No.effect on health
## 3 No.effect on health
## 4 No.effect on health
## 5 No.effect on health
## 6 No.effect on health

Computing the Multiple Correspondance Analysis

res.mca = MCA(df, quanti.sup=19, quali.sup=c(20:36))