Learn R Programming

FactoMineR (version 1.34)

MCA: Multiple Correspondence Analysis (MCA)

Description

Performs Multiple Correspondence Analysis (MCA) with supplementary individuals, supplementary quantitative variables and supplementary categorical variables. Performs also Specific Multiple Correspondence Analysis with supplementary categories and supplementary categorical variables. Missing values are treated as an additional level, categories which are rare can be ventilated

Usage

MCA(X, ncp = 5, ind.sup = NULL, quanti.sup = NULL, quali.sup = NULL, excl=NULL, graph = TRUE, level.ventil = 0, axes = c(1,2), row.w = NULL, method="Indicator", na.method="NA", tab.disj=NULL)

Arguments

X
a data frame with n rows (individuals) and p columns (categorical variables)
ncp
number of dimensions kept in the results (by default 5)
ind.sup
a vector indicating the indexes of the supplementary individuals
quanti.sup
a vector indicating the indexes of the quantitative supplementary variables
quali.sup
a vector indicating the indexes of the categorical supplementary variables
excl
numeric vector indicating the indexes of the "junk" categories (default is NULL).
graph
boolean, if TRUE a graph is displayed
level.ventil
a proportion corresponding to the level under which the category is ventilated; by default, 0 and no ventilation is done
axes
a length 2 vector specifying the components to plot
row.w
an optional row weights (by default, a vector of 1 for uniform row weights)
method
a string corresponding to the name of the method used: "Indicator" (by default) is the CA on the Indicator matrix, "Burt" is the CA on the Burt table. For Burt and the Indicator, the graph of the individuals and the graph of the categories are given
na.method
a string corresponding to the name of the method used if there are missing values; available methods are "NA" or "Average" (by default, "NA")
tab.disj
optional data.frame corresponding to the disjunctive table used for the analysis; it corresponds to a disjunctive table obtained from imputation method (see package missMDA).

Value

Returns a list including:Returns the graphs of the individuals and categories and the graph with the variables. The plots may be improved using the argument autolab, modifying the size of the labels or selecting some elements thanks to the plot.MCA function.

References

Husson, F., Le, S. and Pages, J. (2010). Exploratory Multivariate Analysis by Example Using R, Chapman and Hall.

See Also

plotellipses, summary.MCA,print.MCA, plot.MCA, dimdesc, Video showing how to perform MCA with FactoMineR

Examples

Run this code
## Not run: 
# ## Tea example
#  data(tea)
#  res.mca <- MCA(tea,quanti.sup=19,quali.sup=20:36)
#  summary(res.mca)
#  plot(res.mca,invisible=c("var","quali.sup","quanti.sup"),cex=0.7)
#  plot(res.mca,invisible=c("ind","quali.sup","quanti.sup"),cex=0.8)
#  plot(res.mca,invisible=c("quali.sup","quanti.sup"),cex=0.8)
#  dimdesc(res.mca)
#  plotellipses(res.mca,keepvar=1:4)
#  plotellipses(res.mca,keepvar="Tea")
# 
# ## Hobbies example
# data(hobbies)
# res.mca <- MCA(hobbies,quali.sup=19:22,quanti.sup=23)
# plot(res.mca,invisible=c("ind","quali.sup"),hab="quali") 
# plot(res.mca,invisible=c("var","quali.sup"),cex=.5,label="none") 
# plot(res.mca,invisible=c("ind","var"),hab="quali")
# dimdesc(res.mca)
# plotellipses(res.mca,keepvar=1:4)
# 
# ## Specific MCA: some categories are supplementary
# data (poison)
# res <- MCA (poison[,3:8],excl=c(1,3))
# 
# ## Example with missing values : use the missMDA package
# require(missMDA)
# data(vnf)
# completed <- imputeMCA(vnf,ncp=2)
# res.mca <- MCA(vnf,tab.disj=completed$tab.disj)
# ## End(Not run)

Run the code above in your browser using DataLab