MCA {FactoMineR} | R Documentation |
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 |
vector indicating the indexes of the "junk" categories (default is NULL), it can be a vector of the names of the categories or a vector of the indexes in the disjunctive data table |
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); the weights are given only for the active individuals |
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:
eig |
a matrix containing all the eigenvalues, the percentage of variance and the cumulative percentage of variance |
var |
a list of matrices containing all the results for the active variables (coordinates, square cosine, contributions, v.test, square correlation ratio) |
ind |
a list of matrices containing all the results for the active individuals (coordinates, square cosine, contributions) |
ind.sup |
a list of matrices containing all the results for the supplementary individuals (coordinates, square cosine) |
quanti.sup |
a matrix containing the coordinates of the supplementary quantitative variables (the correlation between a variable and an axis is equal to the variable coordinate on the axis) |
quali.sup |
a list of matrices with all the results for the supplementary categorical variables (coordinates of each categories of each variables, square cosine and v.test which is a criterion with a Normal distribution, square correlation ratio) |
call |
a list with some statistics |
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.
Author(s)
Francois Husson francois.husson@institut-agro.fr, Julie Josse, Jeremy Mazet
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
## 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))
## Graphical interface
require(Factoshiny)
res <- Factoshiny(tea)
## 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)