MFA | R Documentation |
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.
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)
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 "m" for group of mixed 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); the weights are given only for the active individuals |
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 |
summary.quali |
a summary of the results for the categorical variables |
summary.quanti |
a summary of the results for the quantitative variables |
separate.analyses |
the results for the separate analyses |
eig |
a matrix containing all the eigenvalues, the percentage of variance and the cumulative percentage of variance |
group |
a list of matrices containing all the results for the groups (Lg and RV coefficients, coordinates, square cosine, contributions, distance to the origin, the correlations between each group and each factor) |
rapport.inertie |
inertia 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.var |
a list of matrices containing all the results for the quantitative variables (coordinates, correlation between variables and axes, contribution, cos2) |
quali.var |
a list of matrices containing all the results for categorical variables (coordinates of each categories of each variables, contribution and v.test which is a criterion with a Normal distribution) |
freq |
a list of matrices containing all the results for the frequencies (coordinates, contribution, cos2) |
quanti.var.sup |
a list of matrices containing all the results for the supplementary quantitative variables (coordinates, correlation between variables and axes, cos2) |
quali.var.sup |
a list of matrices containing all the results for the supplementary categorical variables (coordinates of each categories of each variables, cos2 and v.test which is a criterion with a Normal distribution) |
freq.sup |
a list of matrices containing all the results for the supplementary frequencies (coordinates, cos2) |
partial.axes |
a list of matrices containing all the results for the partial axes (coordinates, correlation between variables and axes, correlation between partial axes) |
global.pca |
the result of the analysis when it is considered as a unique weighted PCA |
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.
Francois Husson francois.husson@institut-agro.fr, J. Mazet
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.
print.MFA
, summary.MFA
, plot.MFA
, dimdesc
,
Video showing how to perform MFA with FactoMineR
## Not run:
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))
#### 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"))
## Graphical interface
require(Factoshiny)
res <- Factoshiny(wine)
### with missing values
require(missMDA)
data(orange)
res.impute <- imputeMFA(orange, group=c(5,3), type=rep("s",2),ncp=2)
res.mfa <- MFA(res.impute$completeObs,group=c(5,3),type=rep("s",2))
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.