Learn R Programming

FactoMineR (version 1.34)

MFA: Multiple Factor Analysis (MFA)

Description

Performs Multiple Factor Analysis in the sense of Escofier-Pages with supplementary individuals and supplementary groups of variables. Groups of variables can be quantitative, categorical or contingency tables. Specific Multiple Fac tor Analysis can be performed using the argument excl. Missing values in numeric variables are replaced by the column mean. Missing values in categorical variables are treated as an additional level.

Usage

MFA (base, group, type = rep("s",length(group)), excl = NULL, ind.sup = NULL, ncp = 5, name.group = NULL, num.group.sup = NULL, graph = TRUE, weight.col.mfa = NULL, row.w = NULL, axes = c(1,2), tab.comp=NULL)

Arguments

base
a data frame with n rows (individuals) and p columns (variables)
group
a vector with the number of variables in each group
type
the type of variables in each group; four possibilities: "c" or "s" for quantitative variables (the difference is that for "s" variables are scaled to unit variance), "n" for categorical variables and "f" for frequencies (from a contingency tables); by default, all variables are quantitative and scaled to unit variance
excl
an argument that may possible to exclude categories of active variables of categorical variable groups. NULL by default, it is a list with indexes of categories that are excluded per group
ind.sup
a vector indicating the indexes of the supplementary individuals
ncp
number of dimensions kept in the results (by default 5)
name.group
a vector containing the name of the groups (by default, NULL and the group are named group.1, group.2 and so on)
num.group.sup
the indexes of the illustrative groups (by default, NULL and no group are illustrative)
graph
boolean, if TRUE a graph is displayed
weight.col.mfa
vector of weights, useful for HMFA method (by default, NULL and an MFA is performed)
row.w
an optional row weights (by default, a vector of 1 for uniform row weights)
axes
a length 2 vector specifying the components to plot
tab.comp
object obtained from the imputeMFA function of the missMDA package that allows to handle missing values

Value

Returns the individuals factor map, the variables factor map and the groups factor map. The plots may be improved using the argument autolab, modifying the size of the labels or selecting some elements thanks to the plot.MFA function.

References

Escofier, B. and Pages, J. (1994) Multiple Factor Analysis (AFMULT package). Computational Statistics and Data Analysis, 18, 121-140. Becue-Bertaut, M. and Pages, J. (2008) Multiple factor analysis and clustering of a mixture of quantitative, categorical and frequency data. Computational Statistice and Data Analysis, 52, 3255-3268.

See Also

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

Examples

Run this code
data(wine)
res <- MFA(wine, group=c(2,5,3,10,9,2), type=c("n",rep("s",5)),
    ncp=5, name.group=c("orig","olf","vis","olfag","gust","ens"),
    num.group.sup=c(1,6))
summary(res)
barplot(res$eig[,1],main="Eigenvalues",names.arg=1:nrow(res$eig))

## Not run: 
# #### Confidence ellipses around categories per variable
# plotellipses(res)
# plotellipses(res,keepvar="Label") ## for 1 variable
# 
# #### Interactive graph
# liste = plotMFApartial(res)
# plot(res,choix="ind",habillage = "Terroir")
# 
# ###Example with groups of categorical variables
# data (poison)
# MFA(poison, group=c(2,2,5,6), type=c("s","n","n","n"),
#     name.group=c("desc","desc2","symptom","eat"),
#     num.group.sup=1:2)
# 
# ###Example with groups of frequency tables
# data(mortality)
# res<-MFA(mortality,group=c(9,9),type=c("f","f"),
#     name.group=c("1979","2006"))
# ## End(Not run)

Run the code above in your browser using DataLab