Extract the results for individuals/variables - MCA

Share:

Description

Extract all the results (coordinates, squared cosine and contributions) for the active individuals/variable categories from Multiple Correspondence Analysis (MCA) outputs.

  • get_mca(): Extract the results for variables and individuals

  • get_mca_ind(): Extract the results for individuals only

  • get_mca_var(): Extract the results for variables only

Usage

1
2
3
4
5
get_mca(res.mca, element = c("var", "ind"))

get_mca_var(res.mca)

get_mca_ind(res.mca)

Arguments

res.mca

an object of class MCA [FactoMineR], acm [ade4].

element

the element to subset from the output. Possible values are "var" or "ind".

Value

a list of matrices containing the results for the active individuals/variable categories including :

coord

coordinates for the individuals/variable categories

cos2

cos2 for the individuals/variable categories

contrib

contributions of the individuals/variable categories

inertia

inertia of the individuals/variable categories

Author(s)

Alboukadel Kassambara alboukadel.kassambara@gmail.com

References

http://www.sthda.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Multiple Correspondence Analysis
# ++++++++++++++++++++++++++++++
# Install and load FactoMineR to compute MCA
# install.packages("FactoMineR")
library("FactoMineR")
data(poison)
poison.active <- poison[1:55, 5:15]
head(poison.active[, 1:6])
res.mca <- MCA(poison.active, graph=FALSE)
 
 # Extract the results for variable categories
 var <- get_mca_var(res.mca)
 print(var)
 head(var$coord) # coordinates of variables
 head(var$cos2) # cos2 of variables
 head(var$contrib) # contributions of variables
 
 # Extract the results for individuals
 ind <- get_mca_ind(res.mca)
 print(ind)
 head(ind$coord) # coordinates of individuals
 head(ind$cos2) # cos2 of individuals
 head(ind$contrib) # contributions of individuals
 
 # You can also use the function get_mca()
 get_mca(res.mca, "ind") # Results for individuals
 get_mca(res.mca, "var") # Results for variable categories
 
 

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.