(MCA) with FactoMineR (hobbies dataset)

Gardening Knitting Cooking Fishing. TV. Sex. ## n:5047 n:6990 n:4717 n:7458. Min. :0.000. F:4616. ## y:3356 y:1413 y:3686 y: 945. 1st Qu.:1.000. M:3787. ##.
3MB taille 0 téléchargements 278 vues
Multiple Correspondence Analysis (MCA) with FactoMineR (hobbies dataset) Magalie Houée-Bigot & François Husson

Import data setwd("C:/users/houee/Downloads") # select the working directory hobbies = read.table("data_MCA_Hobbies.csv", header=TRUE, sep=";") header=TRUE : indicates that the file contains the names of the variables sep=";" : indicates the fields separator (usually “;” or “,” for csv files) It is important to check that the import is well done summary(hobbies) ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ##

Reading n:2757 y:5646

Listening.music Cinema n:2456 n:5044 y:5947 y:3359

Walking n:4228 y:4175

Travelling Playing.music Collecting Volunteering Mechanic n:5040 n:6943 n:7541 n:7118 n:4864 y:3363 y:1460 y: 862 y:1285 y:3539

Gardening Knitting Cooking n:5047 n:6990 n:4717 y:3356 y:1413 y:3686

Age (45,55]:1837 (35,45]:1646 (25,35]:1302 (55,65]:1257 (65,75]: 937 [15,25]: 857 (Other): 567

Show n:5978 y:2425

Fishing n:7458 y: 945

Marital.status Divorcee : 792 Married :4333 Remarried: 404 Single :2140 Widower : 734

Exhibition Computer Sport n:5808 n:5245 n:5308 y:2595 y:3158 y:3095

TV Min. :0.000 1st Qu.:1.000 Median :2.000 Mean :2.355 3rd Qu.:4.000 Max. :4.000

Sex F:4616 M:3787

Profession Employee :2552 Manual labourer :1161 Management :1052 Unskilled worker: 792 Foreman : 735 (Other) : 613 NA's :1498 1

nb.activitees Min. : 0.000 1st Qu.: 4.000 Median : 7.000 Mean : 6.866 3rd Qu.: 9.000 Max. :16.000

Transform the TV variable as factor hobbies[,"TV"] = as.factor(hobbies[,"TV"]) summary(hobbies[,"TV"]) ## 0 1 2 3 4 ## 1017 1223 2156 1775 2232

Loading FactoMineR library(FactoMineR)

MCA res.mca